Using the Koinos-CLI wallet in Testnet V2

vonlooten
4 min readNov 28, 2021

--

After I published the last article, which was all about how to run a Koinos node on Linux, I’m going to explain to you how the Koinos-cli wallet works. Our goal for today is to import the private key that has been created when we started our Koinos node in the last tutorial and check out the functions of the Koinos-cli.

Download the Koinos-cli & preparation

The Koinos-cli can be found on GitHub again. Check out the latest releases and download the correct build for you.

My node with the running jsonrpc service is running on a Linux root server. If you are running the node on your local machine, you could skip the next commands and simply extract the downloaded zip file.

wget https://github.com/koinos/koinos-cli/releases/download/v.0.2.0/koinos-cli.v0.2.0.linux.x64.tar.gz
tar -xvzf koinos-cli.v0.2.0.linux.x64.tar.gz
rm koinos-cli.v0.2.0.linux.x64.tar.gz

To connect our node, we need to make sure that our jsonrpc service is running. We will do that with the help of a docker command.

docker ps --filter name=koinos_jsonrpc_1

This command should return something like that:

If the jsonrpc service is not shown here, navigate to the directory where your docker-compose file of the node is located and restart it again with this command:

docker-compose up -d 

The last step before we can open the Koinos-cli is a very important one.
We need to print our private key. The private key is located in the block_producer folder, which is a child folder of the base directory, of our node. Let’s print it to our console.

cat ~/.koinos/block_producer/private.key

Copy the shown private key to your clipboard.

Launching the Koinos-cli

If the wallet is extracted and the jsonrpc is running, you should now cd into the directory.
In this directory we will find the Koinos-cli binary file.
We are going to launch it.

cd koinos-cli.v0.2.0.linux.x64
./koinos-cli

If you take a look on the left side of the terminal, you will see two icons.
They show you that you are not connected to the jsonrpc api and also that you don’t have access to an unlocked wallet right now.

Before we proceed any further, let’s take a look at all the commands that are available. Simply type the command list in your cli.

list

Import a private key and create a wallet

Now we are going to connect our cli with our jsonrpc service and import the private key which has been created when we started the node from our last tutorial.

To connect our cli with the local jsonrpc service please use the following command

connect http://127.0.0.1:8080

Now we are going to import the private key and create a wallet for it.
The import command needs 3 parameters.

Usage: import <private-key:string> <filename:string> [password:string]

It could look like this, for example:

import 5KJH3pk4dSA9 koinos.wallet securepassword

The Koinos-cli will prompt a message “Created and opened new wallet: koinos.wallet”

The next time we start the koinos cli and connected to the jsonrpc service, we only need to open the wallet.

Usage: open <filename:string> [password:string]

Now that we are connected and the wallet is opened we can check the balance of our address. Simply type balance.

balance

The balance is 60600 testKoin and 60600 mana. Why does this wallet show two values? If you are asking yourself this question it might be possible that you don’t know what mana is, right? Read about the amazing mana mechanism in koinos here. Make sure you understand the power of mana and the opportunities it brings for the Koinos blackchain.

You can exit the cli by typing exit.

exit

Conclusion

The Koinos-cli works great and is pretty simple. I love the fact that it is written Go, a language I really like. It is pretty straight forward, and it was a great experience using it so far.

What should you try next? Find an address in the network to transfer some tKoin to. Maybe you’ll find one in the discord faucet.

If you found this article helpful, please like and share it.

I also recommend that you visit the Koinos groups to get the latest information or ask any open questions directly to the team or the community.

I also run the Three Things This Week newsletter where I share the 3 most interesting things I found in this week with you.

Please subscribe to the Newsletter

Twitter vonlooten (me)
Twitter koinosnetwork
Discord Koinos
Telegram Koinos Network
Website Koinos.io

Sources

github.com/koinos/koinos-cli
docs.koinos.io

--

--