How to Create a Grin Node and Wallet for Free with Oracle Cloud

At the end of this tutorial, you will have learned how to create a grin node in the cloud, with its own http listener address you can send grin to, allowing you to easily withdraw your grin from exchanges.

Estimated time: Around 2 hours, but you do not need to do it all at once (a lot of it is just waiting for things to download/build).

Read my other post for a general introduction to Grin and Mimblewimble.

For those who have looked into Grin, you have probably realized how difficult it is to set up your own node and wallet. While programs like Grin++ and Niffler simplify it, nothing beats having your own private node that you can use to send and receive Grin. That way, you aren’t reliant on external services of any kind and put yourself in charge of your own security.

Why Oracle Cloud?

Oracle Cloud has an always free tier that includes your own virtual Linux instance that you can use to run a Grin Node and wallet. While you do have to give credit card info, you won’t actually be charged unless you start using more advanced tools and storage, which we will not do.

While Google Cloud also has an always free tier (which also requires credit card info), Oracle’s offering has a far superior compute power. For reference, when I tested Google Cloud, building the Grin Node took 94 minutes, compared to 29 minutes on Oracle Cloud. That’s a crazy difference!

Anyways, let’s get started with learning how to create a grin node in the cloud!

Step 1: Set up Oracle Cloud Account & Instance

First, you have to create your Oracle Cloud account. To do so, go to this page: https://www.oracle.com/cloud/free/.

From there, click “Start for Free” and go through the signup process. Keep in mind again that you will have to enter a credit card, but you will not be charged if you follow the steps of this guide. Oracle just wants to make sure their servers aren’t flooded with bots abusing their free offerings.

Once you have clicked “Create a Compute Instance,” you will reach the configuration page. At the top, name your instance something like “grin-node-1”. Make sure you change the operating system, also known as image source, to “Ubuntu 18.04.” Also click “show shape, network, storage options” and make sure everything is set to the “always free eligible” option. Your screen should look like this:

These should be the default settings, but always double check.

You can leave the networking and boot volume settings at default.

SSH Key Generation with PuTTY

Next, we are going to have to create an SSH key set so that we can securely login to our instance. This ensures that outsiders won’t be able to access our node, or listen in on what we are doing. The best way to do this, for Windows users, is to download PuTTY.

Note: On Linux or Mac (UNIX systems), please follow these instructions from Oracle themselves: https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/generating-ssh-key-pair.html

Once installed, open the program “PuTTYgen” (NOT regular “PuTTY”) and confirm the settings are set to RSA and 2048 bits generated. Then click “Generate” and move your mouse around to let the program generate some randomness.

Remember to back up your keys!

When it’s done generating, click “save private key” and save it *somewhere safe*! Name it something you will remember. You need to back this up! Don’t worry about the prompt about not having a password – for your grin node this is perfectly fine. Just don’t ever show anyone else this file.

Next, Copy *everything* in the public key box, paste it into a notepad file and save it in the same directory. I named mine “grin-node-key.pub” for extra convenience.

Then, in the SSH Key box on the Instance Creation page, paste that same public key into the box. Then, you can hit “Create”! Give it some time and you should be greeted with an overview page of your new instance.

Step 2: Connecting to your Instance via PuTTY

Congratulations! If you’ve made it this far that means you have a tiny free cloud computer somewhere in the world running Ubuntu OS. Now we just need to gain access to that with a console and we can start creating our Grin node!

To begin, please open up the “PuTTY” program. On the first screen, copy your new instances Public IP Address into the “Host name (or IP Address)” box. You can leave the port on 22. Additionally, give the session a name like “grin-node-oracle-1” to easily return to it in the future.

It should look like this so far.

Then, navigate to Connection -> Data, and set the auto-login username to “ubuntu” (don’t include the quotes). This just lets us not have to type “ubuntu” every time we connect to our instance.

Next, go to SSH -> Auth. At the bottom, click “browse” and navigate to the private key you saved earlier. Open that, and you are all done!

Navigate back to the original “session” tab, make sure to save your session name so you don’t have to repeat this in the future, and click open! This is how you will access your instance’s console!

Step 3: Compiling a Grin Node and Grin Wallet

If you followed all steps correctly, you should be greeted with the following window:

The white box is my personal computer’s IP address, which shall never be revealed!

