How to do on-chain registration as a P-Rep candidate?

ICONOsphere
3 min readAug 29, 2019

--

This is a short guide on how to register on ICON mainnet as P-Rep using prep tools.

This process was executed on Ubuntu 18.04 machine with python 3.7 installed. First clone the prep tools from github and enter into the prep tools folder.

$ git clone https://github.com/icon-project/preptools.git
$ cd preptools

Create virtual environment using the following commands and build manually using the script.

$ python3 -m venv venv
$ source venv/bin/activate
(venv)$ ./build.sh
(venv)$ ls dist
preptools-1.0.2-py3-none-any.whl

If you don’t have virtual environment you can install it using the command:

$ sudo apt-get install python3-venv

Now to install the .whl file we need to install some dependencies.

Install Dependencies

$ sudo apt-get install -y libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev libyaml-cpp-dev
$ sudo apt-get install -y python3.7-dev libsecp256k1-dev python3-pip

Install Preptools

(venv) $ pip install dist/preptools-1.0.2-py3-none-any.whl
(venv) $ pip install preptools

Now the prep tools is installed and we can use it to register as P-Rep. You can check all the available commands of prep tools using help flag.

$ preptools --helpoptional arguments:subcommands:
usage: preptools [-h]
{registerPRep,unregisterPRep,setPRep,setGovernanceVariables,getPRep,getPReps,txresult,txbyhash,keystore,genconf}
-h, --help show this help message and exit
{registerPRep,unregisterPRep,setPRep,setGovernanceVariables,getPRep,getPReps,txresult,txbyhash,keystore,genconf}
registerPRep Register P-Rep
unregisterPRep Unregister P-Rep
setPRep Change enrolled P-Rep information
setGovernanceVariables
Change Governance variables used in network operation
getPRep Inquire P-Rep information
getPReps Get live status of all registered P-Rep candidates
txresult Get transaction result by hash
txbyhash Get transaction by hash
keystore Create keystore file in the specified path.
genconf Create config file in the specified path.
... P-Rep management cli

Generate a preptools_config.json

(venv)$ preptools genconf
Made ./preptools_config.json successfully

Edit this configuration file for the mainnet.

(venv)$ cat preptools_config.json
{
"url": "https://ctz.solidwallet.io/api/v3",
"nid": 1,
"keystore": null
}

You need a keystore file of the wallet with 2000 ICX balance plus enough balance to cover the transaction fee. Put it inside the preptools folder to make it easier for providing path.

Another file, registerPRep.json is also required with all the details of the P-Rep.

(venv)$ cat registerPRep.json
{
"name": "banana node",
"country": "USA",
"city": "New York",
"email": "banana@example.com",
"website": "https://icon.banana.com",
"details": "https://icon.banana.com/json",
"p2pEndpoint": "node.example.com:7100"
}

Details file is the json file including details of your logo, social sites as well as your server endpoints.

Sample Details JSON file

{
"representative": {
"logo": {
"logo_256": "https://icon.foundation/img/img-256.png",
"logo_1024": "https://icon.foundation/img/img-1024.png",
"logo_svg": "https://icon.foundation/img/img-logo.svg"
},
"media": {
"steemit": "https://steemit.com/@iconproject",
"twitter": "https://twitter.com/iconproject",
"youtube": "https://www.youtube.com/channel/iconproject",
"facebook": "https://www.facebook.com/iconproject",
"github": "https://github.com/iconproject",
"reddit": "https://www.reddit.com/user/iconproject",
"keybase": "@iconproject",
"telegram": "@iconproject",
"wechat": "@iconproject"
},
"server": {
"location": {
"country": "",
"city": ""
},
"server_type": "cloud",
"api_endpoint": "example.com:9000/api/v3" //dont add any protocol here,you can use domain or ip address
}
}

Now we can register finally using the following command:

(venv)$ preptools registerPRep -k <keystore_name> --prep-json registerPRep.json

If you have got sufficient balance you will be successfully registered on-chain and will be available on the voting list.

iBriz- ICONOsphere : ICON P-Rep Candidate
iBriz- ICONOsphere : ICON P-Rep Candidate

--

--

ICONOsphere
ICONOsphere

Written by ICONOsphere

With a deep history of commitment to building projects that foster community growth & personal empowerment we work to create a nation built on trust with icon.

Responses (1)