Search…
P-Rep Tools

P-Rep tools (preptools) Tutorial

This tutorial is intended to give an introduction to using preptools. This guide will walk through the basics of setting up the development environment and the usage of preptools CLI commands.

Building from source

First, clone this project. Then go to the project directory, create a virtualenv environment, and run the build script. Then install preptools with the .whl file.
1
$ python -m venv venv # Create a virtual environment.
2
$ source venv/bin/activate # Enter the virtual environment.
3
(venv)$ ./build.sh # run build script.
4
(venv)$ ls dist # check result wheel file.
5
preptools-1.0.6-py3-none-any.whl
Copied!

Installation

This chapter explains how to install P-Rep Tools on your system.

Requirements

  • OS: MacOS or Linux
  • Windows is not supported.
  • Python
    • Make a virtualenv for Python 3.6.5+ (3.7 is also supported)
    • Check your Python version
      1
      $ python3 -V
      Copied!

Setup

Install dependencies
Some native tools and libraries are needed to install preptools without any errors.
1
$ sudo apt-get install -y libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev libyaml-cpp-dev
2
$ sudo apt-get install -y python3.7-dev libsecp256k1-dev python3-pip
Copied!
Install preptools
Install the preptools with the .whl file as below.
1
(venv) $ pip install dist/preptools-1.0.6-py3-none-any.whl
Copied!
Install the preptools with pypi
1
(venv) $ pip install preptools
Copied!

How to use P-Rep tools

Command-line Interfaces (CLIs)

Overview
preptools provides several commands. Here is the list of the available commands.
Usage
1
usage: preptools [-h]
2
...
3
4
P-Rep management command line interface v1.0.6
5
6
optional arguments:
7
-h, --help show this help message and exit
8
9
subcommands:
10
{registerPRep,unregisterPRep,setPRep,setGovernanceVariables,registerProposal,cancelProposal,voteProposal,getPRep,getPReps,getProposal,getProposals,txresult,txbyhash,keystore,genconf}
11
registerPRep Register P-Rep
12
unregisterPRep Unregister P-Rep
13
setPRep Change enrolled P-Rep information
14
setGovernanceVariables
15
Change Governance variables used in network operation
16
registerProposal Register Proposal
17
cancelProposal Cancel Proposal
18
voteProposal Vote Proposal
19
getPRep Inquire P-Rep information
20
getPReps Get live status of all registered P-Rep candidates
21
getProposal Inquire Proposal information using transaction hash
22
getProposals Inquire all of network proposal list.
23
txresult Get transaction result by hash
24
txbyhash Get transaction by hash
25
keystore Create keystore file in the specified path.
26
genconf Create config file in the specified path.
Copied!
Options
shorthand, Name
default
Description
-h, --help
Show this help message and exit

Setting PRep commands

There are four commands to set up the P-Rep information: preptools registerPRep, preptools unregisterPRep, preptools setPRep, and preptools setGovernanceVariables. Whenever the commands are called, they load the configuration from preptools_config.json. In order to use other configuration file, please specify the file location with the -c option.
registerPRep
Description
Register P-Rep. There are two ways of registering a P-Rep.
  • Using command line option Input P-Rep information with --[OPT_NAME] OPT_VALUE. The order of priority is command line > json
  • Using json file Input P-Rep information with --prep-json JSON_PATH.
