Nhảy tới nội dung

Cách tăng tốc hoặc hủy giao dịch đang chờ xử lý

Does this article need to be translated?

thông tin

Have you tried MetaMask Activity?

MetaMask Activity is a new tool that can analyze your transactions and automatically suggest possible resolutions, and it has a built-in function dedicated to pending transactions. Why not try it out? Xem tại đây để biết thêm thông tin.

Khi bạn gửi đi một giao dịch trên Ethereum hoặc một mạng tương thích, một phần gas bạn trả là khoản trả cho mạng để xử lý giao dịch của bạn nhanh hơn – yếu tố này được coi là phí ưu tiên.

Although MetaMask will assist you by calculating a total gas fee likely to have your transaction picked up, you can end up waiting a long time if you submit with a low gas price. For advice on what gas prices will result in a transaction being finalized in a reasonable amount of time, please refer to sources such as Etherscan's gas tracker, or a similar tracker for whichever network you're using.

Thêm vào đó, đôi khi có những trường hợp có lỗi xảy ra và một giao dịch bị kẹt hoặc phải chờ xử lý rất lâu.

Dù bạn gặp tình huống này vì lý do gì, thì luôn có một số cách khác nhau để giải quyết.

Trước khi bạn thực hiện thêm bất cứ hành động gì, bước đầu tiên bạn cần làm là thoát và tắt trình duyệt hoàn toàn, mở lại trình duyệt, và mở khóa MetaMask (trên di động, chỉ cần đóng ứng dụng rồi mở lại). Nếu làm vậy không giải quyết được vấn đề, hãy tiếp tục với các bước sau:

Tăng tốc một giao dịch

MetaMask speed up pending transaction extension

Hãy thử một trong những tùy chọn dưới đây:

  • Chờ đến khi mạng sẵn sàng xử lý giao dịch với giá này
  • If you haven't done so already, click that button that says 'Speed up'. Thao tác này sẽ cho phép bạn gửi lại chính giao dịch đó, nhưng với phí gas cao hơn để giao dịch được xử lý nhanh hơn. Vì quá trình này sử dụng số Nonce như giao dịch gốc, bạn sẽ không cần trả phí gas hai lần.

Bear in mind that speeding up the transaction will increase the amount you're spending for the transaction.

Canceling a transaction

Method 1: In-app cancellation

If you haven't done this already, to cancel the transaction, simply select Cancel, as in the screenshot above. Please note, a cancellation can only be attempted if the transaction is still pending on the network. Transactions that have already been confirmed cannot be reversed.

MetaMask cancel pending transaction extension

Method 2: Custom nonce

ghi chú

To make the custom nonce box visible, you need to turn off the Smart Transactions feature. You can do this by going to "Advanced Settings" and toggling the feature off. After clearing the pending transaction, you can easily re-enable Smart Transactions by toggling it back on.

Quá trình này bao gồm việc gửi một giao dịch mới với cùng số nonce (là số định danh cho mỗi giao dịch, viết tắt của cụm từ "số chỉ được sử dụng một lần"). The transaction does not actually have to have any value — e.g. you could send 0 ETH. What matters is that you pay enough gas for the network to prioritize it.

When using this method, you will need to work backwards from the oldest pending transaction in the queue that you want to cancel. For example, you cannot attempt to cancel a transaction with a nonce of 10 before canceling nonce 9.

Note also that you may be able to cancel multiple transactions at once if they have the same nonce. Since a nonce—by definition—can only be used once, cancelling one of them will cancel all that have the same nonce.

Những ảnh chụp màn hình dưới đây được chụp vào những thời điểm khác nhau, nên phí gas hiển thị có thể thay đổi, dù là qua các bước. Đừng để nó khiến bạn nản chí! Khi bạn tự làm điều này, MetaMask sẽ tự động cập nhật trong thời gian thực để hiển thị tỷ giá thị trường.

  1. In advanced settings, turn on Customize transaction nonce. You'll need this turned on so you can send a replacement transaction (using the same nonce). Find out how to locate a transaction's nonce here.

MetaMask customize transaction nonce settings

  1. Gửi một giao dịch mới. In the new transaction, send TO yourself, meaning your MetaMask public address. Điền vào phần "Số nonce tùy chỉnh" với cùng số nonce của giao dịch vẫn đang chờ xử lý:

Metamask custom transaction nonce Extension

  1. Next to the estimated fee on the transaction confirmation screen, you'll see a pencil icon to edit the fee. Click the edit icon and then select 'Advanced' at the bottom:

MetaMask advanced gas controls find

To make sure your cancellation request is picked up as a priority, and before the original, you will need to pay more for gas. On this screen, follow these instructions:

  • Set your gas limit comparable to or slightly higher than your original transaction.
  • Set your priority fee to at least 10% higher (in Gwei) than the gas fee of the original (pending) transaction (e.g. if that transaction had a gas fee of 30 Gwei, set the max priority fee in the replacement/cancellation transaction to 33-35 Gwei).
  • Make sure your max fee is at least 30% higher than the max fee of the transaction you're replacing. Ví dụ: nếu phí trước đó của bạn là 150 Gwei, lần này hãy chọn một con số gần 200 Gwei hơn.

Check a gas tracker such as Etherscan's for guidance on recommended max fees.