Menu Close

How to make crypto currency BlockExplorer

This time I will make a tutorial about how to make cryptocurrency BlockExplorer. For example, we will make a DamaCoin (DMC) BlockExplorer, in a Debian 8 64bit server, that run
Install the required packages

apt-get update && apt-get upgrade
apt-get install git nano python-crypto python-mysqldb -y
apt-get install -y build-essential autoconf libssl-dev libboost-dev libboost-chrono-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-test-dev libboost-thread-dev checkinstall subversion git-core

Create a Database to store the blockchain data

mysql -u root -p
> create database dbName;
> grant usage on *.* to dbUser@localhost identified by 'dbPassword';
> grant all privileges on dbName.* to dbUser@localhost;
> flush privileges;
> exit;

Clone the bitcoin-abe, that will run as our BlockExplorer

git clone
cd bitcoin-abe-bootstrap
python install

Clone DamaCoin, as we needed to run it to get the blockchain, and to see the address_version and the magic key

git clone
cd DaMaCoin/src
make -f makefile.unix

Now we have our DamaCoin running and synchronizing with the network, and so we had our blockchain.
By default, bitcoin-abe will failed if the blockfiles not stored at block directory. So if the blockfile is stored at /home/.kuwaitcoin/blk0001.dat, we need to make a modification to the, and it only can run for the coin that store the blockfiles outside of the block directory.
Configuring the bitcoin-abe/abe.conf

address-history-rows-max 100000
default-loader = blkfile
dbtype MySQLdb
connect-args {"user":"dbUser","db":"dbName","passwd":"dbPassword"}
port 25000
datadir += [{
        "dirname": "/home/.damacoin",
        "chain":   "DamaCoin",
        "code3":   "DMC",
        "address_version": "1e" }]

To get the address_version, please open the DaMaCoin/src/base58.h, and find the line with PUBKEY_ADDRESS, next we will see the number DEC 30, so we convert it to HEX 1E

Configuring the bitcoin-abe/Abe/

# Find and edit the line as you need
     "code3":"DMC", "address_version":"\x1e", "magic":"\xfa\xbf\xb5\xda"},

We use the same address_version as the abe.conf. And to get the “magic”, please open DaMaCoin/src/main.cpp, and find the char pchMessageStart. We will see 0xfb, 0xc0, 0xb6, 0xdb.Substract one digit, so we have 0xfa,0xbf,xb5,xda

Begin parsing the blockchain to the database
The following process could take about one or three hours, or even one day, depends on the server/internet connection/blockchain size. Please wait until it finished, or you can use screen command

python -m Abe.abe --config abe.conf --commit-bytes 100000 --no-serve

Running the python internal webserver using our abe.conf.

python -m Abe.abe --config abe.conf

If we have no error, we can open our BlockExplorer from the http://ip.address.of.server:25000
Some crypto currency might use a character that not supported by latin_1 in the database, so we need to make some tweaks on bitcoin-abe/Abe/

# Find and edit the line :
# addr_vers = addr_vers.encode('latin_1')
addr_vers = addr_vers.encode('utf8')
# script_addr_vers = script_addr_vers.encode('latin_1')
script_addr_vers = script_addr_vers.encode('utf8')

After doing some tweaks in the bitcoin-abe/Abe/, we have to change our database tables on “chain” and “datadir” colation to utf8_general_ci
If we prefer to run the BlockExplorer using the supervisord, we can use this example for the config :

command = python -m Abe.abe --config abe.conf
directory = /root/BlockExplorer
user = root
autostart = true
autorestart = true

To start the program, run the supervisord with : supervisorctl start explorer
Now, we can have our own BlockExplorer for many crypto currency. As this article written, I run multi explorer at
If you find this tutorial helpfull, please make a donation to BTC:18LxEvBNdR81P7AL7YVdisrW9xpiEwrb6A

Leave a Reply

Your email address will not be published. Required fields are marked *