stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 671 forks source link

[RPC] New rpc endpoint to return mempool nonces #5139

Open wileyj opened 2 months ago

wileyj commented 2 months ago

similar to how the API currently returns the data, i think it would be a good addition if the stacks-node RPC also returned some nonce data about what's in the mempool. api example:

➭ curl -sL localhost:3999/extended/v1/address/STG68569SAD11DAGZ3DJQ66N396R1CD91NSB660Z/nonces

{
  "last_executed_tx_nonce": 22,
  "last_mempool_tx_nonce": 49,
  "possible_next_nonce": 50,
  "detected_missing_nonces": [
    23
  ],
  "detected_mempool_nonces": [
    24,
    25,
    ...
  ]
}

in this case, it would be helpful to know there's a missing nonce in the mempool when only running a node locally (without having the extra overhead of running an API/postgres). I can see the benefit here mainly in local testing, where txs are being broadcast to localhost (i.e. on a regtest env where there's no need to run an API).

low priority, we can discuss after 3.0