Altcoin
山寨幣分叉教程
有沒有創建山寨幣分叉的教程?我只找到了非常舊版本的教程,以及目前版本的任何教程。
我根據這篇文章創建了一個山寨幣。<https://medium.com/@jordan.baczuk/how-to-fork-bitcoin-c39139506443>
文章提到了 13 個步驟,但我只更改了消息前綴。
$ git branch * v0.17.1 $ git diff +++ b/src/chainparams.cpp + pchMessageStart[0] = 0xf1; + pchMessageStart[1] = 0xb2; + pchMessageStart[2] = 0xb3; + pchMessageStart[3] = 0xd4;
我啟動了 3 個程序;兩個分叉的比特幣和一個原始的比特幣。forkA 嘗試連接到 original 和 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
如您所見,forkA 正在連接到 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", ... } ]
你可以看到原來的 bitcoind 拒絕從 forkA 連接。(無效的消息開始)
# 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
在 forkA 上生成的塊僅傳播到 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,
這是我用來創建自己的山寨幣的教程:https ://www.hackster.io/pjdecarlo/how-to-make-a-cryptocurrency-using-litecoin-v0-15-source-fb5e82