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

meaning of colors on Mining Sim. "Computed block hash" #16

Open 7yl4r opened 6 years ago

7yl4r commented 6 years ago

It's not clear to me what the colorization below indicates

image

A popover explanation on the title "Computed block hash" or even just a note in the project README would be helpful.

PS: really cool tool. thank you for making this.

JornC commented 6 years ago

I'll quickly leave a comment here to explain the colors:

The more bits that are 0, the 'more valid' one could consider the byte in question, hence the more bits that are 1s, the redder the colour will be. This is irrespective if bit order and thus higher numbers can be 'greener' than lower numbers that are 'redder'.

For example take the orange-ish 0x37 in the above screenshot, in binary that's 0011 0111, 3 0s and 5 1s. That's 5 bits that make the block 'more invalid', and 3 bits that are 'valid', and so the colour chosen for this byte is 5/8ths worth of 'wrong', which is the color FFBF00 (as per https://github.com/JornC/bitcoin-transaction-explorer/blob/master/bitcoin-transactions-core/src/main/java/com/yoghurt/crypto/transactions/client/widget/TargettedHashHexViewer.java#L18)

JornC commented 6 years ago

To illustrate further, the number 0x4F above has the some colour.

In binary that's 0100 1111: 3 zeroes, 5 ones. Same 'validness' as 0x37 if you will, so same colour.

7yl4r commented 6 years ago

Ah, thanks. That makes perfect sense.

Giszmo commented 3 years ago

The colors are confusing and don't give much feedback even if you know the above. To be more accurate, you could color each hex symbol individually, considering those to the left. Then you would have only one symbol with a redish green, green to its left (if any) and red to its right. If you then tune up the speed some orders of magnitude and keep around the "best hit so far", it might become more clear.

I did the above without colors and keeping around all prior best hits in this simulator.