This page explains the configuration of SCNs to form a consensus network.
If you installed archive distribution, you can find the binaries and the config file in the directories you extracted the archives. Below is an example of command execution.
Please change the chainID in the genesis file. Use your own number to prevent a replay attack. (Do not use the same chainID with Klaytn Cypress (8217) and Baobab (1001))
If you want, you can change the pre-funded addresses by editing "alloc" in the genesis file. (You can find more details in Genesis JSON.)
SCN Data Directory Creation
Considering the fact that the size of Klaytn blockchain data keeps increasing, it is recommended to use a big enough storage. You can create the data directory on your desired path. In this document, we create ~/kscnd_home as a data directory.
$mkdir-p~/kscnd_home
Initialization of a Genesis Block
After that, you can initialize the data directory with the genesis file. Before starting a service chain node, it is necessary to initialize the genesis block of the service chain network using kscn and genesis.json.
$kscninit--datadir~/kscnd_homehomi-output/scripts/genesis.jsonWARN[11/12,10:13:58+09] [19] Some input value of genesis.json have been set to default or changedINFO[11/12,10:13:58+09] [18] Setting connection type nodetype=cn conntype=0...INFO[11/12,10:13:59+09] [5] Using DeriveShaConcat!INFO[11/12,10:13:59+09] [5] Writing custom genesis blockINFO[11/12,10:13:59+09] [5] Using DeriveShaConcat!INFO[11/12,10:13:59+09] [47] Persisted trie from memory database updated nodes=1updatednodessize=80.00Btime=304.931µsgcnodes=0gcsize=0.00Bgctime=0slivenodes=1livesize=0.00BINFO[11/12,10:13:59+09] [19] Successfully wrote genesis state database=lightchaindata hash=0xc269669079fc8c06ac37435a563b8ed8ef273c1c835f3d823d2e586315319aa8INFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/headerINFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/bodyINFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/receiptsINFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/statetrie/0INFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/statetrie/1INFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/statetrie/2INFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/statetrie/3INFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/txlookupINFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/miscINFO[11/12,10:13:59+09] [46] Database closed path=/Users/ethan/kscnd_home/klay/lightchaindata/bridgeservice
Install nodekey
Copy homi-output/keys/nodekey1 to the klay directory in the SCN's data directory like below.
Assume that the SCN uses the default port and mounts a large-scale partition onto ~/kscnd_home. In the default kscnd.conf file, SC_SUB_BRIDGE option is disabled and DATA_DIR is empty.
# Configuration file for the kscnd
...
SC_SUB_BRIDGE=0
...
DATA_DIR=
...
You can enable SC_SUB_BRIDGE to use the Anchoring/Value transfer feature. Also you should set the DATA_DIR like below.
# Configuration file for the kscnd
...
SC_SUB_BRIDGE=1
...
DATA_DIR=~/kscnd_home
...
If you want, you can further modify other options to customize your Service Chain. Otherwise, now you can finish the configuration and you are ready to run the service chain using the default configuration.