Trung Quốcnemo-crypto/Web3
Web3 中文实战教程,涵盖 Papertrade(PAPER 质押与 USDC 分润)、Hyperliquid、HyperEVM、Perp DEX、DeFi、代币经济学、智能合约、钱包、跨链和稳定币支付。Chinese Web3 guides with worked examples and exercises.
Thành tựu nổi bật
Những danh hiệu mới nhất của dự án
#1 Repository của tuần
#1 Repository của tuần
#1 Repository của tuần
🆚 Web3.js vs Ethers.js: Bảng so sánh trọn gói từ khởi tạo tới hiệu năng
So sánh trực tiếp giữa Web3.js và Ethers.js qua ví dụ thực tế: khởi tạo, giao tiếp contract, công cụ hỗ trợ, và performance benchmark.
Đây là kho lưu trữ trọng lực so sánh hai thư viện Web3 phổ biến nhất trong cộng đồng phát triển blockchain: Web3.js (do Ethereum Foundation phát triển) và Ethers.js (thiết kế hiện đại, nhẹ gọn). Dự án minh họa rõ rệt sự khác biệt qua từng thao tác thực tế như kết nối ví, gọi hàm smart contract, chuyển đổi đơn vị, lắng nghe sự kiện...
✨ Điểm nổi bật
- Khởi tạo provider: Web3.js dùng
new Web3.providers.HttpProvider, Ethers.js dùngnew ethers.providers.JsonRpcProvider - Kết nối MetaMask: Web3.js dùng
window.ethereum, Ethers.js bọc bằngWeb3Provider+getSigner() - Gọi hàm contract: Web3.js cần
.methods.xxx().call(), Ethers.js gọi trực tiếpcontract.xxx() - Chuyển đổi đơn vị: Web3.js dùng
utils.toWei/fromWei, Ethers.js dùngparseEther/formatEther - Batch request: Web3.js hỗ trợ
BatchRequest, Ethers.js dùngPromise.all(provider.getBalance(...)) - Lắng nghe sự kiện: Web3.js dùng
.on('data'), Ethers.js dùng callback trựtiếp trong.on('Transfer', ...) - Kích thước gói: Web3.js ~1.5MB, Ethers.js ~116.5KB — khác biệt khổng lồ
- TypeScript: Ethers.js hỗ trợ nguyên sắc, Web3.js chỉ cơ bản
💡 Vì sao đáng chú ý
Ethers.js thiết kế API theo phong cách Promise/async-await, giúp code sạch và dễ bảo trì hơn Web3.js với phong cách callback hỗn hợp. Đặc biệt, kích thước nhỏ hơn 10 lần giúp tốc độ tải trang nhanh hơn đáng kể — ưu thế rõ rệt khi chạy trên web. Tuy nhiên, Web3.js vẫn mạnh tay trong xử lý batch request và linh hoạt trong lắng nghe sự kiện. Lựa chọn nên dựa trên nhu cầu: dự án nhỏ, cần tốc độ và TypeScript → chọn Ethers.js. Dự án lớn, cần xử lý hàng loạt phức tạp → Web3.js vẫn là lựa chọn ổn định.
#Web3 #Ethersjs #Web3js #Blockchain #SmartContract #TiniX
Dự án tương tự
Khám phá các dự án và mô hình AI khác có sự tương đồng.
Mastering Ethereum: 2nd Edition, by Andreas M. Antonopoulos, Gavin Wood, Carlo Parisi, Alessandro Mazza, Niccolò Pozzolini
DeFi Developer roadmap is a curated Developer handbook which includes a list of the best tools for DApps development, resources and references!
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
WTF Solidity 极简入门教程,供小白们使用。Now supports English! 官网: https://wtf.academy
Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
A guide to smart contract security best practices
Ethereum.org is a primary online resource for the Ethereum community.