Running a Cardano Node with Docker

Mark Mathis
Coinmonks
4 min readSep 17, 2018

--

Cardano is a cryptocurrency and smart contract platform that is in my opinion one of the most understated projects in the space. The uber-academic team at cardano keep their heads down and create quality software. Unfortunately, figuring out how to use it is an exercise in trial and error as there is little documentation or developer community around it compared to Ethereum or EOS. I did a couple articles earlier this year on the Cardano testnets and the CLI tool, Mallet.

Cardano Smart Contracts 101 — Testnets

Cardano 101 — Your First Contract

Unfortunately, when I began my research into connecting with the Cardano mainnet, I found that Mallet was just for the upcoming kevm and iele testnets. I had to figure out how to connect to the mainnet and send custom RPC calls to the cardano node via a custom Node.js client.

Requirements

  • Ubuntu — OSX did not work for me ;(
  • Git
  • Docker

Fat Wallet

I found that I could download and install the Daedalus wallet application and connect to the mainnet rather easily. The wallet runs a cardano-sl node in the background that is accessible via a RESTful interface. This may be a good idea to install and play around with locally before blindly installing a docker image on a remote server.

Daedalus Wallet - Windows/OSX Version

Once you have the Wallet downloaded and synced, go ahead and add a wallet via the GUI. You will need to write down the mnemonic and add a password if you want.

Postman

I would suggest that you download the Postman application here and import the following swagger definition here. In order for your postman queries to work locally with your Daedalus wallet, you will need to turn off ssl certificate validation as the wallet uses a self-signed certificate.

Play around with with the postman collection provided by cardano and you will get an idea of the wallet => account => address relationship and other subtle aspects of the model.

Docker

Options
You can build the image or use a prebuilt image. Both options are presented below, but you will need to create the data dir.

Create Data Dir

Building Image

Updating an Image

Use Existing Image

Run Built/Pulled Image

Verify

Maintenance

Creating a Wallet

Once you have verified the node is running, we need to create a wallet on it. Run the following command to create your wallet on your node and edit the parameters as you wish.

Now that you have created a wallet, let’s list the wallets for our node. Find and write down the id param for the wallet from this response.

Now we need to get the accountIndex for the wallet id. Execute the following curl with the substitution of the id param. You will find an array of accounts from the response below. Write down the accountIndex param.

We have created a wallet and noted the wallet id and the default wallet accountIndex. We will need these in order to interact with our wallet to do things like generate an address and send a transaction.

Note that you may want to transfer some ADA to this account. You will see an array of addresses from the previous

Summary

You can download the project here if you like. I hope that this helped you out and I look forward to being able to use the Mallet CLI in the near future!

My repo was forked from [here](https://github.com/TheDevKnight/cardano-sl-wallet) and thanks to @TheDevKnight for his help in getting me up and going. I also borrowed config content from [here](https://github.com/EmurgoVN/cardano_docker).

Get Best Software Deals Directly In Your Inbox

--

--