bestinslot-xyz / OPI

Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin.
Apache License 2.0
202 stars 110 forks source link

feat: brc20 api for getting events by inscription id #27

Closed hwnprsd closed 7 months ago

hwnprsd commented 7 months ago

Getting events by inscription id is particularly useful for brc20 explorers who want to build on OPI. This way, inscription ID can be used similar to EVM's "transaction ID" to help prove transfers.

samedcildir commented 7 months ago

Thanks for the pull request. I'll merge this; however, do not use this as a replacement for txid since transfer inscriptions may have 2 events (inscribe and transfer) and they may not be consecutive events.

Currently you can use inscription_id + 'e' + event_type to uniquely define an event but with the upcoming swap module update, some inscriptions will be able to transfer more than one time so that will also not be unique. We'll probably add a transfer count to events table with swap module update, after that you can use something like inscription_id + 'e' + event_count as unique identifier for an event.