stampchain-io / btc_stamps

Bitcoin Stamps Indexer
https://stampchain.io
GNU Affero General Public License v3.0
11 stars 4 forks source link

Detect Ghost / Spent Outputs on Stamps #99

Open reinamora137 opened 9 months ago

reinamora137 commented 9 months ago

We need to detect if outputs have been spent on stamp

https://xchain.io/asset/A198700000019482022

This spent them https://blockstream.info/tx/9d861b2acdc4b91342c2e9b1dbf9900bc01ab8c720ec574c0b3189494098128b?expand

So it becomes a ghost prunable stamp

This project could also include calculating how much is tied up in a stamp output. This would also entail watching for any new transactions that spend them and updating a 'balances' table.

reinamora137 commented 8 months ago

this can be done in the utxo loop where we detect keyburn. likely need a new table to track all of the outputs in a similar manner to CP.

reinamora137 commented 7 months ago

For non-keyburn stamps the potential for the user spending the outputs on a trx making them prunable is real.

Need to add a db field in stamptable to identify spent and publish in the api as perhaps 'prunable'

reference this function: https://github.com/stampchain-io/btc_stamps/pull/75/files#diff-1335f2045757b08a0afd1c83b54ca5bcbaad6c8b835126c9f3d2169b9a36d360L412-L491