⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

starknet_getNonce

Get the nonce associated with the given address in the given block

Parameters

ParameterTypeDescription
block_idstringBlock reference ("latest", "l1_accepted", block hash, or block number)
contract_addressfelt252Contract address

Request

{
"jsonrpc": "2.0",
"method": "starknet_getNonce",
"params": [
{
"block_hash": "0x05abbad1e5"
},
"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
],
"id": 1
}

Returns

The contract's nonce at the requested state

Contract nonce (felt252)

Errors

CodeMessage
24Block not found
20Contract not found

Examples

curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "starknet_getNonce",
"params": [
{
"block_hash": "0x05abbad1e5"
},
"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
],
"id": 1
}'