Usage
1
usage: preptools registerPRep [-h] [--url URL] [--nid NID] [--config CONFIG]
2
[--yes] [--verbose] [--password PASSWORD]
3
[--keystore KEYSTORE]
4
[--step-limit-s STEP_LIMIT] [--name [NAME]]
5
[--country COUNTRY] [--city CITY]
6
[--email EMAIL] [--website WEBSITE]
7
[--details DETAILS] [--p2p-endpoint P2PENDPOINT]
8
[--node-address NODEADDRESS]
9
[--prep-json [PREP_JSON]]
10
11
optional arguments:
12
-h, --help show this help message and exit
13
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
14
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
15
--config CONFIG, -c CONFIG
16
preptools config file path
17
--yes, -y Don't want to ask send transaction.
18
--verbose, -v Verbose mode
19
--password PASSWORD, -p PASSWORD
20
keystore password
21
--keystore KEYSTORE, -k KEYSTORE
22
keystore file path
23
--step-limit-s STEP_LIMIT
24
step limit to set
25
--name [NAME] P-Rep name
26
--country COUNTRY P-Rep's country
27
--city CITY P-Rep's city
28
--email EMAIL P-Rep's email
29
--website WEBSITE P-Rep's homepage url
30
--details DETAILS json url including P-Rep detailed information
31
--p2p-endpoint P2PENDPOINT
32
Network info used for connecting among P-Rep nodes
33
--node-address NODEADDRESS
34
PRep Node Key
35
--prep-json [PREP_JSON]
36
json file having P-Rep information
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
network id
-c, --config
./preptools_config.json
preptools config file path
-p, --password
keystore password
-k, --keystore
keystore file path
-s, --step-limit
0x50000000
step limit to set
--name
P-Rep name
--country
P-Rep's country. This require ISO 3166-1 alpha-3 standard.
--city
P-Rep's city.
--email
P-Rep's email. ex) "[email protected]"
--website
P-Rep's homepage url. ex) "https://node.example.com/"
--details
json url including P-Rep detailed information
--p2p-endpoint
Network info used for connection among P-Rep nodes.
ex) “123.45.67.89:7100” or “node.example.com:7100”
--node-address
PRep Node Key (default: Operator Key)
--prep-json
json file having P-Rep information
Examples
1
(venv) $ cat registerPRep.json
2
{
3
"name": "banana node",
4
"country": "USA",
5
"city": "New York",
6
"email": "[email protected]",
7
"website": "https://icon.banana.com",
8
"details": "https://icon.banana.com/json",
9
"p2pEndpoint": "node.example.com:7100",
10
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6"
11
}
12
13
(venv) $ preptools registerPRep -k test_keystore --prep-json registerPRep.json
14
> Password:
15
[Request] ======================================================================
16
{
17
"from_": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6",
18
"to": "cx0000000000000000000000000000000000000000",
19
"value": 2000000000000000000000,
20
"step_limit": 268435456,
21
"nid": 3,
22
"nonce": null,
23
"version": 3,
24
"timestamp": null,
25
"method": "registerPRep",
26
"data_type": "call",
27
"params": {
28
"name": "banana node",
29
"country": "USA",
30
"city": "New York",
31
"email": "[email protected]",
32
"website": "https://icon.banana.com",
33
"details": "https://icon.banana.com/json",
34
"p2pEndpoint": "node.example.com:7100",
35
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d400"
36
}
37
}
38
39
> Continue? [Y/n]
40
request success.
41
[Response] =====================================================================
42
{
43
"jsonrpc": "2.0",
44
"result": "0xe667b8de967e4c5e2cc5f4fc2775766f87517935e0875a8c4d0b9c8c2ce01846",
45
"id": 1234
46
}
47
48
(venv) $ cat registerPRep.json
49
{
50
"email": "[email protected]",
51
"website": "https://icon.banana.com",
52
"details": "https://icon.banana.com/json",
53
"p2pEndpoint": "node.example.com:7100",
54
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d400"
55
}
56
57
(venv) preptools registerPRep -k test_keystore --prep-json registerPRep.json --name "kokoa node"
58
> Password:
59
> country : USA
60
> city : New York
61
[Request] ======================================================================
62
{
63
"from_": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6",
64
"to": "cx0000000000000000000000000000000000000000",
65
"value": 2000000000000000000000,
66
"step_limit": 268435456,
67
"nid": 3,
68
"nonce": null,
69
"version": 3,
70
"timestamp": null,
71
"method": "registerPRep",
72
"data_type": "call",
73
"params": {
74
"email": "[email protected]",
75
"website": "https://icon.banana.com",
76
"details": "https://icon.banana.com/json",
77
"p2pEndpoint": "node.example.com:7100",
78
"name": "kokoa node",
79
"country": "USA",
80
"city": "New York"
81
}
82
}
83
84
> Continue? [Y/n]
85
request success.
86
[Response] =====================================================================
87
{
88
"jsonrpc": "2.0",
89
"result": "0xeb00ea0ad9ee155067f37015d2403067904649a76a35dd06197600e408d30e3e",
90
"id": 1234
91
}
Copied!
unregisterPRep
Description
Unregister P-Rep.
Usage
1
usage: preptools unregisterPRep [-h] [--url URL] [--nid NID] [--config CONFIG]
2
[--yes] [--verbose] [--password PASSWORD]
3
[--keystore KEYSTORE]
4
[--step-limit-s STEP_LIMIT]
5
6
optional arguments:
7
-h, --help show this help message and exit
8
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
9
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
10
--config CONFIG, -c CONFIG
11
preptools config file path
12
--yes, -y Don't want to ask send transaction.
13
--verbose, -v Verbose mode
14
--password PASSWORD, -p PASSWORD
15
keystore password
16
--keystore KEYSTORE, -k KEYSTORE
17
keystore file path
18
--step-limit-s STEP_LIMIT
19
step limit to set
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
network id
-c, --config
./preptools_config.json
preptools config file path
-p, --password
keystore password
-k, --keystore
keystore file path
-s, --step-limit
0x50000000
step limit to set
Examples
1
(venv) $ preptools unregisterPRep -k test_keystore
2
> Password:
3
[Request] ======================================================================
4
{
5
"from_": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6",
6
"to": "cx0000000000000000000000000000000000000000",
7
"value": 0,
8
"step_limit": 268435456,
9
"nid": 3,
10
"nonce": null,
11
"version": 3,
12
"timestamp": null,
13
"method": "unregisterPRep",
14
"data_type": "call",
15
"params": {}
16
}
17
18
> Continue? [Y/n]
19
request success.
20
[Response] =====================================================================
21
{
22
"jsonrpc": "2.0",
23
"result": "0x027038296f595aedd1bfa680de2e20c3fd133816f9c74807e440bf6c548fb9aa",
24
"id": 1234
25
}
Copied!
setPRep
Description
Change enrolled P-Rep information. There are three way of set P-Rep.
  • Using command line option You can input P-Rep information with --[OPT_NAME] OPT_VALUE. The order of priority is command line > json.
  • Using json file You can input P-Rep information with --prep-json JSON_PATH.
  • Using interactive mode [--i] Activate interactive mode and input P-Rep info what you want. If you don't want to input, just enter.
