0

I am wondering how I can find the transaction that spends a specific output (for a large number of transactions). So for example, I have a transaction like the following: https://www.blockchain.com/btc/tx/ebd4a554faff31dd2a07135913fa073012a4495b195c1a5d5a9a7bca3e88de61. It has two outputs which are both spent. I would like to find the transaction that spends that output. Blockchain.com has a link to the spending transaction via the tx index (https://www.blockchain.com/btc/tx-index/355543195). However, they do not offer this an API endpoint and just in the GUI. I was wondering if there exists an API that offers to find the transaction via either the tx-index or other means.

Background I just started doing research on the lightning network and I was interested in the closing of channels. In particular, I took a snapshot of the lightning network in January from https://graph.lndexplorer.com/api/graph and scan all the channel transactions to see if the channel is closed. If the channel is closed I want to know if it was a mutual close, unilateral close, or a disputed unilateral close (an old commitment tx which should have a revocation tx following the commitment tx on the chain). Since the dataset has around 16.000 channels, I need an automated way of parsing through the transactions.

2

I would parse the blockchain. There are libraries for almost any programming language. You can in a 5-liner scan through all transactions and see which input they spent. You need to do this with a local parser and not via an remote api as remote api calls would take way too much time. If the input txid is an element of your funding txset wich you collected before it is a channel close (for now while we don't have Splicing)

On the other side 1ml.com has a history of channels with the closing tx. So you might be able to get the data you seek from them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.