HomePhabricator

[Chronik] Add `/token-id/...` endpoints

Description

[Chronik] Add /token-id/... endpoints

Summary:
For some applications (e.g. the explorer or token airdrops), it is helpful to have an endpoint that returns txs/UTXOs with a given token ID.

We add these HTTP endpoints:

  1. /token-id/:token_id/confirmed-txs
  2. /token-id/:token_id/history
  3. /token-id/:token_id/unconfirmed-txs
  4. /token-id/:token_id/utxos

Since have a generic implementation that allows us to easily group txs, this now becomes really easy, we simply add TokenIdGroup, implement Group on it and use the generic group writer + mempool to index txs by token ID.

The only tricky part is getting the auxillary data for the group, which can come from 3 different sources (for BlockConnected: from ProcessedTokenTxBatch, for BlockDisconnected: from the DB, for mempool inserts/removals: from the mempool).

Depends on D15383 and D15370.

Test Plan: ninja && ./test/functional/test_runner.py chronik_token_id_group

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D15386

Details

Provenance
tobias_ruckAuthored on Feb 5 2024, 16:03
tobias_ruckPushed on Feb 12 2024, 12:22
Reviewer
Restricted Project
Differential Revision
D15386: [Chronik] Add `/token-id/...` endpoints
Parents
rABCc1918fae2e5d: [Chronik] Add `UtxoData` and `UtxoProtobuf` to allow storing UTXOs' scripts in…
Branches
Unknown
Tags
Unknown