Usage
1
usage: preptools setPRep [-h] [--url URL] [--nid NID] [--config CONFIG]
2
[--yes] [--verbose] [--password PASSWORD]
3
[--keystore KEYSTORE] [--step-limit-s STEP_LIMIT]
4
[-i] [--name NAME] [--country COUNTRY] [--city CITY]
5
[--email EMAIL] [--website WEBSITE]
6
[--details DETAILS] [--p2p-endpoint P2PENDPOINT]
7
[--node-address NODEADDRESS]
8
[--prep-json PREP_JSON]
9
10
optional arguments:
11
-h, --help show this help message and exit
12
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
13
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
14
--config CONFIG, -c CONFIG
15
preptools config file path
16
--yes, -y Don't want to ask send transaction.
17
--verbose, -v Verbose mode
18
--password PASSWORD, -p PASSWORD
19
keystore password
20
--keystore KEYSTORE, -k KEYSTORE
21
keystore file path
22
--step-limit-s STEP_LIMIT
23
step limit to set
24
-i, --interactive Activate interactive mode when prep fields are blank.
25
--name NAME PRep name
26
--country COUNTRY P-Rep's country
27
--city CITY P-Rep's city
28
--email EMAIL P-Rep's email
29
--website WEBSITE P-Rep's homepage url
30
--details DETAILS json url including P-Rep details information
31
--p2p-endpoint P2PENDPOINT
32
Network info used for connecting among P-Rep nodes
33
--node-address NODEADDRESS
34
PRep Node Key (Default: Own Address)
35
--prep-json PREP_JSON
36
json file including P-Rep information
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
network id
-c, --config
./preptools_config.json
preptools config file path
-p, --password
keystore password
-k, --keystore
keystore file path
-s, --step-limit
0x50000000
step limit to set
-i, --interactive
Activate interactive mode when prep fields are blank.
--name
P-Rep name
--country
P-Rep's country. This require ISO 3166-1 alpha-3 standard.
--city
P-Rep's city.
--email
P-Rep's email. ex) "[email protected]"
--website
P-Rep's homepage url. ex) "https://node.example.com/"
--details
json url including P-Rep detailed information
--p2p-endpoint
Network info used for connection among P-Rep nodes.
ex) “123.45.67.89:7100” or “node.example.com:7100”
--node-address
PRep Node Key (Default: Own Address)
--prep-json
json file having P-Rep information
Examples
1
(venv) $ cat setPRep.json
2
{
3
"name": "kokoa node",
4
"country": "USA",
5
"website": "https://icon.kokoa.com",
6
"details": "https://icon.kokoa.com/json",
7
"p2pEndpoint": "node.example.com:7100",
8
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d400"
9
}
10
11
(venv) $ preptools setPRep -k test_keystore --prep-json setPRep.json
12
> Password:
13
[Request] ======================================================================
14
{
15
"from_": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6",
16
"to": "cx0000000000000000000000000000000000000000",
17
"value": 0,
18
"step_limit": 268435456,
19
"nid": 3,
20
"nonce": null,
21
"version": 3,
22
"timestamp": null,
23
"method": "setPRep",
24
"data_type": "call",
25
"params": {
26
"name": "kokoa node",
27
"country": "USA",
28
"website": "https://icon.kokoa.com",
29
"details": "https://icon.kokoa.com/json",
30
"p2pEndpoint": "node.example.com:7100",
31
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d400"
32
}
33
}
34
35
> Continue? [Y/n]
36
request success.
37
[Response] =====================================================================
38
{
39
"jsonrpc": "2.0",
40
"result": "0xc8456053128897a0941dab4c79428db91dda5a2899e3813698146ac25808c4c9",
41
"id": 1234
42
}
43
44
(venv) $ preptools setPRep -k test_keystore --prep-json setPRep.json -i
45
> Password:
46
> city : New York
47
> email :
48
[Request] ======================================================================
49
{
50
"from_": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6",
51
"to": "cx0000000000000000000000000000000000000000",
52
"value": 0,
53
"step_limit": 268435456,
54
"nid": 3,
55
"nonce": null,
56
"version": 3,
57
"timestamp": null,
58
"method": "setPRep",
59
"data_type": "call",
60
"params": {
61
"name": "kokoa node",
62
"country": "USA",
63
"website": "https://icon.kokoa.com",
64
"details": "https://icon.kokoa.com/json",
65
"p2pEndpoint": "node.example.com:7100",
66
"city": "New York",
67
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d400"
68
}
69
}
70
71
> Continue? [Y/n]
72
request success.
73
[Response] =====================================================================
74
{
75
"jsonrpc": "2.0",
76
"result": "0xff0c4b603a2ae5ba50f658e0d0188210a5afeec559e44df29b55806342fa4563",
77
"id": 1234
78
}
Copied!
setGovernanceVariables
Description
Change Governance variables used in network operation. You can only change it once per term. Other items besides irep may be added later.
Usage
1
usage: preptools setGovernanceVariables [-h] [--url URL] [--nid NID]
2
[--config CONFIG] [--yes] [--verbose]
3
[--password PASSWORD]
4
[--keystore KEYSTORE]
5
[--step-limit-s STEP_LIMIT] --irep
6
IREP
7
8
optional arguments:
9
-h, --help show this help message and exit
10
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
11
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
12
--config CONFIG, -c CONFIG
13
preptools config file path
14
--yes, -y Don't want to ask send transaction.
15
--verbose, -v Verbose mode
16
--password PASSWORD, -p PASSWORD
17
keystore password
18
--keystore KEYSTORE, -k KEYSTORE
19
keystore file path
20
--step-limit-s STEP_LIMIT
21
step limit to set
22
--irep IREP amounts of irep
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
network id
-c, --config
./preptools_config.json
preptools config file path
-p, --password
keystore password
-k, --keystore
keystore file path
-s, --step-limit
0x50000000
step limit to set
--irep
amounts of irep in loop
Examples
1
(venv) $ preptools setGovernanceVariables --irep 50_000_000_000_000_000_000_000
2
> Password:
3
[Request] ======================================================================
4
{
5
"from_": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6",
6
"to": "cx0000000000000000000000000000000000000000",
7
"value": 0,
8
"step_limit": 268435456,
9
"nid": 3,
10
"nonce": null,
11
"version": 3,
12
"timestamp": null,
13
"method": "setGovernanceVariables",
14
"data_type": "call",
15
"params": {
16
"irep": "0xa968163f0a57b400000"
17
}
18
}
19
20
> Continue? [Y/n]
21
request success.
22
[Response] =====================================================================
23
{
24
"jsonrpc": "2.0",
25
"result": "0xc15b6989cd39e01b3d4bb65b72e6f7fcbc009020779b7f9fc60d59da4df7b091",
26
"id": 1234
27
}
Copied!

