• Car Gonzalez

How to Create a Grin Node and Wallet for Free with Microsoft Azure

So been a fan of Grin for awhile. We covered it last year in a Thriller Coin Talk. Listen to it hear: Thriller Coin Talk - S2EP 41: The Experiment

Grin has a lot of potential. It is way more popular then anything I have seen come out in quite a long time in the crypto space. It is still in its early days and was only created last year in early 2019.

Check out its Github here.

Today I am here to share how to setup a Grin node on Microsoft Azure. I followed Peter from Coinmole walkthrough...he used Oracle. Highly recommend checking it out as it was very easy to follow.

Okay...lets get started on how to do this for Microsoft Azure.

First up you will need to create a free account with Microsoft Azure, I use Azure in my day job so I felt the most comfortable spinning up a vm there.

Once your Account is created go ahead and select Create VM.

Use the following settings below.

At this point you will need to create an SSH public key. I am using macOS Terminal:

Generating an SSH Key Pair on UNIX and UNIX-Like Systems

Use the following procedure to generate an SSH key pair on UNIX and UNIX-like systems:

Run the ssh-keygen command. [Press Enter]

You can use the -t option to specify the type of key to create. For example, to create an RSA key, run:

ssh-keygen -t rsa [Press Enter]

You can use the -t option to specify the length (bit size) of the key, as shown in the following example:

ssh-keygen -b 2048 -t rsa [Press Enter]

The command prompts you to enter the path to the file in which you want to save the key.

A default path and file name are suggested in parentheses.

For example: /home/user_name/.ssh/id_rsa. To accept the default path and file name, press Enter. Otherwise, enter the required path and file name, and then press Enter.

The command prompts you to enter a passphrase.

It is recommended that you specify a passphrase to protect your private key against unauthorized use. Any password works here just do not forget it.

When prompted, enter the passphrase again to confirm it.

The command generates an SSH key pair consisting of a public key and a private key, and saves them in the specified path. The file name of the public key is created automatically by appending .pub to the name of the private key file. For example, if the file name of the SSH private key is id_rsa, the file name of the public key would be id_rsa.pub.

Make a note of the path and file names of the private and public keys. When you create an instance, you must specify the SSH public key value. When you log in to an instance, you must provide the path to the corresponding SSH private key and you must enter the passphrase when prompted.

Showing hidden files in macOS

Now we need to see those folders in Finder in order to do that will need to enter the following cmd in terminal:

defaults write com.apple.Finder AppleShowAllFiles true [Press Enter] killall Finder [To hide files again, change the “true” in the step above to “false”]

Now we need to enter the public key in Azure.

If you're not familiar with the format of an SSH public key, you can display your public key with the following cat command, replacing ~/.ssh/id_rsa.pub with the path and filename of your own public key file if needed:

cat ~/.ssh/id_rsa.pub [Press Enter]

A typical public key value looks like this example:

ssh-rsa AAAAB3NzaC1yc2EAABADAQABAAACAQC1/KanayNr+Q7ogR5mKnGpKWRBQU7F3Jjhn7utdf7Z2iUFykaYx+MInSnT3XdnBRS8KhC0IP8ptbngIaNOWd6zM8hB6UrcRTlTpwk/SuGMw1Vb40xlEFphBkVEUgBolOoANIEXriAMvlDMZsgvnMFiQ12tD/u14cxy1WNEMAftey/vX3Fgp2vEq4zHXEliY/sFZLJUJzcRUI0MOfHXAuCjg/qyqqbIuTDFyfg8k0JTtyGFEMQhbXKcuP2yGx1uw0ice62LRzr8w0mszftXyMik1PnshRXbmE2xgINYg5xo/ra3mq2imwtOKJpfdtFoMiKhJmSNHBSkK7vFTeYgg0v2cQ2+vL38lcIFX4Oh+QCzvNF/AXoDVlQtVtSqfQxRVG79Zqio5p12gHFktlfV7reCBvVIhyxc2LlYUkrq4DHzkxNY5c9OGSHXSle9YsO3F1J5ip18f6gPq4xFmo6dVoJodZm9N0YMKCkZ4k1qJDESsJBk2ujDPmQQeMjJX3FnDXYYB182ZCGQzXfzlPDC29cWVgDZEXNHuYrOLmJTmYtLZ4WkdUhLLlt5XsdoKWqlWpbegyYtGZgeZNRtOOdN6ybOPJqmYFd2qRtb4sYPniGJDOGhx4VodXAjT09omhQJpE6wlZbRWDvKC55R2d/CSPHJscEiuudb+1SG2uA/oik/WQ== username@domainname

