btc-rpc-explorer icon indicating copy to clipboard operation
btc-rpc-explorer copied to clipboard

Feature request: link to spending transaction of any spend transaction output thanks to Electrum

Open Pantamis opened this issue 3 years ago • 8 comments

Hi,

I find really useful to follow privately a chain of transactions (Pool snapshot or follow the toxic change in JoinMarket CoinJoin) with this explorer. It is already very easy to rewind a chain of transactions with the link to the spend TXO of each inputs but it is much longer and more boring to follow a chain of transactions forward because we have no link to the spending transaction of a spend transaction output.

We can look at all transactions spending any TXO of the looked transaction output's address with Electrum and find the one spending exactly the output we are looking at. Blockstream explorer does that when we look at the details of a transaction. It is a bit boring to do it manually, there should be a way to do it automatically in BTC RPC Explorer.

Maybe it can be a bit too long to do it for all transaction output showed in a block or the mempool so you could restrict this behavior to transaction details only. Another idea of UX I find cool and without this drawback is to require that the user clicks on the displayed unlocked lock of a spend output to automatically go to its spending transaction.

I think that it may need some kind of reindexation of the blockchain without electrum but I guess it's fine to require Electrum for this feature to work anyway. Also one problem of this approach with Electrum is that some addresses may be reused a lot and this can dramatically increase the time to find the spending transaction, that's why I propose to do it only if we click on the unlocked lock you display for a spend output.

What's your opinion ? I would be really happy to have this feature in my best explorer :)

Thanks again for the amazing work !

Pantamis avatar Jan 16 '21 18:01 Pantamis

There's currently no easy way to find the the spending txid of a given output using the Electrum protocol, though it is planned for the next protocol upgrade.

The closest you can do right now is fetch the entire history of the output's scripthash, then go through that and look for the transaction spending the given output.

shesek avatar Jan 16 '21 20:01 shesek

Direct Electrum support of spending txid would make it very easier to implement indeed :)

Yes, that's what I do but it's long and boring ! My request is to make this txid search (among the history of the output's scripthash) automatically and directly shows the spending transaction when clicking on the unlocked lock diplayed by the explorer for a spend output :). The only problem would be the output's scripthash with very long history, the txid search would take a long time but it's fine for individuals use-cases.

Pantamis avatar Jan 16 '21 22:01 Pantamis

Basic usage question, what is the most efficient way to go to the wallet address that an UTXO was sent to?

Let's take for example this TXN:

image

Is there an easier way than clicking the "JSON" tab and looking for "address" in the JSON? Would be great if I could just click my way through, without copy&pasta.

image

xanoni avatar Jul 16 '21 09:07 xanoni

For me, the output of a transaction is always in the form of an adress on which I can click to display balances and transaction history (if it is not too big !). My request would be to also link the spending transaction of an output.

Your display is weird, if you want us to check if the transaction is also shown as yours in our explorers, please write the transaction ID in text !

Pantamis avatar Jul 16 '21 13:07 Pantamis

I deleted my comments and moved the discussion to a dedicated issue: https://github.com/janoside/btc-rpc-explorer/issues/355

xanoni avatar Jul 23 '21 23:07 xanoni

I believe electrs supports batched jsonrpc requests so maybe consider using them? It could speed up fetching of large transactions.

Kixunil avatar Aug 16 '21 11:08 Kixunil

Aw yes indeed that's a good use-case now (not really with scripthash since we only call scripthash once at a time in th explorer).

This may be useful to do it: https://github.com/janoside/electrum-client/blob/d98e929028d2b05c88a41fe37652737912bead79/lib/client.js#L123-L144

It should not take too much time I hope, please comment on the PR once I made it :)

Pantamis avatar Aug 16 '21 13:08 Pantamis

@Kixunil You can take a look at the PR, I couldn't use requestBatch so if you have an idea how to make the code cleaner you can share it in the PR discussion !

Pantamis avatar Aug 17 '21 11:08 Pantamis