KNI
KNI (Klaytn Network Identifier) is a URL scheme to identify a Klaytn node. Its syntax is shown below:
1
kni://<nodeID>@<hostname>:<port>?subport=<subport>&discport=<discport>
Copied!
KNI scheme
nodeID is a 512-bit public key corresponding to the node's private key. It is used to verify communication with peers on p2p network.
hostname describes the address of a node, located between @ and :. The address format can be one of the following:
    IPv4 dotted decimal (192.0.2.1)
    IPv6 ([2001:db8::68])
    IPv4-mapped IPv6 ([2001:db8:3c4d:15::abcd:ef12])
    Domain name (your.node.com)
port is used to make connections with peer nodes through TCP. In Klaytn, the default port is 32323 and the default subport is 32324. Note that the default subport is configured as port + 1 in kend.conf. Depending on the number of TCP listening ports, Klaytn offers two types of connections.
discport is used for checking if the known neighbors are reachable klaytn nodes and fetching their neighbors' addresses for new connections. Note that this is a UDP port. By default, the UDP port, or discport, uses the same port with the TCP port. If the node uses a different port for discport, it can be specified by the discport query parameter.
The following two URLs shows a KNI example of a node having IP address 10.0.0.1 and TCP listening port 32323 and 32324. If discport is omitted, it is set to the UDP port of 32323, same as the value of port.
1
kni://[email protected]:32323 # either single-channel or multi-channel peer with omitted subport
2
kni://[email protected]:32323?subport=32324 # multi-channel peer
Copied!
The next two shows KNI examples of nodes having discport of 30301.
1
kni://[email protected]:32323?discport=30301 # either single-channel or multi-channel peer with omitted subport
2
kni://[email protected]:32323?subport=32324&discport=30301 # multi-channel peer
Copied!
If you want to know how to generate a KNI of a node, please refer to Node Key & Node URI Creation. The KNI scheme is used in node discovery protocol, setting static-nodes.json file, addPeer API, bootnodes option and etc.
Last modified 6mo ago
Copy link