Once you have your public key you will need to copy and paste the content in here. Username will just be anything you want. Leave everything else default.

As you go through all the sections for the creation of the VM you can leave everything default for the following sections once you get to Review + create, Microsoft will run a quick check to make sure all settings are compatible and correct.

At this point you are ready to login to your VM.

Once you have provided your private key path you can then copy the command.

Time to connect to Azure

Open up terminal and paste, It will look similar to the following:

ssh -i /Users/yourname/.ssh/id_rsa user@ [Press Enter]

You will then see something similar to the following:

Next lets update Ubuntu with the following commands:

sudo apt-get update [Press Enter]

Type each line above and below and press enter, and press “y” and enter whenever prompted to continue installing.

sudo apt-get upgrade [Press Enter]

Next, we need to install some programs and packages to ensure Grin can run and build on our system.

Copy and Paste the following command and type “y” whenever prompted. Hit enter:

sudo apt-get install git nano tmux pkg-config clang cmake libncurses5-dev libncursesw5-dev zlib1g-dev libssl-dev tor

[Press Enter]

Next will install Rust:

curl https://sh.rustup.rs -sSf | sh; source $HOME/.cargo/env [Press 1] [When prompted for the default Rust installation, and let it complete.]

Afterwards, we will take the latest Grin Node release and compile our own build with the following three commands enter each one by one:

git clone https://github.com/mimblewimble/grin.git [Press Enter]

cd grin [Press Enter]

cargo build --release [Press Enter]

This will take about 20 minutes, you will know it’s done when it looks like the following below:

Building the Grin Wallet:

git clone https://github.com/mimblewimble/grin.git [Press Enter]

cd grin [Press Enter]

cargo build --release [Press Enter]

This will also take some time, but a little less than the previous one. Now you will see something similar to the following below:

Introduction to tmux

tmux is a program which runs in a terminal and allows multiple other terminal programs to be run inside it. Each program inside tmux gets its own terminal managed by tmux, which can be accessed from the single terminal where tmux is running - this called multiplexing and tmux is a terminal multiplexer.

tmux - and any programs running inside it - may be detached from the terminal where it is running (the outside terminal) and and later reattached to the same or another terminal.

Programs run inside tmux may be full screen interactive programs like vi(1) or top(1), shells like bash(1) or ksh(1), or any other program that can be run in a Unix terminal.

There is a powerful feature set to access, manage and organize programs inside tmux, both interactively and from scripts.

The main uses of tmux are to:

  • Protect running programs on a remote server from connection drops by running them inside tmux.

  • Allow programs running on a remote server to be accessed from multiple different local computers.

  • Work with multiple programs and shells together in one terminal, a bit like a window manager.

For example:

  • A user connects to a remote server using ssh(1) from an xterm(1) on their work computer and run several programs. perhaps an editor, a compiler and a few shells.

  • They work with these programs interactively, perhaps start compiling, then close the xterm(1) with tmux and go home for the day.

  • They are then able to connect to the same remote server from home, attach to tmux, and continue from where they were previously.

tmux Commands

There are three ways to issue commands to tmux:

  • shortcuts: tmux uses what is called a prefix key, which is CTRL+b by default. tmux will interpret the keystroke following the prefix as a tmux shortcut. For example: to detach from your session using a shortcut: press CTRL+b, release both keys and then press d.

  • command mode: Enter command mode by pressing Prefix then :. This will open a command prompt at the bottom of the screen, which will accept tmux commands.

  • command line: Commands can also be entered directly to the command line within a tmux session. Usually these commands are prefaced by tmux. The tmux attach command used in the previous section was an example of this type of command.

