Dumping Bitcoin forks: Bitcore

If the ways I dumped Bitcoin Cash, Gold, Diamond and Super were too boring for you (they were, indeed), this time we’ll get our hands a bit more dirty. If you follow this story, you will become richer. That is, richer with knowledge, because there is not much to be made off dumping Bitcore (BTX).

As usual, go read the Safety notice in my initial post in this series, if you haven’t done so yet.

Origins

Bitcore is one of the many forks created after the road was paved by BCH and others, so I will not even pretend to know or care for the motivation of the team.

I have to, however, give credit to the creators for doing one thing differently and actually reasonably. What they did is, they compressed the blockchain at the fork time. Basically they discarded all the history and only kept the unspent transaction outputs (UTXOs) at the time of the fork. This step required at least some effort on their side, unlike the other 1:1 forks which just copied Bitcoin Core and changed few parameters. The result of this step is that the whole chain is just few hundred megabytes. This fact encouraged me to try a completely different method to claim BTX.

The fork took place at height 492820 on November 2nd, 2017. It was 2:1 fork, so for 1 BTC you get 0.5 BTX.

Claiming

Trezor or Ledger support does not exist and even Walleting Services do not offer claiming BTX, so we have to use a different method. We’ll use the official wallet software and import our private keys. The method I will be describing here, can actually be used probably for most forks, since most of them are more or less close copies of Bitcoin Core.

Step 1: Install and sync the wallet

I did this in a dedicated Ubuntu virtual machine and I recommend you do the same. Go to Bitcore Github and download the code for Linux wallet. Put it somewhere on the virtual machine and make sure you have all the dependencies mentioned here. Change to the directory you put it into. When you start the wallet by running

$ ./bitcore-qt &

it should start syncing. Don’t worry, the blockchain is less than 1 GB so the process may take maybe one hour or so, but definitely not several days as is the case with Bitcoin or other 1:1 forks.

In the meantime, when the chain is downloading, we can prepare our keys for import.

Step 2: Extract private keys

As I mentioned few times, I have my Bitcoin in Trezor, in Segwit addresses. Trezor uses BIP49 seed. If you use other wallet with seed, like Electrum or Mycelium, the method to extract the keys is more or less the same, just find out what type of seed you have.

The official Bitcore wallet does not support importing the seed directly, so we have to use the seed and perform the keys derivation. Fortunately, a tool exists just for this purpose. It does the same thing your wallet does, when it generates private keys and corresponding addresses from the seed. Download the bip39-standalone.html file to the virtual machine and open it in the browser locally.

Make sure all your coins from the wallet using this seed are moved and paste the seed into the page. Select the proper derivation path according to your seed type (in my case it was BIP49). Check your original wallet to see approximately how many addresses you used and display at least as many addresses in the tool. Save the generated CSV file on the virtual machine. Then change the “External/Internal” field from 0 to 1 to generate the addresses and keys for change addresses, as they usually also contain some coins. Put these addresses in the file too.

If you had multiple accounts in the wallet, repeat the above for all of them by changing the Account number. When are you finished, you should have list of addresses together with their keys, which looks something like this:

path,address,public key,private key
m/49'/0'/0'/0/0,3G7BkezwZ3ab7nj6gD4ruFxfqdGVvXKraX,02146b1edb8b1d1f391500232ec9390e9ab57de283f4b6c570e4f2846332599c9d,L5STX9yStBe7aoxWWpaMW2y7vcLyowtNgLRn3UyKisN9Crt4b3Rn
m/49'/0'/0'/0/1,3JxTnMuSaWg91x2x4radQUGyU5mxPaDgQv,027633e319683645e86dab767dd345cbb4a3f2ef4173231eb6632308fb95a099f8,KwqE8Hpk3cTod8MgPQruexRBtGchtt8A1nQStuHo7tSxXxyt2yia
m/49'/0'/0'/0/2,3GXky1tY6t5TRp5EemVhTpBga1iEbE1otf,037692b6b0746dbdfca248334b820b74cb7527ed592ca0b650e8a43c054e6ed186,L4nw1ZhpJr72L9R7ZumzRyLfTk2sdSDP37vh7MxiwG6NYqKuH6Di
...

