Filecoin.MpoolGetNonce - Filecoin

This method returns the next nonce for an address, accounting for messages already in the message pool. It is used to construct the next message from a sender.

Parameters

ParameterTypeRequiredDescription
addressstringYesThe sender address

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc": "2.0", "method": "Filecoin.MpoolGetNonce", "params": ["f1ne72cbn6r55wea7ifjv4ypyti7t2df5dumsjhzq"], "id": "getblock.io"}'

example.js

javascriptconst response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        jsonrpc: '2.0',
        method: 'Filecoin.MpoolGetNonce',
        params: ["f1ne72cbn6r55wea7ifjv4ypyti7t2df5dumsjhzq"],
        id: 'getblock.io'
    })
});

const data = await response.json();
console.log(data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'Filecoin.MpoolGetNonce',
        'params': ["f1ne72cbn6r55wea7ifjv4ypyti7t2df5dumsjhzq"],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": 43
}

Response Parameters

FieldTypeDescription
resultintegerThe next nonce to use for the sender

Use Cases

  • Message Construction: Set the nonce for a new message
  • Sequencing: Order multiple messages from one sender
  • Resubmission: Replace a stuck message at the same nonce
  • Wallet Backends: Compute nonces server-side before signing

Error Handling

Error CodeMessageDescription
-32602Invalid paramsA parameter is missing or has the wrong type or format
1Actor not foundThe address or actor does not exist in the requested tipset
-32603Internal errorThe node failed to process the request