• Brendan Lee

Preparing to install the tokenized smart contract agent (2/5)

Updated: Feb 13

This is the second blog of the five blog series in partnership with Tokenized


Update (30/01/2020): We have changed the download links to the most recent distribution of the BitcoinSV node client (currently version 1.0.1) and made minor corrections to some of our descriptions


To run the Tokenized smart contract, you will need to prepare a suitable environment.


During this process, we tried to demonstrate the smart contract operating on the 3 major operating systems including:

  • Windows 10

  • Linux

  • MacOS



Setting up BitcoinSV


A smart contract agent requires access to a BitcoinSV network client to send and receive Bitcoin transactions on the network. Currently, Tokenized does not offer a public-facing system for this service so users need to have access to a client that is running with indexing and a full copy of the BSV blockchain.


Currently the simplest way of doing this is to use the BitcoinSV Node client that is being developed by nChain however in the future, this will be a service that Tokenized and others will offer which will remove the overhead of monitoring all activity on the network from smart contract users.


Windows 10


Since the inception of the BitcoinSV node client, the team behind the effort has focussed exclusively on developing for Linux as this is what was requested by their financial sponsors.


While Windows 10 has what is called ‘Windows Subsystem for Linux’ or WSL which allows users to install Linux variants as a subsystem to Windows, the way the system mounts hard drives caused us several issues when trying to operate the BitcoinSV node client and we were unable to synchronize the BSV blockchain.

In addition, Tokenized does not have binaries for the smart contract agent or CLI utility for Windows.


For these reasons, we do not recommend setting up either BitcoinSV or Tokenized using Windows at this time.


MacOS


The BitcoinSV node client is not available for MacOS at this time. At this time, we would recommend using Docker to install and run the BitcoinSV node client software for MacOS.

Full instructions are available thanks to the BitcoinSV node team in the following Github repository:


https://github.com/bitcoin-sv/docker-sv/tree/master


Once installed, use the following settings for your bitcoin.conf file:



txindex=1 tells the client to index all transactions in the blockchain. This is needed to allow the client to request it’s own transactions via RPC


server=1 tells the client to accept RPC commands


listen=1 allows the client to accept incoming connections from the P2P network.


To get more information about any of these settings, input the following command in your CLI:


$ ./bitcoind --help

Linux


For our system, we used a Digital Ocean droplet with 6 CPUs, 16GB RAM and 320GB of storage configured with the latest version of Ubuntu however anyone running Linux on their own PC with at least 8GB of RAM, 2CPUs and 200GB of free hard drive space should also be able to do the same.


Setting up the droplet was extremely easy once our account was established. Check out:

www.digitalocean.com.


We used PuTTY to connect which is available here:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html


When your Droplet is established, and each time you log in, you will be given root access.

To use the smart contract you must have a separate user setup.


Create a new user as follows:


$ adduser username


You will be asked to enter a password for your new user and a few other details which you can choose to leave blank. Each time you generate a new instance of your Command Line interface, you will need to change to your new user profile which is as simple as:

$ su username


Install the BitcoinSV Node client


The installation of BitcoinSV node client is a snap.


Step 1. Download the most recent stable release using wget


$ wget https://download.bitcoinsv.io/bitcoinsv/1.0.1/bitcoin-sv-1.0.1-x86_64-linux-gnu.tar.gz


Step 2. Unzip the binary


$ tar -xf bitcoin-sv-1.0.1-x86_64-linux-gnu.tar.gz


Step 3. Create and edit your bitcoin.conf file


$ touch ~/.bitcoin/bitcoin.conf


$ nano ~/.bitcoin/bitcoin.conf


Here are my settings:


txindex=1

server=1

listen=1

rpcuser=brendan

rpcpassword=securepassword

rpcallowip=127.0.0.1


txindex=1 tells the client to index all transactions in the blockchain. This is needed to allow the client to request it’s own transactions via RPC.


server=1 tells the client to accept RPC commands


listen=1 allows the client to accept incoming connections from the P2P network.


To get more information about any of these settings, input the following command in your CLI:


$ ./bitcoind --help


Step 4. Start Bitcoin


$ cd bitcoin-sv--1.0.0.beta2/bin


$ ./bitcoind


Once you have started Bitcoin, it will commence the process of synchronising. This process involves downloading the full blockchain, indexing all the transactions as it goes. Using the Genesis beta which has multithreaded block validation, this can take as little as a few hours.

You can check progress by typing:


$ ./bitcoin-cli getblockchaininfo


in the ~/bitcoin-sv-0.2.1/bin folder.


Check what the latest blockheight is on www.whatsonchain.com to see how far along you are. Once you reach the chaintip, your node client is ready to start working.


Check back next week as we go through how to set up Golang and the Tokenized smart contract agent in preparation for creating our contract and issuing tokens!


This is the second blog of the five blog series in partnership with Tokenized.

RELATED ARTICLES

Blog 1

Blog 2- You're reading it.

Blog 3

Blog 4

Blog 5


About Brendan Lee


Mr. Lee's career to date has been focused on increasingly senior roles within industrial design, automation, and control, focusing on software design and implementation. Most recently, Mr. Lee was the Bitcoin Engineering Lead for the Tokenized project team who developed the Tokenized protocol. The Tokenized protocol is a comprehensive, regulation-friendly solution for businesses to create tokens for real-world assets on the BSV blockchain.


Follow him on Twitter




Subscribe to our weekly newsletter to follow our journey into building a business at the intersection of community & technology. 

©2019 by Faiabrand Pte Ltd