Introduction
Klaytn uses a tiered network architecture where the inner tier — Consensus Node Network (CNN) — is separated from the outer tier — Endpoint Node Network (ENN). While CNN focuses on block generation, ENN propagates blocks and accepts user transactions. Users send transactions to an EN. While not all ENs are publicly available, one may need to run his/her own EN to connect to the Klaytn blockchain network.
As explained in another thread, anyone can run an EN to connect to Klaytn. This topic lists everything you need to know about running your own EN.
- Minimum and recommended hardware spec
- Installation
- Pre-download blocks and start a local EN
- Joining ENN
1. Minimum and recommended hardware spec
Klaytn Docs states an EN should run on computing hardware equivalent to the following spec (in case you are interested, here’s the link).
vCPU | Memory (GiB) | Storage (GiB) | EBS Bandwidth (Gbps) | Network Bandwidth (Gbps) |
---|---|---|---|---|
8 | 32 | EBS-only | 3,500 | Up to 10 |
The hardware spec above should be considered as minimum spec although stated as recommended in the docs. Here’s the recommended spec:
vCPU | Memory (GiB) | Storage (GiB) | EBS Bandwidth (Gbps) | Network Bandwidth (Gbps) |
---|---|---|---|---|
16 | 64 | EBS-only, SSD (gp2) | 3,500 | Up to 10 |
The reason Klaytn EN requires high computing power is that Klaytn generates a block for every second and ENs should keep synchronized themselves by downloading, validating, and storing blocks. Recent study reveals that 8 vCPU with 32 GB memory introduces delays in synchronization when there are transaction spikes.
Why do we need many cores? Block validation is a resource-consuming task since it requires an EN to validate all transactions included in every block. Validation largely takes in two parts: signature verification and EVM execution. While adding little value to EVM execution due to its sequential execution constraint, having multiple cores significantly improves validation throughput since Klaytn handles signature verification concurrently.
You can also run a physical server on your own with comparable hardware listed above.
2. Installation
Download
Visit here to download Klaytn EN binary. Make sure you download the right binary based on the target network and the OS you use.
Install
Installation is straight forward. For the tar ball, simply unpack. The tree structure of the extracted files is as follows:
.
├── bin
│ ├── ken
│ └── kend
└── conf
└── kend_baobab.conf
DO NOT alter the directory structure of the extracted files; EN will not function as expected if you do. Optionally, add the bin
directory of the extracted outcome to $PATH
for your convenience.
If you downloaded rpm
file, then run yum install
to install the RPM distribution. The installed binary will be located at /usr/bin/ken
and the configuration file will be created at /etc/kend/conf/kend.conf
.
Configure
When running kend
, you can configure EN by editing conf/kend_baobab.conf
(or /etc/kend/conf/kend.conf
depending on your installation choice). You can refer to this page for the configurable properties.
For those of you wishing to use ken
, you can configure your node by adding command line arguments — the configuration file does not affect your node at all.
3. Pre-download blocks and start a local EN
Fast Sync
It is absolutely important to keep your EN synced at all times. However, if you just started an EN, then there are more than 19 million blocks to download (as of Feb 7, 2020). Downloading them all via P2P network will be extremely slow. So I recommend using Fast Sync to reduce the syncing time on first start.
Fast Sync requires a Klaytn blockchain snapshot to sync with. This is called chaindata snapshot. Download the latest chaindata snapshot from the Cypress snapshot archive or Baobab snapshot archive. Extract the downloaded snapshot inside the DATA_DIR you configured in kend.conf
.
Start a Node
We recommend using kend
to run your node. Staring and stopping kend
is simple:
$ kend start
Staring kend: OK
$ kend stop
Shutting down kend: Killed
By default, RPC is enabled on port 8551 for klay
API
4. Joining ENN
When running kend
you can choose which network to connect by indicating NETWORK
or, alternatively, NETWORK_ID
in the configuration file. NETWORK_ID
is only required if you do not specify NETWORK
. Here’s a list of values you can use for each network:
Baobab testnet
NETWORK='baobab'
NETWORK_ID=1001
Cypress mainnet
NETWORK='cypress'
NETWORK_ID=8217
If you do not indicate NETWORK
and assign NETWORK_ID
that is different from pre-configured values, then you can start a local private network of your own.
Conclusion
That’s a wrap! Now you have a fully functioning EN that can download blocks and send transactions. Please feel free to ask questions about EN in the comment section