Let me save you some time. The list above is generated from random seed and does not contain any coins, so no need to check.

Keep this list somewhere safe, it will be useful for claiming others forks as well.

Step 3: Import private keys

So now we have the private keys, we can import them into Bitcore client. If you are familiar with Bitcoin Core, you know what to do. If not, let me briefly explain. You can either do it in the console in the GUI, just go to Help / Debug / Console. Or enable the commandline client bitcore-cli which is an equivalent of bitcoin-cli . In order to make it work, you need to enable the RPC server by putting following into ~/.bitcore/bitcore.conf :

rpcuser=rpc
rpcpassword=bitcorerulez
server=1

Restart bitcore-qt and then this should work:

$ ./bitcore-cli getbalance
0.00000000

Now we are finally ready to import. For each of the private keys, we have to call the importprivkey function, either in the debug console or thru thi CLI. I’ll give an example using the CLI, where we will import one key and skip the rescan. The rescan is lengthy operation, so if you have more keys to import, we will do it only once, after we import all the keys.

$ ./bitcore-cli importprivkey \ 
> L5STX9yStBe7aoxWWpaMW2y7vcLyowtNgLRn3UyKisN9Crt4b3Rn "" false

If you have many keys, it’s best to script it, obviously, which I will leave as an exercise to you.

After all the keys are imported, we need to restart the client and scan the blockchain for balances.

$ ./bitcore-qt -rescan &

After the client performs the rescan, which takes a minute or two, you should see your balance in the wallet, divided by two.

But I didn’t. Damn. Now what? Well, after a bit of digging, I realized where the problem was. Bitcore is a fork of Bitcoin Core. At version 0.15, Core does not have full Segwit support yet and I had my balance in Segwit addresses (starting with 3). I was beginning to lose hope, but did a some googling and saw that I was not alone. Didn’t everyone keep reassuring that Segwit was backwards compatible? Sure is. We just have to perform one more step.

Step 4: Adding witness addresses

You see, when you import a private key, the wallet does not know it’s a Segwit key, so it generates standard addresses starting with 1. This can be observed when you dump the wallet:

$ ./bitcore-cli dumpwallet dump.txt
$ grep L5STX9yStBe7aoxWWpaMW2y7vcLyowtNgLRn3UyKisN9Crt4b3Rn dump.txt
L5STX9yStBe7aoxWWpaMW2y7vcLyowtNgLRn3UyKisN9Crt4b3Rn 1970-01-01T00:00:01Z label= # addr=1Jafbpop79gfDPyzBfojkNhsBXfPrVedBv

As you can see, the address is in the old format. So now we have to add a witness address:

$ ./bitcore-cli addwitnessaddress 1Jafbpop79gfDPyzBfojkNhsBXfPrVedBv
MNKL4YQuWAS1vHzzn64CiuD5AKrwwnR6CW

If you perform the rescan one more time, hopefully you already should see the correct balance. It worked for me. Again, you probably will want to script this, so you do not have to do this manually for all your addresses.

After that, you can simply transfer the coins to an exchange of your choice to finally dump it.

Dumping

By exchange of your choice I mean HitBTC.com, because that is probably the only semi-legit exchange that trades this shitcoin, at least at this moment.The other choices are Qbtc.com and Cryptopia.co.nz. The trade volumes are not great, so you might have to wait a bit to get a buyer.

Final verdict

After all the hard work described here I was rewarded 0.14% value of BTC. But I do not regret it. I’ve learned how to derive private keys from the seed, how to import the private keys into Bitcoin wallet, how witness addresses work in the official client, got to code the automation scripts and ended up with more Bitcoin than I started with.

I call it it a win. Your mileage may vary.