Setup and Install TokenMarketNet Smart Contract ICO Tools

Instructions are written in ubuntu 16.04.

Experience needed:
Basic command line usage
Basic Github usage

Step 1: Install Python and Dependencies

Ensure the OS has latest packages:
sudo apt-get update

Install dependencies:
sudo apt install -y git build-essential libssl-dev python3 python3-venv python3-setuptools python3-dev cmake libboost-all-dev

Python 3.5+ required. Make sure you have a compatible version:
python3.5 --version
Python 3.5.2

Step 2: Configure System locale to C.UTF-8 (Required)

vi ~/.profile
sudo dpkg-reconfigure locales
export LC_ALL="C.UTF-8"
export LC_CTYPE="C.UTF-8"
source  ~/.profile

Step 3: Install TokenMarketNet Tools, Python virtual environment and Required Dependencies

cd /usr/local
sudo git clone --recursive
cd ico
sudo python3.5 -m venv venv
source venv/bin/activate
sudo chown -R ubuntu:ubuntu /usr/local/ico
pip install wheel
pip install -r requirements.txt
pip install -e .

Step 4: Install Solidity Compiler to compile Smart Contract

Install Solidity solc compiler:
sudo apt install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt update
sudo apt install -y ethereum solc

Step 5: Setup the Parity Json-RPC For Posting of ICO operations to Ethereum Network.
The default set up assumes you run JSON-RPC in http://localhost:8545 for mainnnet and http://localhost:8547 for Kovan testnet.

apt-get install build-essential openssl libssl-dev libudev-dev
curl -Lk >

Overwrite some variables in the file. 
From this
if [ "$RELEASE" = "beta" ]; then
elif [ "$RELEASE" = "stable" ]; then
To this:
if [ "$RELEASE" = "beta" ]; then
elif [ "$RELEASE" = "stable" ]; then

run below and parity will be installed.

Step 6: Create a new Kovan testnet account via parity

parity account new --chain kovan --keys-path /home/ubuntu/.local/share/io.parity.ethereum/keys

key in the password, the account password will be stored in plain text, so do not use a strong password. Create a file testkovan_accpwd.txt and store the password there.

Store the Account Address, you will need this address to start parity later.

Step 7: Parity with Kovan Testnet
Start Parity JSON-RPC for Kovan testnet, unlocking your Kovan account for test transactions. It will permanently unlock your account using the password given and listen to JSON-RPC in port http://localhost:8547.

First run: 
parity --chain=kovan

The chaindata files and such will be generated as below:
Keys path /home/ubuntu/.local/share/io.parity.ethereum/keys/Kovan
DB path /home/ubuntu/.local/share/io.parity.ethereum/chains/kovan/db/9bf3jewrre5ea98

parity --chain=kovan --jsonrpc-hosts=all --unlock 0x013219ciu34545y305c9ec55f2ba8rje34er22 --password testkovan_accpwd.txt --jsonrpc-apis "web3,eth,net,parity,traces,rpc,personal" --jsonrpc-port 8547 --no-ipc --port 30306 --tracing on --allow-ips=public

Step 8: Getting Kovan testnet ETH
* Kindly ask people to send you Kovan ETH (KETH) on the Kovan Gitter channel

Step 9: Start Compiling Smart Contract .sol files
You will need to write the yml and sol files. Once done run the commands below:

cd /usr/local/ico
source venv/bin/activate
export SOLC_BINARY=/usr/local/ico/
export SOLC_VERSION=0.4.18
populus compile

Step 10: Deploy Contracts
Start Parity using command in Step 7
Ensure you have activate the virtual environment following step 9. Take note the sample contracts has been deployed to Kovan before, you MUST create new contract using the samples before deploy.

deploy-contracts --deployment-name kovan --deployment-file crowdsales/allocated-token-sale-example.yml --address 0x013219ciu34545y305c9ec55f2ba8rje34er22

Step 11: Exit Virtual Environment


Errors Encountered:
Error 1:

TraceDB resync required

locate user_defaults
cat ~/.local/share/io.parity.ethereum/chains/ethereum/user_defaults 
Editing this file to read "tracing":true will solve your issue.

Error 2:

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/create: dial unix /var/run/docker.sock: connect: permission denied.

run the command below will solve the issue:
sudo chown -R ubuntu:ubuntu /var/run/docker*

Be the first to comment

Leave a Reply

Your email address will not be published.