Preptools information commands

Commands that show the P-Rep information. There are two commands preptools getPRep and preptools getPReps.
getPRep
Description
Inquire P-Rep information
Usage
1
usage: preptools getPRep [-h] [--url URL] [--nid NID] [--config CONFIG]
2
address
3
4
positional arguments:
5
address Address of P-Rep you are looking for
6
7
optional arguments:
8
-h, --help show this help message and exit
9
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
10
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
11
--config CONFIG, -c CONFIG
12
preptools config file path
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
network id
-c, --config
./preptools_config.json
preptools config file path
address
Address of P-Rep you are looking for
Examples
1
(venv) $ preptools getPRep hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6
2
[Request] ======================================================================
3
{
4
"from_": "hx1234567890123456789012345678901234567890",
5
"to": "cx0000000000000000000000000000000000000000",
6
"method": "getPRep",
7
"params": {
8
"address": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d4e6"
9
}
10
}
11
12
request success.
13
[Response] =====================================================================
14
{
15
"jsonrpc": "2.0",
16
"result": {
17
"status": "0x1",
18
"grade": "0x2",
19
"name": "kokoa node",
20
"country": "USA",
21
"city": "New York",
22
"stake": "0x0",
23
"delegated": "0x0",
24
"totalBlocks": "0x0",
25
"validatedBlocks": "0x0",
26
"irep": "0xa968163f0a57b400000",
27
"irepUpdateBlockHeight": "0x58f",
28
"lastGenerateBlockHeight": "-0x1",
29
"email": "[email protected]",
30
"website": "https://icon.kokoa.com",
31
"details": "https://icon.kokoa.com/json",
32
"p2pEndpoint": "node.example.com:7100",
33
"nodeAddress": "hxef73db5d0ad02eb1fadb37d0041be96bfa56d400"
34
},
35
"id": 1234
36
}
Copied!
getPReps
Description
Get live status of all registered P-Rep candidates
Usage
1
usage: preptools getPReps [-h] [--url URL] [--nid NID] [--config CONFIG]
2
[--start-ranking START_RANKING]
3
[--end-ranking END_RANKING]
4
[--block-height BLOCK_HEIGHT]
5
6
optional arguments:
7
-h, --help show this help message and exit
8
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
9
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
10
--config CONFIG, -c CONFIG
11
preptools config file path
12
--start-ranking START_RANKING
13
Get P-Rep list which starts from start ranking
14
--end-ranking END_RANKING
15
Get P-Rep list which ends with end ranking, inclusive
16
--block-height BLOCK_HEIGHT
17
Block height which ranking formed
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
network id
-c, --config
./preptools_config.json
preptools config file path
--start-ranking
Get P-Rep list which starts from start ranking
--end-ranking
Get P-Rep list which ends with end ranking, inclusive
--block-height
Block height which ranking formed
Examples
1
(venv) $ preptools getPReps
2
[Request] ======================================================================
3
{
4
"from_": "hx1234567890123456789012345678901234567890",
5
"to": "cx0000000000000000000000000000000000000000",
6
"method": "getPReps",
7
"params": null
8
}
9
10
request success.
11
[Response] =====================================================================
12
{
13
"jsonrpc": "2.0",
14
"result": {
15
"blockHeight": "0x1e3f3",
16
"startRanking": "0x0",
17
"totalDelegated": "0x0",
18
"totalStake": "0x0",
19
"preps": [
20
{
21
"name": "Banana node",
22
"country": "USA",
23
"city": "New York",
24
"grade": "0x0",
25
"address": "hx8f21e5c54f006b6a5d5fe65486908592151a7c57",
26
"irep": "0xc350",
27
"irepUpdateBlockHeight": "0x1200",
28
"lastGenerateBlockHeight": "-0x1",
29
"stake": "0x21e19e0c9bab2400000",
30
"delegated": "0x204fce5e3e25026110000000",
31
"totalBlocks": "0x2710",
32
"validatedBlocks": "0x2328"
33
},
34
...
35
]
36
},
37
"id": 1234
38
}
39
40
41
(venv) $ preptools getPReps --start-ranking "0x1" --end-ranking "0x8" --block-height "0x1234"
42
[Request] ======================================================================
43
{
44
"from_": "hx1234567890123456789012345678901234567890",
45
"to": "cx0000000000000000000000000000000000000000",
46
"method": "getPReps",
47
"params": {
48
"startRanking": "0x1",
49
"endRanking": "0x8",
50
"blockHeight": "0x1234"
51
}
52
}
53
54
request success.
55
[Response] =====================================================================
56
{
57
"jsonrpc": "2.0",
58
"result": {
59
"blockHeight": "0x1e452",
60
"startRanking": "0x0",
61
"totalDelegated": "0x0",
62
"totalStake": "0x0",
63
"preps": [
64
{
65
"name": "Banana node",
66
"country": "USA",
67
"city": "New York",
68
"grade": "0x0",
69
"address": "hx8f21e5c54f006b6a5d5fe65486908592151a7c57",
70
"irep": "0xc350",
71
"irepUpdateBlockHeight": "0x1200",
72
"lastGenerateBlockHeight": "-0x1",
73
"stake": "0x21e19e0c9bab2400000",
74
"delegated": "0x204fce5e3e25026110000000",
75
"totalBlocks": "0x2710",
76
"validatedBlocks": "0x2328"
77
},
78
...
79
]
80
},
81
"id": 1234
82
}
Copied!

