starknet_getNonce | Starknet

📘

Starknet OpenRPC spec

For the latest version of the publicly maintained OpenRPC spec, see the Starknet specs GitHub repo.

Starknet API method that returns the nonce for a given account.

It provides the nonce of the account, which is the number of transactions sent from the account's address. This is useful for clients or wallets to determine the nonce to include in a transaction to ensure that the network processes it in the correct order.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • address — the string of the address of the account.

Response

  • result — the nonce of the account, represented as a hexadecimal string.

Use case

A practical use case for starknet_getNonce is to retrieve the nonce for an account before sending a transaction. The nonce is an important factor in transactions, as it determines the order in which the network processes transactions from a given account. For example, if an account has a nonce of 10, the next transaction sent from that account should include a nonce of 11 to ensure that it is processed after all previous transactions.

Deprecated feeder gateway method

The feeder gateway was deprecated on December 11, 2023.

Example of the call you had to make to the feeder gateway before the deprecation:

curl 'https://alpha-mainnet.starknet.io/feeder_gateway/get_nonce?contractAddress=0x0569b13e8164bc8000c0bbcf4887856516643af123c5bc3b01e229e92f9cfd10'
Language
Click Try It! to start a request and see the response here!