Skip to main content

How to customize a transaction nonce?

What is a nonce?โ€‹

Nonce in blockchain ensures transaction security and prevents replay attacks, ensuring sequential transaction processing. Each transaction from an EVM account has a unique nonce, starting at 0 and incrementing by 1 with each transaction sent. MPCVault automatically assigns nonces for EVM transactions unless customized. Customizing the nonce field allows for expediting or cancelling pending transactions.

How to customize the nonce during the signing process?โ€‹

Method 1: In-web consoleโ€‹

  1. Visit console.mpcvault.com.

  2. Navigate to the "Signing requests" page.

  3. Locate the signing request in the "Your approval needed" module that requires a custom nonce, and click to access the details page.

  4. Find the nonce field and click the "Edit" button, adjust the nonce value as necessary, and click "Save" to confirm the setting.

    Docusaurus Plushie

Method 2: In-appโ€‹

  1. Open the MPCVault app on your mobile phone.

  2. Navigate to the "Signing requests" page.

  3. Locate the signing request in the "Your approval needed" module that requires a custom nonce, and click to access the details page.

  4. Find and click the "Advanced nonce" button, adjust the nonce value as needed, and click "Save" to confirm your settings.

    Docusaurus Plushie

How to handle stuck transactions?โ€‹

Transactions may linger in a pending state, often termed โ€œstuck,โ€ due to network congestion or low gas fees. In this case, you can resolve it using the following methods:

Method 1: Cancel transactionโ€‹

You can directly use the cancellation feature provided by MPCVault. For detailed steps, please refer to here.

Method 2: Custom nonceโ€‹

  1. Initiate a new transaction. It is recommended to send a transaction with an amount of 0 to your own address to avoid asset loss.

  2. Change the nonce of the new transaction to be the same as the nonce of the stuck transaction.

  3. Increase the gas fee of the new transaction by approximately 20% compared to the stuck transaction.

  4. Sign and submit the new transaction to override the stuck transaction.

Method 3: Directly modify nonce and gas feeโ€‹

If a previous transaction is stuck and you intend to sign another one, you can directly set the nonce of the new transaction to be the same as that of the stuck transaction and increase the gas fee by about 20%. After signing and submitting the new transaction, the pending transaction will be overridden, effectively canceling it.

tip

Stuck transactions may succeed at any time. Please choose the appropriate method based on the actual situation.