Altcoin fork tutorial

-1

Is there any tutorial for altcoin fork creation? I've found only tutorials for the very old versions, and any for the current ones.

user8519841

Posted 2017-12-01T18:34:49.210

Reputation: 7

You usually have to have knowledge of the programming language used to make various changes. The merkle-root, genesis block hash, and other coin info would need to be changed for the coin to operate as expected.Monstrum 2017-12-02T22:27:29.810

Will it work if i'm trying to generate a new genesis block? I've set a new timestamp, and all other values (including asserts) to 0x0. I've set to 0x0 the following variables: genesisOutputScript, BIP34Hash, defaultAssumeValid Removed the seeds and asserts, and I've set a new timestamp (unix and the text one). After that I've run make and got the result below.user8519841 2017-12-02T22:36:03.543

Which altcoin are you trying to fork?Monstrum 2017-12-02T23:18:08.603

The Bitcoin one.user8519841 2017-12-03T07:25:57.973

Am I doing the right steps?user8519841 2017-12-03T07:28:54.493

Hi, have you read this post? seems nice. https://bitcointalk.org/index.php?topic=3345808.0

zono 2019-01-31T13:15:23.903

Answers

0

Leo Cornelius

Posted 2017-12-01T18:34:49.210

Reputation: 11

Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.

Andrew Chow 2019-02-01T20:32:31.733

0

I created an Altcoin based on this article. https://medium.com/@jordan.baczuk/how-to-fork-bitcoin-c39139506443

The article mentions 13 steps but I changed only the message prefix.

$ git branch
* v0.17.1

$ git diff
+++ b/src/chainparams.cpp
+        pchMessageStart[0] = 0xf1;
+        pchMessageStart[1] = 0xb2;
+        pchMessageStart[2] = 0xb3;
+        pchMessageStart[3] = 0xd4;

I started 3 processes; two forked bitcoind and one original bitcoind. forkA tries to connect to both original and forkB bitcoind.

# forkA
/home/zono/bitcoinA/src/bitcoind -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -datadir=$HOME/regtest/A/ -connect=localhost:17592 -connect=localhost:17593 -regtest -pid=$HOME/regtest/A/.pid -daemon -debug -listenonion=0

# original
/home/zono/bitcoinB/src/bitcoind -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16592 -datadir=$HOME/regtest/B/ -regtest -pid=$HOME/regtest/B/.pid -daemon -debug -listenonion=0

# forkB
/home/zono/bitcoinC/src/bitcoind -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16593 -datadir=$HOME/regtest/C/ -regtest -pid=$HOME/regtest/C/.pid -daemon -debug -listenonion=0

As you can see, forkA is connecting to forkB (port=17593)

$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -regtest getpeerinfo
[
  {
    "id": 2,
    "addr": "localhost:17593",
    "addrbind": "127.0.0.1:37256",
    "services": "000000000000040d",
  ...
  }
]

You can see that original bitcoind refused to connect from forkA. (INVALID MESSAGESTART)

# forkA
2019-02-14T14:52:33Z trying connection localhost:17592 lastseen=0.0hrs
2019-02-14T14:52:33Z Added connection peer=2685
2019-02-14T14:52:33Z sending version (102 bytes) peer=2685
2019-02-14T14:52:33Z send version message: version 70015, blocks=0, us=[::]:0, peer=2685
2019-02-14T14:52:33Z socket closed
2019-02-14T14:52:33Z disconnecting peer=2685
2019-02-14T14:52:33Z Cleared nodestate for peer=2685

# original
2019-02-14T14:52:33Z Added connection peer=2684
2019-02-14T14:52:33Z connection from 127.0.0.1:54808 accepted
2019-02-14T14:52:33Z PROCESSMESSAGE: INVALID MESSAGESTART version peer=2684
2019-02-14T14:52:33Z disconnecting peer=2684
2019-02-14T14:52:33Z Cleared nodestate for peer=2684

A generated block on forkA is propagated to only forkB.

# generate 1 block on forkA
./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -regtest generate 1

# forkA. current block = 1
$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -regtest getblockchaininfo
{
  "chain": "regtest",
  "blocks": 1,

# original. current block = 0
$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16592 -regtest getblockchaininfo
{
  "chain": "regtest",
  "blocks": 0,

# forkB. current block = 1
$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16593 -regtest getblockchaininfo
{
  "chain": "regtest",
  "blocks": 1,

zono

Posted 2017-12-01T18:34:49.210

Reputation: 1 569