yogh-io / bitcoin-transaction-explorer

Simple and pure block explorer you can run on top of a full node
http://yogh.io
MIT License
181 stars 38 forks source link

Upgrade for SegWit #13

Closed JornC closed 6 years ago

JornC commented 8 years ago

With SegWit being merged, and its release in clients and subsequent activation on the network looming around the corner, adapting some shred of it into this block explorer is becoming a strong desire.

Some pointers:

And optionally:

JornC commented 8 years ago

FTR

yoghurt [22:46]
@roasbeef: heyho, any suggestions for this: http://srv2.yogh.io/#block:last block explorer with regards to upgrading it for segwit, perchance?

roasbeef [22:46]
yeah I'll take a peak [22:46]
smartbits had a nice one (better than the rest) for segnet, but seems they haven't upgraded their testnet node [22:47]
one suggestion is to also display the witness root [22:47]
it's in the op_return of the coinbase tx, ​iff​ there are witness txns in the block [22:48]
code to locate it looks like: https://github.com/Roasbeef/btcd/blob/2fdd75f73301f56650c1a39ded5138109f6d6ea2/blockchain/merkle.go#L157 [22:48]
the salient bytes are: https://github.com/Roasbeef/btcd/blob/2fdd75f73301f56650c1a39ded5138109f6d6ea2/blockchain/merkle.go#L30 [22:50]
the coinbase tx has the witness nonce in its witness stack, which is just all zeroes atm, but will change in future soft-forks to add more comtiments

yoghurt [22:52]
thanks @roasbeef, I can definitely work with that :+1:

[22:53]
yoghurt: you'll also want to display cost: https://github.com/Roasbeef/btcd/blob/segwit-final/blockchain/cost.go#L52 [22:53]
and "vsize" for transactions: https://github.com/Roasbeef/btcd/blob/segwit-final/blockchain/cost.go#L39 [22:53]
after segwit "vsize" is used to calculate sufficient tx fees, and priority