vocdoni / interoperability

Private repository to manage the interoperability between protocol, API, SDK, UIs and documentation
1 stars 0 forks source link

Remove transaction `id` #221

Open altergui opened 2 months ago

altergui commented 2 months ago

as part of the work i'm doing on the indexer, i'm considering removing the concept of "transactionNumber", currently an incremental id that basically counts how many transactions were done since genesis.

curl 'https://api-stg.vocdoni.net/v2/chain/transactions/1497510/0' -s |jq
{
...
  "txInfo": {
    "transactionNumber": 21942, <--- this
    "transactionHash": "6624f05ede172313bd7f04afff11ab76ae3da80884cf66478afe39e2f8566789",
    "blockHeight": 1497510,
    "transactionIndex": 0,
    "transactionType": "setAccount"
  },
  "signature": "0cc28641b07cc2538c9e7e9a076efce2e713c52d0a165923ebd9415eba7124ca7522aa5bf74c54c4d57a6e0a65c2b86719827c9167f8b3579f8e74b6eb3fc47e00"
}
curl 'https://api-stg.vocdoni.net/v2/chain/transactions/1497510/0' -s | jq .txInfo.transactionNumber
21942

i'm working on this in https://github.com/vocdoni/vocdoni-node/pull/1329 and it's still WIP but when it's merged will require changes in sdk and explorer, since:

this endpoint will no longer exist (will return 405)

the json returned by the following paginated endpoints will change (each transaction in the list will no longer have a transactionNumber field)

as well as these endpoints in a similar manner (the returned json will no longer have a transactionNumber field)

altergui commented 2 months ago

if you have any comments or early feedback already, much appreciated

selankon commented 2 months ago

Why to do this? Actually the explorer shows the transaction number as part of the information shown for a transaction. Is a big effort to continue maintaining this?

image

image

Is also true that on other explorers like this https://eth.blockscout.com/txs the transaction number is not shown on txs list / details.

So if you finally remove it for any reason, the explorer must be refactored

altergui commented 1 month ago

it does make the reindexing code more complex, and indeed other blockchains have no such concept, they index txs by blockHeight+blockIndex (that we also do, so it's redundant)

i've created https://github.com/vocdoni/vocdoni-node/pull/1371