Most tmux tasks can be accomplished using any of these methods. Will stick to the following commands.

Detach from a session: ctrl + B + D (this brings you back to your main terminal) List all current sessions: ctrl + B + S and use arrow keys + enter to switch sessions.

...for more on tmux check out this guide.

tmux cheat sheet works best (used for the bulk of this tutorial)

Getting Started with tmux and starting the Grin node.

First Install tmux

Install tmux with your distribution’s package manager.

sudo apt install tmux [Press Enter]

Now lets start Grin node.

tmux attach -t grinnode [Press Enter]

First, let’s start a new tmux session for our grin node you will see the following below:

This created a new tmux tab named “grin-node-1”.

Now let’s get to the fun part and start the node, type the following command:

cd ~/grin/target/release [Press Enter]

./grin [Press Enter]

Boom a Grin Node GUI

Thats right a slick Graphical User Interface that has started up and began syncing. This will take a while as it needs to download the entire Grin blockchain! Luckily, because we did this in a tmux session we can continue doing other things while it syncs.

Time to tmux back

Now that your grin node is syncing, lets press ctrl + B then D to exit the tmux session (it still runs in the background). Next:

tmux new -s grinlistener [Press Enter]

cd ~/grin-wallet/target/release [Press Enter]

./grin-wallet init [Press Enter]

You should be prompted to enter a password; make sure you remember it as you will have to enter it every time you use your wallet! Afterwards, you will be given a 12 word passphrase called a “seed” that you must write down. These 12 words will allow you to recover your wallet if you ever lose it. Next:

./grin-wallet -e listen [Press Enter]

This will start the wallet listening process. You should see something that says “foreign listener started.”

You should see something similar below:

Afterwards, press ctrl + B + D to let it run in the background.

Now make sure both sessions are running enter the following:

tmux ls [Press Enter]

Who should see something similar:

Now we need to change some config files for Grin using Nano, a common Linux text editor.

nano ~/.grin/main/grin-server.toml [Press Enter]

Use arrow keys to navigate down to “api_http_addr” and change it to “”

Save changes, press ctrl + X, then Y, and finally Enter to overwrite the file.

nano ~/.grin/main/grin-wallet.toml [Press Enter]

Navigate to “api_listen_interface” and change that address to “” as well. Exit and save changes. Almost done! Next we will have to open some ports so we can listen to grin transactions trying to talk to our server:

sudo iptables -D INPUT 6 [Press Enter]

sudo netfilter-persistent save [Press Enter]

sudo netfilter-persistent reload [Press Enter]

Opening Ports on Azure

For all rules, copy the following above.

Add 3 Inbound security rules for ports 3413, 3414, and 3415. Each one should be using the Source IP set to address with a Source port range * Destination set to Any on Protocol TCP and have a priority set 410, 510, 610 naming GrinPort1, GrinPort2, GrinPort3 Action will be set to Allow

Description: These are all the ports Grin needs to listen to.

To test the ports are open. Head over to You Get Signal, type in your Azure instance's public IP address, and confirm that the above 3 ports are indeed open.

Congratulations! You can now receive grin at http://<your instance’s IP address>:3415

Checking your Grin Wallet

Definitely do not store your Grin coins on your instance’s wallet for long periods of time. Use it to receive http grin transfers, and then immediately transfer the grin to another wallet for storage.

Also leave a new tmux session dedicated to just grin wallet commands:

cd ~/grin-wallet/target/release [Press Enter]

tmux new -s grinwallet [Press Enter]

./grin-wallet info [Press Enter]

This will check the current contents of your grin wallet. Test by sending a tiny amount of Grin to make sure yours is working! Also make sure to check out Grin-Node Challenge 2020 - Win over +800 GRIN Coins and free GRIN Merchandise

If you have any questions hit me up on Twitter for the fastest response. Also definitely check out How to Run a Grin node on Google Cloud for free