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

  • 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
    Dec 2 '17 at 22:27
  • 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. Dec 2 '17 at 22:36
  • Which altcoin are you trying to fork?
    – Monstrum
    Dec 2 '17 at 23:18
  • The Bitcoin one. Dec 3 '17 at 7:25
  • Am I doing the right steps? Dec 3 '17 at 7:28

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": "",
    "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 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,

Here is a tutorial I have used to create my own altcoin: https://www.hackster.io/pjdecarlo/how-to-make-a-cryptocurrency-using-litecoin-v0-15-source-fb5e82

  • 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
    Feb 1 '19 at 20:32

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.