This will probably sound stupid but what would happen if you create an entirely new Bitcoin block chain and run it on the same computer. How does a node know which version of the Bitcoin block chain to talk to? Does each block chain have a unique identifier?


Bitcoin is programmed to accept the most proof-of-work chain, which is many times also the longest chain. Every new block added to the blockchain references the previous block with its hash. Based on your question, there are a number of cases that I have come up with and how your new 'forked' blockchain will react.

  • You run the same software that Bitcoin is currently working on: your software will automatically accept blocks from other peers and add it to the genesis block. This will bring you to the current Bitcoin blockchain
  • You change the genesis block, but use the same DNS seeding: when the peers will send you new blocks, the previous block hash reference in block 1 will not match your new genesis block header hash and hence that block cannot be added. This you have now generated a completely new chain.
  • You fork the blockchain but change rules at certain point: This is how Bitcoin Cash was created. From a particular block height they increased the block size to more than 1MB, which resulted in the original Bitcoin nodes rejecting the newly generated blocks. So you now have a different chain from a particular height.

The first 4 bytes of every message sent over the bitcoin network protocol contain a "magic number," which identifies it as Bitcoin or some other chain. Bitcoin's magic number for mainnet is 0xD9B4BEF9. Anyone forking the code to implement a different chain should use a new magic number to distinguish it from Bitcoin.

You could technically have multiple chains with the same piece of software if they handle messages based on the magic number, but it's more likely that you would run them as independent pieces of software, in which case, you will use a different listening port for the software to receive incoming connections. (TCP does not allow multiple software to listen on the same port by regular means). Each blockchain would know which port to connect to on your machine because it would've been advertised via gossip or DNS.

Not the answer you're looking for? Browse other questions tagged or ask your own question.