Forking Bitcoin Wallet for a New Coin

under construction.

Step 2:  Forking GitHub Repositories

There are two parts to the android wallet of a coin.  The first part is the base library that handles the coin blockchain, peers and transactions.  This part will be forked from bitcoinj (the Java implimentation of the Bitcoin protocol).  The second part is the user interface, which is forked from Andreas Schildbach’s bitcoin-wallet.  These two repo’s are stored here:

https://github.com/schildbach/bitcoin-wallet (uses bitcoinj 0.11)

Hash Engineering has forked these repos and modified them to make it easier to adapt their code for another coin.  The digitalcoin repos on our GitHub account are our forks:

https://github.com/HashEngineering/digitalcoin-wallet

The main difference between the Hash Engineering fork and the original repo is that we added a class in the com.google.bitcoin.core package called CoinDefinition which stores all the key coin parameters.  In the digitalcoin-wallet, there are many references to CoinDefinition that replace hard coded strings and coin related parameters.  To clone the HashEngineering repo, do the following in the command prompt (after installing git) in the directory of your choice.

git clone https://github.com/HashEngineering/digitalcoin-wallet my_coin-wallet

or to clone the bitcoin repos:

git clone https://github.com/schildbach/bitcoin-wallet my_coin-wallet

Alternatively, you can fork this repos in your GitHub account using the “Fork this repo” button. Your account only allows 1 fork using this method per repo.  If you want to fork the same repo several times to handle many coin wallets, you will need to do the above method.  Once the two repos are forked, they can be renamed.  Then you will need to clone them locally.

git clone https://github.com/<my_account>/my_coin-wallet

Next, you should make sure that the origin remote on both repos are set to your github account and that the upstream remote is set to the repos that they were cloned from.  This allows pulling changes from our repos or the bitcoin repos that may include bug fixes or new features.  The following command will allow you to check your remotes:

git remote -v

To set the upstream remote, use this command in your my_coinj repo:

git remote add upstream https://github.com/HashEngineering/digitalcoinj

Step 3 Modifying pom.xml and AndroidManifest.xml

These files need to be changed to rename the Java and Android packages.  It is not necessary to rename every occurrence of bitcoin to my_coin.