In any Linux instance, the first thing you should do is make a habit of entering the following commands, one at a time. Note the “$” sign should not be typed, it just indicates the beginning of a command, just like it does in the console itself:

$ sudo apt-get update
$ sudo apt-get upgrade

Type them and press enter, and press “y” and enter whenever prompted to continue installing. These two commands update your package lists and then download the latest upgrades to them, respectively.

Note: In PuTTY, if you want to paste a copied command into the terminal, just right click your mouse button instead of the traditional Control + V!

Next, we need to install some programs and packages to ensure Grin can run and build on our system. Enter the following command and type “y” whenever prompted. Remember to press enter as well:

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

Then, we need to 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:

$ git clone https://github.com/mimblewimble/grin.git
$ cd grin
$ cargo build --release

This will take about 30 minutes, you will know it’s done when it says “finished release [optimized]” and you see your able to enter commands again.

If you see the above weirdness, don’t worry about it; it doesn’t seem to affect anything.

Then, it’s time to build the Grin Wallet:

$ cd ~
$ git clone https://github.com/mimblewimble/grin-wallet.git
$ cd grin-wallet
$ cargo build --release

This will also take some time, but a little less than the previous one. While it’s building read the next steps to learn more about Tmux, which we will be putting to good use soon!

Step 4: Using Tmux and Starting a Grin Node

Tmux stands for “Terminal Multiplexer.” Basically, it allows you to run multiple terminal sessions at once, in the same way a browser lets you have multiple tabs. It takes some getting used to and you need to remember some basic keyboard shortcuts, but it’s extremely useful.

A Quick Tmux Hotkey Guide:

Detach from session: ctrl + B, then press D (this brings you back to your main terminal)
List all current sessions: ctrl + B, then press S and use arrow keys + enter to switch sessions
Reattach to session: $ tmux attach -t grinnode (replace “grinnode” with any session name)

First, let’s start a new tmux session for our grin node:

$ tmux new -s grinnode

This creates a new Tmux tab named “grinnode”. Now let’s go to our grin directory and start the node:

$ cd ~/grin/target/release
$ ./grin

Now, you should see the Grin Node GUI (Graphical User Interface) start up and begin 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.

If you see this screen, it means your Grin node is working and syncing!

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
$ cd ~/grin-wallet/target/release
$ ./grin-wallet init

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

This will start the wallet listening process. You should see something that says “foreign listener started.” Afterwards, press ctrl + B, then D to let it run in the background.

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

$ nano ~/.grin/main/grin-server.toml

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

To save changes, press ctrl + X, then Y, and finally Enter to overwrite the file. Now we have to do the same thing with the wallet config file:

$ nano ~/.grin/main/grin-wallet.toml

Navigate to “api_listen_interface” and change that address to “0.0.0.0” 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
$ sudo netfilter-persistent save
$ sudo netfilter-persistent reload

This gets rid of the Oracle instance’s default block on all ports and saves your changes.

Step 5: Opening Ports on Oracle Cloud

Now we need to open up ports on our Oracle Cloud Instance. On your instance details page on the Oracle Cloud website, click the “Virtual Cloud Network” link under Instance Information and you should see the following page:

On the left side, click the Security Lists link, and then click the Default Security List under the security lists. From there, click Add Ingress Rule.

For all rules, type 0.0.0.0/0 in the source CIDR box. Make 3 Ingress rules for ports 3413, 3414, and 3415. These are all the ports Grin needs to listen to.

To test if your ports are open, head over to https://www.yougetsignal.com/tools/open-ports/, type in your 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

I highly recommend not storing 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.

It’s handy to have a new tmux session dedicated to just grin wallet commands:

$ cd ~/grin-wallet/target/release
$ tmux new -s grinwallet
$ ./grin-wallet info

This will check the current contents of your grin wallet. You should send a tiny amount of grin to make sure yours is working!

Mine worked perfectly, and I built it along with this tutorial!

For more info on grin-wallet usage, refer to the official manual: https://github.com/mimblewimble/docs/wiki/How-to-use-the-Grin-wallet

Now you can withdraw from exchanges and pools easily without having to use a third-party program like Grin++ or Niffler! Hopefully you liked learning how to create a grin node, and now you can spread the knowledge.

If you have any questions or difficulties, please let me know in the comments or at coinmole@protonmail.com.

Leave a Comment