3

I was looking on http://blockexplorer.com/ and saw a coinbase of 304602210088c72f5fae851934be23ea7f563ce0424397939480e52c27225efbd8c0c1fccc022100e882cc00e76ae150aefe76fa89a262198d4f1d67f95d2cc3a60ce189017c199901 and wondered what block it was a reward from. I didn't know if the coinbase has anything to do with what block it was generated in.

3

Blocks with a version of 2 or greater are required to put their block height in the coinbase. Your example doesn't. (At some point in the future, version 1 blocks will probably be discouraged and then banned.)

Here's an example of one that does:

038232030650b25c7d0f8bfabe6d6d0ebaccab777b7b5f4745bc81a22654d2fde018c3e8f06823670f5e790cbde3b6010000000000000000454d432055533300

The block height is the first thing in the coinbase. 03 is how many bytes the number has. So the number is 0x823203 in Bitcoin's little endian byte ordering, or 0x033282 in the big-endian byte ordering that humans usually use. Convert this into decimal and you can see that this is block #209538.

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.