<p>In old versions of the Bitcoin Core codebase, the genesis block was verified as a normal block. All normal rules had to apply to it, including proof of work and difficulty. This meant that if you would modify the contents of the genesis block arbitrarily, it almost certainly would not validate anymore.</p>

<p>Since the genesis block is actually part of the definition of the chain, there is no real need to verify it. In more recent versions, the genesis block is just valid by fiat. This means that when using such a codebase, no complicated script that "mines" the genesis block is needed anymore to define a new chain.</p>

CC BY-SA 3.0
2017-05-11T11:32:28.897Z
so in the past I would have had to create a genesis block from a script but now I can just define the `pszTimestamp` from `chainparams.cpp` and it will get it up and running just like that?
smatthewenglish
CC BY-SA 3.0
2017-05-07T16:48:30.110Z
2017-05-07T16:48:30.110Z
Pieter Wuille
<p>did u managed to start a new chain? I also try the same but i modiefied a lot iin chainparams.cpp already without success and  i also created genesis block extern with a python script but the main code doesnt accept it (assertion failed) so looks like i m missing something hidden in the code ;) 
set checkpoints to o uint256= "0x" is right no? 
cheers</p>

CC BY-SA 3.0
2017-05-19T07:40:10.297Z
not sure man- but I'm totally interested to put our heads together to figure it out- I got a bit farther than this- in some of the related questions- a good place to start if by `diff`ing Litecoin and Dogecoin and looking at what they changed- here's what I've got so far https://github.com/stratton-oakcoin feel free to make a pull request or get at me on Twitter or something if you want to talk.
smatthewenglish
CC BY-SA 3.0
2017-05-18T14:42:46.293Z
2017-05-18T14:42:46.293Z
Max Fuchs
<p>i've start to do the same. I think have resolve the problem of the 2 assert in chainparams.cpp (no more error on running myaltcoind file) with this script ( <a href="https://bitcoin.stackexchange.com/questions/71024/altcoin-genesis-block-fails-after-changing-block-reward">Altcoin Genesis block fails after changing block reward</a>) that hash genesis:</p>

<pre><code>assert(consensus.hashGenesisBlock == uint256S("0x12a765e3...."));
assert(genesis.hashMerkleRoot == uint256S("0x97ded9....."));
</code></pre>

<p>BUT i sill have an error when launching myaltcoind file:<br>
ERROR : error : A fatal internal error occured, see debog.log for details
Segmentation fault (core dumped)</p>

<p>And the debug.log file don't give a useful problem. here's :</p>

<pre><code>2018-02-26 17:37:41 Coin4coin version v0.15.1.0-unk
2018-02-26 17:37:41 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -&gt; setting -whitelistrelay=1
2018-02-26 17:37:41 Assuming ancestors of block 59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011 have valid signatures.
2018-02-26 17:37:41 Setting nMinimumChainWork=00000000000000000000000000000000000000000000002ebcfe2dd9eff82666
2018-02-26 17:37:41 Using the 'standard' SHA256 implementation
2018-02-26 17:37:41 Default data directory /home/prof/.coin4coin
2018-02-26 17:37:41 Using data directory /home/prof/.coin4coin
2018-02-26 17:37:41 Using config file /home/prof/.coin4coin/coin4coin.conf
2018-02-26 17:37:41 Using at most 125 automatic connections (1024 file descriptors available)
2018-02-26 17:37:41 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-02-26 17:37:41 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-02-26 17:37:41 Using 0 threads for script verification
2018-02-26 17:37:41 scheduler thread start
2018-02-26 17:37:41 HTTP: creating work queue of depth 16
2018-02-26 17:37:41 No rpcpassword set - using random cookie authentication
2018-02-26 17:37:41 Generated RPC authentication cookie /home/prof/.coin4coin/.cookie
2018-02-26 17:37:41 HTTP: starting 4 worker threads
2018-02-26 17:37:41 init message: Verifying wallet(s)...
2018-02-26 17:37:41 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2018-02-26 17:37:41 Using wallet wallet.dat
2018-02-26 17:37:41 CDBEnv::Open: LogDir=/home/prof/.coin4coin/database ErrorFile=/home/prof/.coin4coin/db.log
2018-02-26 17:37:41 Cache configuration:
2018-02-26 17:37:41 * Using 2.0MiB for block index database
2018-02-26 17:37:41 * Using 8.0MiB for chain state database
2018-02-26 17:37:41 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-02-26 17:37:41 init message: Loading block index...
2018-02-26 17:37:41 Opening LevelDB in /home/prof/.coin4coin/blocks/index
2018-02-26 17:37:41 Opened LevelDB successfully
2018-02-26 17:37:41 Using obfuscation key for /home/prof/.coin4coin/blocks/index: 0000000000000000
2018-02-26 17:37:41 LoadBlockIndexDB: last block file = 0
2018-02-26 17:37:41 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2018-02-26 17:37:41 Checking all blk files are present...
2018-02-26 17:37:41 LoadBlockIndexDB: transaction index disabled
2018-02-26 17:37:41 Initializing databases...
2018-02-26 17:37:41 Pre-allocating up to position 0x1000000 in blk00000.dat
2018-02-26 17:37:41 Opening LevelDB in /home/prof/.coin4coin/chainstate
2018-02-26 17:37:41 Opened LevelDB successfully
2018-02-26 17:37:41 Using obfuscation key for /home/prof/.coin4coin/chainstate: 5ede9e4227910002
2018-02-26 17:37:41 init message: Rewinding blocks...
2018-02-26 17:37:41  block index              92ms
2018-02-26 17:37:41 init message: Loading wallet...
2018-02-26 17:37:41 nFileVersion = 150100
2018-02-26 17:37:41 Keys: 2002 plaintext, 0 encrypted, 2002 w/ metadata, 2002 total
2018-02-26 17:37:42  wallet                   55ms
2018-02-26 17:37:42 setKeyPool.size() = 2000
2018-02-26 17:37:42 mapWallet.size() = 0
2018-02-26 17:37:42 mapAddressBook.size() = 1
2018-02-26 17:37:42 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2018-02-26 17:37:42 *** Failed to read block
2018-02-26 17:37:42 Error: Error: A fatal internal error occurred, see debug.log for details 
</code></pre>

