Understanding the purpose of nonce in Elrond Network NFT transactions

I’m working with NFT transfers on the Elrond blockchain and trying to understand how the nonce parameter works. When I look at the transaction structure for moving NFTs between wallets, I see there’s a nonce field that needs to be included.

NFTTransferTx {
    From: <sender wallet address>
    To: <sender wallet address>
    Amount: 0
    GasLimit: 1000000 + data_length * 1500
    Payload: "ESDTNFTTransfer" +
             "@" + <collection_id_hex> +
             "@" + <nft_nonce_hex> + 
             "@" + <transfer_amount_hex> +
             "@" + <recipient_address_hex>
}

Can someone explain what this nonce value represents in the context of NFTs? Also, how do I find the correct nonce value for a specific NFT that I want to transfer? I’m not sure if it’s something that gets generated automatically or if I need to look it up somewhere specific.

The nonce is what makes each NFT unique within a collection. When you mint NFTs, they get sequential nonces starting from 1. You can grab the nonce through the Elrond API or just check the explorer directly. I use JavaScript to fetch from the gateway API, then query by collection ticker and parse the response for the nonce. Here’s what tripped me up at first: you’ve got to convert the nonce to hex before adding it to your payload. The API gives you decimal values, but transactions need hex encoding. Miss this and your transactions will fail.

Interesting question! I’ve been working with Elrond NFTs lately and had the same confusion.

The nonce here isn’t the transaction nonce - it’s a unique ID for each NFT in a collection. Think of it as your NFT’s serial number.

Say you have a “CoolPunks” collection with 10,000 items. Each gets a different nonce (1, 2, 3, etc). When transferring “CoolPunks #5847”, you’d use 5847 as the nonce.

Find your NFT’s nonce by checking the Elrond explorer or querying your wallet through the API. The NFT details will show “nonce: 1234” or similar.

Are you building this manually or using existing SDKs? Have you tested transfers on devnet first? That helped me tons when learning this stuff.

Also, any issues with gas estimation? Those calculations can get tricky depending on payload size.

yeah totally! the nonce is like the id for each nft. use /accounts/{address}/nfts on elrond’s api to get nfts with their nonces. and don’t forget to convert to hex for the payload - that took me a while to figure out!