Ethereum
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Ethereum
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
eth_getTransactionCount returns how many transactions an address has sent on Ethereum mainnet (chain ID 1, the network whose gas is paid in ETH) up to a given block — which is exactly the account's nonce. Every transaction from an account carries a nonce that must increase by one each time, and Ethereum uses it to order an account's transactions and to block replays. So the count this returns is also the next nonce you'll sign with. The block argument matters: at latest you get the nonce from confirmed transactions, while pending folds in what's already sitting in the mempool. Send the request to https://ethereum.therpc.io/YOUR_API_KEY.
pending, use that value, and your transaction slots in right after whatever's already queued.pending sits above latest, something you sent hasn't been mined and is holding up everything behind it.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | address | string (hex) | Sí | The account whose nonce to query. |
| 2 | blockTag | string | No | Use "pending" to include mempool transactions when chaining multiple sends.Predeterminado: latest |
| Tipo | Descripción |
|---|---|
| string (hex) | Hex-encoded nonce (number of confirmed transactions sent from the address at that block). |
Try it live in the Ethereum playground.
| Código | Mensaje | Causa |
|---|---|---|
-32602 | Invalid params | Address is malformed or block tag is unrecognised. |
-32000 | Missing trie node | Historical block pruned on a non-archive node. |
pending, not latest. latest only counts confirmed transactions, so it hands the same nonce to every send in the burst and they collide.CREATE/CREATE2 deployments it makes, not ordinary calls into it. So a contract that never deploys another contract keeps a nonce of zero no matter how often it's invoked.Parámetros
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"