Getting Set Up With Grin
In this article, I’m going to describe how to get set up with Grin (TestNet 3)
Grin is a blockchain and a cryptocurrency focused on privacy and scalability. Grin is also an implementation of the MimbleWimble transaction format with the extensions required for a complete blockchain.
The end goal here is to have a grin node, miner, and wallet set up, and be able to send a transaction. In order to get there, we need to complete the following steps;
- Build Grin and Grin-Miner
- Configure and run all services
- Build and run Grin Web Wallet
- Set up Grin-Miner
I’m not going to cover the build steps in great detail, as these are documented quite well in the Grin Build Documentation and also for Grin Miner. This article is aimed more at how to get everything running together, and decrease the TTFT (Time to first transaction!) I’ll keep the article up to date as I get feedback or discover new things, or Grin its self changes!
In this scenario, I’m setting it up on Ubuntu 18.04, with 4GB of RAM, and using separate terminal windows to run each service to demonstrate. You can of course set these up properly using system services.
curl -sSf https://static.rust-lang.org/rustup.sh | sh
apt-get install build-essential cmake git libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev pkg-config libssl-dev
Build Grin and Grin-Miner
git clone https://github.com/mimblewimble/grin.git
cargo build --release
git clone https://github.com/mimblewimble/grin-miner.git
git submodule update --init
This means we now have executables in the following places;
So, we need to run a few services here. If you are running locally, use a separate terminal window for each (If you are using a remote server, you could use Screen)
Start the node;
You should see a pleasant UI and the blockchain will start downloading
In a new terminal window, we need to initialise the wallet, open up the firewall port, and start the wallet listener.
./grin/target/release/grin wallet -p 'MyPassword' init
This should let you know which wallet configuration file is being used. In my case, its ‘Using wallet configuration file at /root/.grin/grin-wallet.toml’ So lets go ahead and edit that configuration file.
We need to set the api_listen_interface address to 0.0.0.0 (To listen on all IP’s) and make a note of the port. This is defaulted to 13415. Save this file, and now lets open up that port on the firewall (You may also need to forward this port to your computer at your )
ufw allow 13415
Now we can start the wallet listener.
./grin/target/release/grin wallet listen
To get some testnet coins, and check everything is working, we can use a faucet, then check our wallet balance. In a new terminal;
./grin/target/release/grin wallet info
You can also see transactions with
./grin/target/release/grin wallet txs
If all goes well, you should be sent back a transaction with a random number of Grins, and see them in your wallet balance.
The next step is to get a web wallet up and running
First we need to modify our wallet config to turn off HTTP authentication (As the web wallet doesn’t yet support it) and then run our Owner API
and comment out the following line to disable Basic Auth;
#api_secret_path = "/root/.grin/.api_secret"
And start up the owner-api, again, in a new terminal window.
./grin/target/release/grin wallet owner_api
Now lets clone and build the wallet
git clone https://github.com/mimblewimble/grin-web-wallet.git
npm install -g @angular/cli
Now hit http://localhost:4200/ in a browser, and you should see a nice wallet UI!
Ok, now lets get that wallet filled up with Grins by mining it!
One more terminal window! Lets get grin-miner started up. Lets go back to our node window and temporarily stop it, pressing Q, and we need to edit the config;
and enable the mining server
enable_stratum_server = true
we can now start up the miner. We cd to grin-miner first to ensure the config file is picked up;
Now we should see we are up and running mining
We should also be able to see that the node screen has updated showing the new miner
We now have a Grin Node, Grin Miner, Wallet, and we are able to receive and send transactions. To take a quick look how it should look, see this video; https://youtu.be/eEGDNZ10leA
Let me know how you get on here in the comments on on Twitter and if you found the article useful please consider using my DigitalOcean referral link to get $25 account credit ($100 during October) to spend on cloud SSD VMs — https://m.do.co/c/df9d84f09f52
If you like Grin, please also consider donating to the project here;