system_accountNextIndex - JSON-RPC Me...
Get the next valid nonce for an account on Moonbase Alpha. Useful before building and submitting a signed extrinsic.
Returns the next valid transaction index (nonce) for an account.
cURL
curl -X POST https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"system_accountNextIndex","params":["0x879364b326a766a45b4b52a941f4574f7f6a6a64"]}'
JavaScript (polkadot.js)
import { ApiPromise, WsProvider } from '@polkadot/api';
async function main() {
const api = await ApiPromise.create({ provider: new WsProvider('wss://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY') });
const nonce = await api.rpc.system.accountNextIndex('0x879364b326a766a45b4b52a941f4574f7f6a6a64');
console.log('Next nonce:', nonce.toString());
await api.disconnect();
}Notes
- For Substrate signing, pass the same nonce when constructing a signed extrinsic.
- Combine with
payment_queryInfoto estimate fees before submission.