Toms Blog

Where I talk about Bitcoin and Technology

Bitcoin Cash Migration Strategy

2017-08-01 Bitcoin

The last week has been very wild, very long days and great code being churned out. Sometimes the unit tests objected to that latter part, but all is fine again today.

After shipping Bitcoin Classic 1.3.0 and 1.3.1 with substantial changes in each, please notice the 1.3.2 release is just out.

This finalizes the features needed in the short term for migrating people from the current state to the state where there are two coins.

side note; I use “BCC”, “Bitcoin Cash”, “UAHF” all to mean the same thing in this post.

In Bitcoin Classic I added the following features;

dual network-magic

Bitcoin identifies other nodes based on a big number we call “magic”. If a node doesn’t agree on this magic number, we refuse to talk to it. The idea originally came from deadalnix, and the ABC client will soon ship this too. The idea is that if a node is on the BCC chain, it uses a different magic number for communication. That way we will make it much easier to avoid talking to nodes that are not actually following the same chain.

For now clients are flexible and accept either the old or the new magic number. In other words, they talk to anyone. In days or weeks we may have enough nodes that support this new magic number and it may be more useful to stop accepting connections from old nodes. As that saves network traffic.

In Classic I added -flexiblehandshake, which defaults to true. Set it to false and we stop accepting old nodes connecting to us.
Reversely, I added -initiatecashconnections which uses the new magic, set this to true if you want to avoid talking to old node.


When running BItcoin Classic on the BCC chain, and blocks come in, this would update the unspent transaction database (UTXO). And you would no longer be able to use that database to follow the segWit2x chain.

The obvious solution is that you need two data-directories. One for each chain. And many people do exactly that.

The problem with this is the 120GB or so of historical blocks. It would be really nice if we could avoid duplicating that.

In Bitcoin Classic I introduced an argument you can add to your config file called blocksdatadir. What that allows is you can lists one (or more) directories Classic will look for historical-blocks. (more).

Automated migration.

In Bitcoin Classic 1.3.3 (not yet released) the first time you start your UAHF (aka Bitcoin Cash) version of Classic it will automate this separation. Allowing you to install two versions of Classic and thus access two chains without issues.


The most commonly asked question is if people can run two clients at the same time on the same machine. And the answer is yes. Yes you can.

The only thing is that you need to pick one that is listening for incoming connections. Because two listening on the same port is not possible. As such, you can open your bitcoin.conf (location) file and add listen=0 on the segwit one and you will be able to start two at the same time.

Happy Bitcoining!