- Let's look at block 125552, because that's the one I used to slash through this conceptual forest a few months ago.
- $ cat btc-blocks/125552
- Nonce (the last field in the block header) is the primary thing you vary while mining. There's an "extraNonce" field in the coinbase transaction, which you can also use to take some more entropy. Here the value 42A14695 happens to solve the block:
- $ xxd -p -r btc-blocks/125552 |sha256sum |xxd -p -r |sha256sum
- 1dbd981fe6985776b644b173a4d0385ddc1aa2a829688d1e0000000000000000 -
- All those zeroes at the end are what you're after. You're not strictly after "many zeroes at the end" but a value that's less than some threshold determined by network difficulty. It's backwards because of endianness getting into things. If you had used any other value for the nonce field (or indeed any of the fields in the block header - but the nonce is the one that's most convenient to vary while mining), the block hash would be overwhelmingly unlikely to satisfy the difficulty requirement.
Worked example of mining a bitcoin block
a guest Oct 15th, 2013 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data