Network Proposal commands

There are 3 commands to network-proposal: registerProposal, cancelProposal and voteProposal Whenever the commands are called, they load the configuration from preptools_config.json. In order to use other configuration file, please specify the file location with the -c option.
registerProposal
Description
Register Network-proposal
Usage
1
usage: preptools registerProposal [-h] [--url URL] [--nid NID]
2
[--config CONFIG] [--yes] [--verbose]
3
[--password PASSWORD] [--keystore KEYSTORE]
4
[--step-limit-s STEP_LIMIT] --title TITLE
5
--desc DESC --type TYPE
6
[--value-value VALUE_VALUE]
7
[--value-code VALUE_CODE]
8
[--value-name VALUE_NAME]
9
[--value-address VALUE_ADDRESS]
10
[--value-type VALUE_TYPE]
11
12
optional arguments:
13
-h, --help show this help message and exit
14
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
15
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
16
--config CONFIG, -c CONFIG
17
preptools config file path
18
--yes, -y Don't want to ask send transaction.
19
--verbose, -v Verbose mode
20
--password PASSWORD, -p PASSWORD
21
keystore password
22
--keystore KEYSTORE, -k KEYSTORE
23
keystore file path
24
--step-limit-s STEP_LIMIT
25
step limit to set
26
--title TITLE Proposal title
27
--desc DESC Proposal description
28
--type TYPE type of Proposal
29
--value-value VALUE_VALUE
30
type 0:text message, type 4:step price in loop
31
(required when type 0 or 4)
32
--value-code VALUE_CODE
33
revision code (required when type 1)
34
--value-name VALUE_NAME
35
icon-service version (required when type 1)
36
--value-address VALUE_ADDRESS
37
type 2: address of SCORE, type 3: address of main/sub
38
P-Rep (required when type 2 or 3)
39
--value-type VALUE_TYPE
40
0 : freeze, 1 : unfreeze (required when type 2)
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
networkId mainnet(1), testnet(2)
--config
configuration file path.
-y, --yes
Do not confirm if you want to send request
-v, --verbose
verbose mode flag
-p, --password
Keystore file's password
-k, --keystore
keystore file path
-s, --step-limit
0x50000000
step limit to set
--title
title of network-proposal
--desc
description of network-proposal
--type
type of network-proposal(0,1,2,3,4)
--value-value
value of value field
--value-code
value of code field
--value-address
value of address field
--value-type
value of type field
Examples
1
(venv)$ preptools registerProposal -c preptools_config.json -k prep_keys0 -p qwer1234% --title pro0 --desc "first proposal" --type 4 --value-value 1234
2
[Value] ========================================================================
3
{
4
"value": "1234"
5
}
6
[Request] ======================================================================
7
{
8
"from_": "hxb74e29fba1809a105fdec433040a4e713bbe91fe",
9
"to": "cx0000000000000000000000000000000000000001",
10
"value": 0,
11
"step_limit": 268435456,
12
"nid": 3,
13
"nonce": null,
14
"version": 3,
15
"timestamp": null,
16
"method": "registerProposal",
17
"data_type": "call",
18
"params": {
19
"title": "pro0",
20
"description": "first proposal",
21
"type": "0x4",
22
"value": "0x7b2276616c7565223a202231323334227d"
23
}
24
}
25
26
> Continue? [Y/n]Y
27
request success.
28
[Response] =====================================================================
29
{
30
"jsonrpc": "2.0",
31
"result": "0x02221f9346f9c9b3322ea33e67a1ca0fbe9491e0ea3aefb5154a43e2ea829fa4",
32
"id": 1234
33
}
Copied!
voteProposal
Description
Vote Network-proposal
Usage
1
usage: preptools voteProposal [-h] [--url URL] [--nid NID] [--config CONFIG]
2
[--yes] [--verbose] [--password PASSWORD]
3
[--keystore KEYSTORE]
4
[--step-limit-s STEP_LIMIT] --id ID --vote VOTE
5
6
optional arguments:
7
-h, --help show this help message and exit
8
--url URL, -u URL node url default(http://127.0.0.1:9000/api/v3)
9
--nid NID, -n NID networkId default(3) ex) mainnet(1), testnet(2)
10
--config CONFIG, -c CONFIG
11
preptools config file path
12
--yes, -y Don't want to ask send transaction.
13
--verbose, -v Verbose mode
14
--password PASSWORD, -p PASSWORD
15
keystore password
16
--keystore KEYSTORE, -k KEYSTORE
17
keystore file path
18
--step-limit-s STEP_LIMIT
19
step limit to set
20
--id ID hash of registerProposal TX
21
--vote VOTE 0 : disagree, 1 : agree
Copied!
Options
shorthand, Name
default
Description
-h, --help
show this help message and exit
-u, --url
node url
-n, --nid
3
networkId mainnet(1), testnet(2)
--config
configuration file path.
-v, --verbose
verbose mode flag
-y, --yes
Do not confirm if you want to send request
-p, --password
password of keystore file
-k, --keystore
path of keystore file
-s, --step-limit
0x50000000
step limit to set
--id
id of network-proposal to vote
--vote
voting value(0: disagree, 1: agree)
Examples
1