<p>Can i have some help please ?</p>

CC BY-SA 3.0
2018-02-27T08:15:04.470Z
Hello cointest, and welcome to bitcoin.SE! Your reply in this answer section is a "me too" comment, which is generally not well appreciated.This section should contain an answer, which helps to answer the original post. If you want to raise (as) a different question, you can ask it by clicking "Ask Question", and put a link to this question in it.
pebwindkraft
CC BY-SA 3.0
2018-02-26T17:45:45.610Z
2018-02-27T08:13:45.880Z
2018-02-27T08:13:45.880Z
cointest
<p>So if one was to try to create an altcoin that was a fork of the bitcoin code would he/she have to create a genesis block independently first? </p>

<pre><code>static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount&amp; genesisReward)
{
    const char* pszTimestamp = "anything you want";
    const CScript genesisOutputScript = CScript() &lt;&lt; ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") &lt;&lt; OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}
</code></pre>

<p>Is changing the variable for <code>pszTimestamp</code> in the above function from <code>chainparams.cpp</code> sufficient? </p>

<p>If that's all that's necessary, then what is the purpose of this "<a href="https://pastebin.com/nhuuV7y9" rel="nofollow noreferrer">gensis block generation script</a>"*? </p>

<p>*From <a href="https://bitcointalk.org/index.php?topic=181981.0" rel="nofollow noreferrer">this question</a>.</p>

<altcoin><genesis-block>
do you need to independently create a genesis block for a new altcoin?
smatthewenglish
# do you need to independently create a genesis block for a new altcoin?

(Asked by: username_0 on 2017-05-06)

So if one was to try to create an altcoin that was a fork of the bitcoin code would he/she have to create a genesis block independently first?

```
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    const char* pszTimestamp = "anything you want";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

```

Is changing the variable for `pszTimestamp` in the above function from `chainparams.cpp` sufficient?

If that's all that's necessary, then what is the purpose of this "[gensis block generation script](https://pastebin.com/nhuuV7y9)"\*?

\*From [this question](https://bitcointalk.org/index.php?topic=181981.0).

**Tags:** altcoin, genesis-block


---

## 3 answers

### Answer by username_1 on 2017-05-07. Score: 1 | Accepted answer

In old versions of the Bitcoin Core codebase, the genesis block was verified as a normal block. All normal rules had to apply to it, including proof of work and difficulty. This meant that if you would modify the contents of the genesis block arbitrarily, it almost certainly would not validate anymore.

Since the genesis block is actually part of the definition of the chain, there is no real need to verify it. In more recent versions, the genesis block is just valid by fiat. This means that when using such a codebase, no complicated script that "mines" the genesis block is needed anymore to define a new chain.

> **Comments:**
> **username_0**: so in the past I would have had to create a genesis block from a script but now I can just define the `pszTimestamp` from `chainparams.cpp` and it will get it up and running just like that?  

---

### Answer by username_2 on 2017-05-18. Score: 1

did u managed to start a new chain? I also try the same but i modiefied a lot iin chainparams.cpp already without success and i also created genesis block extern with a python script but the main code doesnt accept it (assertion failed) so looks like i m missing something hidden in the code ;)
set checkpoints to o uint256= "0x" is right no?
cheers

> **Comments:**
> **username_0**: not sure man- but I'm totally interested to put our heads together to figure it out- I got a bit farther than this- in some of the related questions- a good place to start if by `diff`ing Litecoin and Dogecoin and looking at what they changed- here's what I've got so far https://github.com/stratton-oakcoin feel free to make a pull request or get at me on Twitter or something if you want to talk.  

---

### Answer by username_3 on 2018-02-26. Score: 0

i've start to do the same. I think have resolve the problem of the 2 assert in chainparams.cpp (no more error on running myaltcoind file) with this script ( [Altcoin Genesis block fails after changing block reward](https://bitcoin.stackexchange.com/questions/71024/altcoin-genesis-block-fails-after-changing-block-reward)) that hash genesis:

```
assert(consensus.hashGenesisBlock == uint256S("0x12a765e3...."));
assert(genesis.hashMerkleRoot == uint256S("0x97ded9....."));

```

BUT i sill have an error when launching myaltcoind file:  
ERROR : error : A fatal internal error occured, see debog.log for details
Segmentation fault (core dumped)

And the debug.log file don't give a useful problem. here's :

```
2018-02-26 17:37:41 Coin4coin version v0.15.1.0-unk
2018-02-26 17:37:41 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-02-26 17:37:41 Assuming ancestors of block 59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011 have valid signatures.
2018-02-26 17:37:41 Setting nMinimumChainWork=00000000000000000000000000000000000000000000002ebcfe2dd9eff82666
2018-02-26 17:37:41 Using the 'standard' SHA256 implementation
2018-02-26 17:37:41 Default data directory /home/prof/.coin4coin
2018-02-26 17:37:41 Using data directory /home/prof/.coin4coin
2018-02-26 17:37:41 Using config file /home/prof/.coin4coin/coin4coin.conf
2018-02-26 17:37:41 Using at most 125 automatic connections (1024 file descriptors available)
2018-02-26 17:37:41 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-02-26 17:37:41 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-02-26 17:37:41 Using 0 threads for script verification
2018-02-26 17:37:41 scheduler thread start
2018-02-26 17:37:41 HTTP: creating work queue of depth 16
2018-02-26 17:37:41 No rpcpassword set - using random cookie authentication
2018-02-26 17:37:41 Generated RPC authentication cookie /home/prof/.coin4coin/.cookie
2018-02-26 17:37:41 HTTP: starting 4 worker threads
2018-02-26 17:37:41 init message: Verifying wallet(s)...
2018-02-26 17:37:41 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2018-02-26 17:37:41 Using wallet wallet.dat
2018-02-26 17:37:41 CDBEnv::Open: LogDir=/home/prof/.coin4coin/database ErrorFile=/home/prof/.coin4coin/db.log
2018-02-26 17:37:41 Cache configuration:
2018-02-26 17:37:41 * Using 2.0MiB for block index database
2018-02-26 17:37:41 * Using 8.0MiB for chain state database
2018-02-26 17:37:41 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-02-26 17:37:41 init message: Loading block index...
2018-02-26 17:37:41 Opening LevelDB in /home/prof/.coin4coin/blocks/index
2018-02-26 17:37:41 Opened LevelDB successfully
2018-02-26 17:37:41 Using obfuscation key for /home/prof/.coin4coin/blocks/index: 0000000000000000
2018-02-26 17:37:41 LoadBlockIndexDB: last block file = 0
2018-02-26 17:37:41 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2018-02-26 17:37:41 Checking all blk files are present...
2018-02-26 17:37:41 LoadBlockIndexDB: transaction index disabled
2018-02-26 17:37:41 Initializing databases...
2018-02-26 17:37:41 Pre-allocating up to position 0x1000000 in blk00000.dat
2018-02-26 17:37:41 Opening LevelDB in /home/prof/.coin4coin/chainstate
2018-02-26 17:37:41 Opened LevelDB successfully
2018-02-26 17:37:41 Using obfuscation key for /home/prof/.coin4coin/chainstate: 5ede9e4227910002
2018-02-26 17:37:41 init message: Rewinding blocks...
2018-02-26 17:37:41  block index              92ms
2018-02-26 17:37:41 init message: Loading wallet...
2018-02-26 17:37:41 nFileVersion = 150100
2018-02-26 17:37:41 Keys: 2002 plaintext, 0 encrypted, 2002 w/ metadata, 2002 total
2018-02-26 17:37:42  wallet                   55ms
2018-02-26 17:37:42 setKeyPool.size() = 2000
2018-02-26 17:37:42 mapWallet.size() = 0
2018-02-26 17:37:42 mapAddressBook.size() = 1
2018-02-26 17:37:42 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2018-02-26 17:37:42 *** Failed to read block
2018-02-26 17:37:42 Error: Error: A fatal internal error occurred, see debug.log for details 

```

Can i have some help please ?

> **Comments:**
> **username_4**: Hello username_3, and welcome to bitcoin.SE! Your reply in this answer section is a "me too" comment, which is generally not well appreciated.This section should contain an answer, which helps to answer the original post. If you want to raise (as) a different question, you can ask it by clicking "Ask Question", and put a link to this question in it.  

---

