<p>Unfortunately, the genesis block is not indexed in most altcoins (because they forked from bitcoin and kept the same bug), so you can't really get access to it via the RPC methods. </p>

<p>What you could do instead:</p>

<ul>
<li>Use a block explorer that will tell you the size of the transaction. For example, <a href="https://blockchain.info/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" rel="nofollow">blockchain.info</a> makes this information available (204 bytes).</li>
<li>Find the parameters file and put a print the size of the genesis block to stdout. </li>
</ul>

<p>The second option basically entails putting the following lines at the end of <code>CMainParams()</code> and then compiling. </p>

<pre><code>CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
ssBlock &lt;&lt; genesis;
printf("block: %s\n", HexStr(ssBlock.begin(), ssBlock.end()).c_str());
printf("block size: %i\n", (int)::GetSerializeSize(genesis, SER_NETWORK, PROTOCOL_VERSION));
printf("tx size: %i\n", (int)::GetSerializeSize(genesis.vtx[0], SER_NETWORK, PROTOCOL_VERSION));
</code></pre>

<p>This will print the raw block data, it's size, and the transaction's size. (Note, this is untested, but something along these lines should work)</p>

<p>NOTE: It's possible, although not the norm, to put multiple transactions in a genesis block. Just check that your assumption is correct.</p>

CC BY-SA 3.0
2015-04-06T19:09:00.447Z
Size would definitely work for this situation.  Only problem is that I am trying to make the block explorer for the coin via Abe, so option 1 isn't available to me.  Could you explain the second option?  I am guessing you mean chainparams.cpp but I have no idea how to print the size of the genesis block.
AnimalTesting
CC BY-SA 3.0
2015-04-06T19:16:32.957Z
@AnimalTesting, see updated answer.
morsecoder
CC BY-SA 3.0
2015-04-06T19:34:28.950Z
How would I use the new code?  What command do I have to pass into the daemon?
AnimalTesting
CC BY-SA 3.0
2015-04-06T19:35:28.137Z
It requires actually re-compiling the daemon after you have put the code in place. Then just start the daemon and it will print.
morsecoder
CC BY-SA 3.0
2015-04-06T19:38:55.167Z
Also, will this say the size of the block or transaction?  You said "This will print the raw block data and it's size."  But in the first option, you show how to find the size of the transaction.
AnimalTesting
CC BY-SA 3.0
2015-04-06T19:39:53.047Z
It gave this error when compiling: http://pastebin.com/qgAjUFyg
AnimalTesting
CC BY-SA 3.0
2015-04-06T19:41:58.137Z
@AnimalTesting, updated answer.
morsecoder
CC BY-SA 3.0
2015-04-06T19:43:03.520Z
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/22612/discussion-between-animaltesting-and-stephenm347).
AnimalTesting
CC BY-SA 3.0
2015-04-06T19:02:26.930Z
2015-04-06T19:40:48.243Z
2015-04-06T19:40:48.243Z
morsecoder
<p>I see that many different altcoins have different lengths for the initial genesis tx.  How would I go about finding the length of the initial genesis tx?  I saw another answer but I have no need of making it as complicated; I just need the length and nothing else.</p>

<p>For example, Bitcoin's is </p>

<pre><code>01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000.
</code></pre>

<p>However, altcoins have different lengths.  Is there an identifier I can use to determine the length of the genesis tx and nothing else?</p>

<p>EDIT: I am making a block explorer so I cannot use a block explorer to help me in getting info.</p>

CC BY-SA 3.0
2015-04-06T18:50:39.567Z
The transaction you posted is 204 bytes. Is that what you're looking for?
Nick ODell
CC BY-SA 3.0
2015-04-06T18:58:47.887Z
@NickODell That's only for bitcoin.  What I need is http://bitcoin.stackexchange.com/questions/36321/extract-genesis-block-raw-tx-data in a condensed format, preferably done in bash instead of python.
AnimalTesting
<raw-transaction><genesis-block>
Trying to find the raw genesis transaction length
AnimalTesting
# Trying to find the raw genesis transaction length

(Asked by: username_0 on 2015-04-06)

I see that many different altcoins have different lengths for the initial genesis tx. How would I go about finding the length of the initial genesis tx? I saw another answer but I have no need of making it as complicated; I just need the length and nothing else.

For example, Bitcoin's is

```
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000.

```

However, altcoins have different lengths. Is there an identifier I can use to determine the length of the genesis tx and nothing else?

EDIT: I am making a block explorer so I cannot use a block explorer to help me in getting info.

**Tags:** raw-transaction, genesis-block

> **Comments:**
> **username_1**: The transaction you posted is 204 bytes. Is that what you're looking for?  
> **username_0**: @username_1 That's only for bitcoin.  What I need is http://bitcoin.stackexchange.com/questions/36321/extract-genesis-block-raw-tx-data in a condensed format, preferably done in bash instead of python.  

---

## 1 answers

### Answer by username_2 on 2015-04-06. Score: 2 | Accepted answer

Unfortunately, the genesis block is not indexed in most altcoins (because they forked from bitcoin and kept the same bug), so you can't really get access to it via the RPC methods.

What you could do instead:

* Use a block explorer that will tell you the size of the transaction. For example, [blockchain.info](https://blockchain.info/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b) makes this information available (204 bytes).
* Find the parameters file and put a print the size of the genesis block to stdout.

The second option basically entails putting the following lines at the end of `CMainParams()` and then compiling.

```
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
ssBlock << genesis;
printf("block: %s\n", HexStr(ssBlock.begin(), ssBlock.end()).c_str());
printf("block size: %i\n", (int)::GetSerializeSize(genesis, SER_NETWORK, PROTOCOL_VERSION));
printf("tx size: %i\n", (int)::GetSerializeSize(genesis.vtx[0], SER_NETWORK, PROTOCOL_VERSION));

```

This will print the raw block data, it's size, and the transaction's size. (Note, this is untested, but something along these lines should work)

NOTE: It's possible, although not the norm, to put multiple transactions in a genesis block. Just check that your assumption is correct.

> **Comments:**
> **username_0**: Size would definitely work for this situation.  Only problem is that I am trying to make the block explorer for the coin via Abe, so option 1 isn't available to me.  Could you explain the second option?  I am guessing you mean chainparams.cpp but I have no idea how to print the size of the genesis block.  
> **username_2**: @username_0, see updated answer.  
> **username_0**: How would I use the new code?  What command do I have to pass into the daemon?  
> **username_2**: It requires actually re-compiling the daemon after you have put the code in place. Then just start the daemon and it will print.  
> **username_0**: Also, will this say the size of the block or transaction?  You said "This will print the raw block data and it's size."  But in the first option, you show how to find the size of the transaction.  
> **username_0**: It gave this error when compiling: http://pastebin.com/qgAjUFyg  
> **username_2**: @username_0, updated answer.  
> **username_0**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/22612/discussion-between-username_0-and-stephenm347).  

---

