Connect to main chain
In this page, we will describe the steps of connecting a Service Chain to the Main Chain.
EN Configuration - Enable Main-bridge
You should enable main-bridge by configuring kend.conf
.
Update the Configuration File
The kend.conf
contains the following main-bridge properties.
Name | Description |
---|---|
MAIN_BRIDGE | Enable bridge service as main bridge for service chain. 1 to enable. |
MAIN_BRIDGE_PORT | Bridge listen port. Default: 50505 |
MAIN_BRIDGE_INDEXING | Enable indexing of service chain transaction hash for fast access to the service chain data. 1 to enable. |
To enable main-bridge on EN, you should do like below.
- define
MAIN_BRIDGE
- enable RPC/WS.
- add
mainbridge
API for RPC like the below example.
# Configuration file for the kend...# rpc options settingRPC_ENABLE=1 # if this is set, the following options will be usedRPC_API="klay,mainbridge" # available apis: admin,debug,klay,miner,net,personal,rpc,txpool,web3,mainbridge,subbridgeRPC_PORT=8551RPC_ADDR="0.0.0.0"RPC_CORSDOMAIN="*"RPC_VHOSTS="*"# ws options settingWS_ENABLE=1 # if this is set, the following options will be usedWS_API="klay" WS_ADDR="0.0.0.0"WS_PORT=8552WS_ORIGINS="*"...# service chain options settingMAIN_BRIDGE=1MAIN_BRIDGE_PORT=50505MAIN_BRIDGE_INDEXING=1...
Connect SCN to the Main Chain
You need to run an EN of the main chain as a main-bridge. And also you should determine which SCN (Service Chain Consensus Node) as a sub-bridge will connect with the EN.
Check EN (Main-Bridge) information
Open EN Console
There are different ways to attach to the EN process. You can check the usable commands on ken CLI commands. This page explains the way to attach to the process via IPC (inter-process communication). The IPC file klay.ipc
is located in the DATA_DIR
path on the node.
Please execute the following command and check out the result. (If you added mainbridge
API for RPC, you can check the bridge API like below. If there is no mainbridge
API, you should check EN Configuration - Enable Main-bridge again. )
$ ken attach --datadir ~/kend_homeWelcome to the Kaia JavaScript console!instance: Kaia/vX.X.X/XXXX-XXXX/goX.X.Xat block: 11573551 (Wed, 13 Feb 2019 07:12:52 UTC) datadir: ~/kend_home modules: admin:1.0 mainbridge:1.0 debug:1.0 istanbul:1.0 klay:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 >