Written by KomoDeFi Editorial Team on August 6, 2020

Blockchain Dev Kit v1, Electrumx & DEX in 1 hour

This howto is for using a blockchain dev kit using Komodo, electrumx & atomicDEX. Using 3 existing containers and small mods, you can have HELLOWORLD trading with your team in less than one hour. Improvements to this to totally automate it are in the works to make a turnkey blockchain dev kit.

Our smart chain created and ready to trade on atomicDEX after using the blockchain dev kit
The HELLOWORLD smart chain ready to trade for some MORTY test coins on the atomicDEX network. Why not for BTC or alts!

End To End Blockchain Development Using The Dev Kit

If you are on linux simply download and run the following commmands. It will download 1GB of cryptography stuff.

wget https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params.sh
chmod +x fetch-params.sh

Download the containers for this particular tutorial. You will need zcash params installed on your machine.

  1. docker pull coingateways/blockchain-starter-kit:5000f2a.3
  2. docker pull coingateways/atomicdexorderbook:0.9.2
  3. docker pull lukechilds/electrumx:v1.15.0

Blockchain Dev Kit

I made a video on the blockchain dev kit in 2019. The current simplified version is similar. Watch from the 2:50 mark for what it does.

Video of the blockchain dev kit in action
Video from 2019 of the blockchain dev kit during testing

To start this container, after having the zcash-params installed type:

docker run -i -t -v /home/${USER}/.zcash-params:/root/.zcash-params:ro --name bdk -p coingateways/blockchain-starter-kit:5000f2a.3

It will drop you into a bash, and you will want to change to the /komodo-in-a-box directory to execute setup/start.sh

cd /komodo-in-a-box ; setup/start.sh

  • Follow the prompts to create a new BSK_1HOST (blockchain dev kit single host). This will create a seed node and mining node.
  • Hit enter a few times. Don't change the defaults for now, HELLOWORLD & 1000 coins. These numbers are used at start up to determine the RPC port. Which the electrumx uses for lite wallet support in the DEX.
  • Edit the seed node config file.
    • The seed node is probably created. Great. Go back into the menu and select to SHUTDOWN seed node.
    • Edit ~/.komodo/HELLOWORLD/HELLOWORLD.conf and remove the line bindrpc= and add rpcallowip for the IP addresses of the other containers that will start. By default, docker uses 172.17.0.X network with the .1 as the gateway.

cat ~/.komodo/HELLOWORLD/HELLOWORLD.conf  

You will need the rpcuser & rpcpassword for the electrumx container!

Start the bdk console again with the command above cd /komodo-in-a-box ; setup/start.sh. And follow the prompts to create a mining node, but don't start mining yet. Let's get the rest of it setup.

Lite Wallet Coin Infrastructure With ElectrumX

This docker container comes from Luke Childs who used to be an Komodo notary node operator and the hyperDEX lead dev. We want to connect electrumx to the seed node. We need to know the IP address of the BDK (blockchain dev kit) container. From your workstation, issue docker inspect bdk | grep -i ipaddress

docker inspect bdk | grep -i ipaddress
           "SecondaryIPAddresses": null,
           "IPAddress": "",
                   "IPAddress": "",

I have other containers, running so my BDK for this writing is at I'm using this address to start electrumx with this command. I'm also using the rpcuser & rpcpassword and rpcport from my HELLOWORLD.conf file above.

docker run -e DAEMON_URL=http://user4130001545:pass26cc5f967a6c9e7c7dd35675429b5f6257f5b7f1a87a7f762bd4fba3553401075e@ -e COIN=Komodo -p 50002:50002 -p 50001:50001 -p 8008:8000 --name electrumx lukechilds/electrumx
Generating a RSA private key
writing new private key to '/data/electrumx.key'
INFO:electrumx:ElectrumX server starting
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.7.7 (default, May 20 2020, 21:33:25)  [GCC 9.2.0]
INFO:Controller:software version: ElectrumX 1.15.0
INFO:Controller:aiorpcX version: 0.18.4
INFO:Controller:supported protocol versions: 1.4-1.4.2
INFO:Controller:event loop policy: None
INFO:Controller:reorg limit is 800 blocks
INFO:Daemon:daemon #1 at (current)
INFO:DB:switching current directory to /data
INFO:DB:using leveldb for DB backend
INFO:DB:created new database
INFO:DB:creating metadata directory
INFO:DB:UTXO DB version: 8
INFO:DB:coin: Komodo
INFO:DB:network: mainnet

Great! Electrum is up.

AtomicDEX Lite Wallet & P2P Orderbook Trading

The orderbook app for atomicDEX already has a tutorial, but we need to add our HELLOWORLD coin, this requires one command in reality, but for this tutorial let's kill everything the container starts. First we need to know some info.

  1. The IP address of our lite wallet infrastructure so the atomicDEX wallet can connect needs to be known
  2. Tell marketmaker to use HELLOWORLD infrastructure

Again turning to our workstation, we need to issue the same docker inspect command but for the electrumx container.

docker inspect electrumx | grep -i ipaddress
           "SecondaryIPAddresses": null,
           "IPAddress": "",
                   "IPAddress": "",

The orderbook container needs starting and it will automatically start everything, we just need to enable HELLOWORLD with curl.

docker run -i -t -p -p -e MMBOT_URL="http://localhost:7780" -e ME_PUBLIC="false" -e ME_PRIVATE="true" --name orderbook coingateways/atomicdexorderbook:0.9.2

Let's enable HELLOWORLD!

source /usr/local/bin/userpass.txt ; curl --url "" --data "{\"userpass\":\"$userpass\",\"method\":\"electrum\",\"coin\":\"HELLOWORLD\",\"servers\":[{\"url\":\"\"}], \"mm2\": 1}"

Send coins from mining node to browser wallet

Jump back into the container running the blockchain dev kit at the start. You will need to go to the mining node and start mining. Follow the menus for HELLOWORLD mining node. Spin one up, start mining. Go into the wallet menu and import the dev wallet. You will have 1000 coins to send to your lite wallet in the orderbook app.

Back to Top
Experience Web3
© 2024 komodefi.com