Blockchain And Cryptocurrency Provider

The Cardano Wallet Backend – Connecting to Bitcoin ATMs

The Cardano Wallet Backend - Connecting to Bitcoin ATMs

Table of Contents

Introduction

You can use the Cardano-wallet to send and receive payments on the Cardano blockchain via HTTP REST or a command-line interface. The wallet was developed by IOHK, the research and development company behind the Cardano project. Most users who would like to use Cardano should probably start with a wallet like Daedalus, but the cardano-node and cardano-wallet is a good option for third-party wallets, small exchanges, Stake Pool Operators (SPOs) and crypto ATM operators.

Choosing the right component of the Cardano software stack is the first step. The Cardano-wallet can be used as a component of a frontend such as Daedalus, which provides a friendly user interface for wallets.

 

The Cardano-wallet architecture

High-Level Diagram of Cardano node architecture
High-Level Diagram of Cardano node architecture

Cardano-wallet is split in 2 parts: a HTTP Application Programming Interface (API) and command-line interface (CLI) for working with your wallet.

You can find the API documentation here.

You can find the CLI documentation here.

All of the functionality is available through API and CLI interface equally.

Read more about Cardano architecture here.

The Cardano-wallet installation

This tutorial will explain in quick and simple terms how to install and setup cardano-wallet on your node.The tutorial assumes you have cardano-node@1.27.0 running on a Linux Ubuntu Server.

You can get the latest release of the cardano wallet software here.

You can install it using a docker image following the installation guide.

Or to download precompiled binaries simply choose the version you need from the “Asset” section in the github releases/ section.

Figure 2: precompiled cardano-wallet binaries for different platforms
Figure 2: precompiled cardano-wallet binaries for different platforms

We have a linux server so choose linux64.tar.gz and downloaded it with:

$ wget https://github.com/input-output-hk/cardano-wallet/releases/download/v2021-05-26/cardano-wallet-v2021-05-26-linux64.tar.gz

Uncompress the file with:
$ tar -xvf cardano-wallet-v2021-05-26-linux64.tar.gz

Make sure that the uncompressed directory is in on your $PATH e.g /usr/local/bin. Or add the directory to the $PATH variable manually.


Check if the software works with:
$ cardano-wallet version

Cardano-wallet service setup

So now we are ready to run the cardano-wallet service.

To do so we need to run:
$ cardano-wallet serve –node-socket /opt/cardano/cnode/sockets/node0.socket –mainnet –database /opt/cardano/cnode/db –listen-address 0.0.0.0 &

  • serve command runs the service
  • –node-socket flag defines the .socket file of your cardano-node
  • –mainnet flag defines the network
  • –database flag defines the /db location
  • –listen-address needs to be 0.0.0.0 so the API server is binded to the local host
  • and & runs the service in the background

After entering this command the service will start synchronizing with your cardano-node and this process can take between 30-60 minutes.

The API’s default port is 8090 so we also need to open this port on the server with:
$ ufw allow 8090

With this the service is online and running, and the API is listening on the port 8090.

Cardano-wallet functionality check

Now we can use some simple commands to check the functionality of the CLI and API sides of the service.

We will use CLI side to create a new wallet first we need to generate a recovery phrase:
$ cardano-wallet recovery-phrase generate –size 21

Then we can generate a new wallet using the generated phrase:
$ cardano-wallet wallet create from-recovery-phrase “testWallet1”

And we can check wallet info:
$ cardano-wallet wallet list | jq ‘.[] | .name, .id, .state’

Now we can use the API side to check the same information from a different machine using:
$ curl -s -X GET :8090/v2/wallets | jq ‘.[] | .name, .id, .state’

Both commands should return the same information:

Figure 3: Expected reply to both CLI and API calls
Figure 3: Expected reply to both CLI and API calls

Connecting the Cardano-wallet to a Bitcoin ATM

Now that we have the Cardano wallet up and running, we’re going to use it as a backend hot wallet for the General Bytes Bitcoin ATMs.

Bitcoin ATMs, also known as ( Bitcoin Teller Machines) are machines that accept cash and dispense Bitcoin in return. Some ATMs also buy Bitcoin from you and dispense cash in return.

General Bytes ATM management platform is called CAS ( Crypto Application Server). It’s basically a browser-based management tool for your entire Crypto ATM network. It supports many cryptocurrencies, rate tickers, wallets, exchanges and unique features.

Installing CAS SSH Tunnel

In order to get the wallet to function you will need to connect your server node to CAS by doing the following.

On your server/node Install Java 8 (used for compilation of client and running).
$ sudo apt update && sudo apt install openjdk-8-jdk-headless

Clone this repository to download source code:
$ mkdir git && cd git
$ git clone https://github.com/GENERALBYTESCOM/batm_public.git

Compile the application from sources:
$ cd batm_public
$ ./gradlew build

Install the service and makie sure it runs after start of the server:

$ cd batm_ssh_tunnel

$ ./batm_ssh_tunnel_install.sh

If all is successful, you’ll receive an auto-generated tunnel password:

Create the ADA Crypto Setting in CAS

The parameters to connect are: protocol:host:port:wallet_Id: wallet_passphrase

  • Protocol is http
  • Host is the IP address of the node hosting the Cardano wallet
  • Port is the port that the cardano wallet is running on. The APIs default port is 8090
  • Wallet_passphrase is a master passphrase to lock and protect the wallet
  • Wallet_id is the unique identifier for the wallet.

Buying Ada at the Boinnex Bitcoin ATM

Boinnex customers can now buy Cardano ( Ada) for cash in seconds using any of the Boinnex Bitcoin ATMs in Ireland

  1. Select “Cardano” at the kiosk
  2. Choose cash amount and input your phone number
  3. Scan the QR code of your Cardano wallet address
  4. Put the cash into the kiosk bill acceptor
  5. Press buy, and you’re done!
  6. Optionally, you can then receive your receipt via e-mail or SMS

Conclusion

This was a basic overview and setup of the cardano-wallet implementation of the Cardano software stack. We’ve used the wallet as a hot wallet for a network of crypto ATMs around Ireland. 

We hope you find it useful.

Share this 

Facebook
Twitter
LinkedIn
Ozzak

Ozzak

Ozzak discovered blockchain technology in early 2017 and decided that this is exactly what he wants to do with his life. In 2018 he was accepted in the Computer Science course at University College Cork. He's now in his 3rd year working for Boinnex as a part of his internship. As you may imagine he's deeply passionate about everything blockchain. Ozzak's other interests include calisthenics, blues harp and Austrian economics. He also has an impressive collection of tarantula spiders.

Have any questions? Write them below

Leave a Reply

Sign up for our Newsletter

Receive daily updates directly in your favorite email.