Skip to main content

Managing stuck nonces

When sending a transaction without having the correct nonce, the next nonce available in database and the nonce of the blockchain might be desynchronized. To solve this issue, you can resynchronize your nonce for your wallet on a KMS.

info

Nonce management works for a specific address and network at a time. Please make sure you specify the right network in your request.

You can make the following request, by replacing parameters with:

  • YOUR_API_KEY: a Starton API Key
  • address: the address of your key on your KMS
  • network: the network on which you wish to resynchronize nonces
const axios = require("axios")

const startonAPI = axios.create({
baseURL: "https://api.starton.com",
headers: {
"x-api-key": "YOUR_API_KEY",
},
})

startonAPI
.get("/v3/kms/wallet/0x694F07CEEc0869aa0dB5E8157FA538268F28B23f/avalanche-fuji/nonce/available")
.then((res) => console.log(res.data))
.catch((e) => console.log(e))

startonAPI
.post("/v3/kms/wallet/0x694F07CEEc0869aa0dB5E8157FA538268F28B23f/avalanche-fuji/nonce/resync")
.then((res) => console.log(res.data))
.catch((e) => console.log(e))

If your request is successful, the next nonce available will be returned.

To avoid dealing with stuck nonces manually, you can set the strategy of your Relayer to allow Starton to manage them for you. Learn more in the Setting a transaction management strategy