Cách ước tính phí gas
Does this article need to be translated?
Submit translations, corrections, and suggestions on GitHub, or reach out on our Community forums.
Tính giá gas
Nếu bạn đang ở trong Ethereum Mainnet, bạn có thể sử dụng công cụ phí gas của Etherscan để ước tính giá gas hôm nay. Please note the gas price fluctuates; always refer to the tool to see the current gas prices.
Mạng Ethereum yêu cầu gas để thực hiện giao dịch. Khi bạn gửi token, tương tác với hợp đồng, gửi ETH hoặc làm bất kỳ điều gì khác trên chuỗi khối, bạn phải trả tiền cho công việc tính toán đó. Khoản tiền phải trả này được tính bằng gas và gas luôn được trả bằng ETH.
Bạn cần thanh toán cho công việc tính toán, bất kể giao dịch của bạn thành công hay thất bại. Even if it fails, validators must finalize and execute your transaction, which takes computational power. Bạn phải trả tiền cho công việc tính toán đó, giống như bạn sẽ trả cho một giao dịch thành công.
Tính hạn mức phí gas
Vậy, bạn biết mỗi đơn vị gas giá bao nhiêu, nhưng bạn cần bao nhiêu đơn vị gas để chi trả? Well, if it's a simple transaction—say, sending ETH or an ERC-721 token to another address—you should be spending 21,000 units of gas. If you're doing something more complex, a good tool is a block explorer, such as etherscan.io. Navigate to the contract you wish to interact with, and start examining transactions made with the contract. Điều này sẽ cho bạn một cái nhìn rõ hơn về việc những người dùng khác thực sự đã sử dụng bao nhiêu gas.
Công cụ tính phí gas
Có một số công cụ giúp bạn ước tính phí gas sẽ tương đương với bao nhiêu tiền pháp định trước khi bạn gửi giao dịch đi. One example is the Cryptoneur gas fee calculator, which lets you input the details of your transaction and produces the estimated gas cost in your local currency, and specific to current demand on that network (you can choose from most major EVM-compatible networks).
Cấu trúc tổng phí gas
Đối với EIP-1559, tổng chi phí mà người tạo giao dịch phải trả được tính là: ( (phí cơ sở + phí ưu tiên) x đơn vị gas đã sử dụng).
Để biết thêm thông tin, hãy xem ở đây.
Please note this is not a fee that MetaMask receives so we cannot refund it. This fee is paid to miners or validators for finalizing the transaction, validating it into a block, and securing the blockchain.