How do you get "the raw bytes for the genesis transaction"?

1

This post

How to retrieve the from and to wallet addresses of a transaction?

contains code by Nick ODell which refers to a file called 'genesis.bin' which contains "the raw bytes for the genesis transaction". I wonder if anyone knows how to retrieve that data?

rodmclaughlin

Posted 2018-05-18T06:28:58.893

Reputation: 23

Answers

1

For regular transactions, if you have txindex=1 enabled on your node, you can call getrawtransaction to get the tx hex.

Interestingly, the genesis of the blockchain has a bug, and the genesis tx is not included in the UTXO set. Thus, you must get the genesis block, and take the transaction from that. You can do this using the getblock command, which outputs

0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000

In this, the genesis tx is:

01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000

Raghav Sood

Posted 2018-05-18T06:28:58.893

Reputation: 10 897