Client configuration

A complete reference of the client configurations is described on this page.

For more information on how to create and use a custom configuration for the client, please check out the guide Blockchain client configuration.

Default Configuration

The default configuration used to initialize new blockchain clients with Klayr Commander can be found here: config.ts

The configuration schema can be found at client config schema

Client config reference

The following sections describe all configuration categories and their available options.

genesis

The genesis configuration holds the settings for the blockchain protocol.

The genesis configurations should only be changed by the blockchain developer, and not by the node operator! If a node operator changes any of the genesis configurations, it might cause the node to fork.
  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

block

object

optional

This is the first block of a chain.

"block": {
	"fromFile": "./config/genesis_block.blob'",
	"blob": "<<Hex of encoded genesis block>>",
},

chainID

string

mandatory

Represents a 4-byte hex string that identifies each chain in the Klayr ecosystem. The length of the hex string should be 8 characters.

00000000

maxTransactionsSize

number

mandatory

The maximum transaction size (kilobytes) allowed in a block.

15 * 1024

blockTime

number

mandatory

The frequency of blocks to be created.

7

bftBatchSize

number

mandatory

The length of a round for block generation.

53

const customConfig =
{
	// Other types of configurations.
	"genesis": {
		"block": {
			"fromFile": "./config/genesis_block.blob",
			"blob": "<<Hex of encoded genesis block>>",
		},
		"chainID": "00000000",
		"maxTransactionsSize": 15 * 1024, // Kilo Bytes
		"blockTime": 10,
		"bftBatchSize": 103,
	},
	// Other types of configurations.
}

network

The network category contains the following configuration options:

  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

version

string

optional

The version of network protocol.

1.0

port

number

optional

The port defines an open port for P2P incoming connections.

7667

seedPeers

object[]

mandatory

SeedPeers defines an entry point of the network.

"seedPeers": [{
	"ip": "127.0.0.1",
	"port": 5000
}]

host

string

optional

Address of the server to connect to.

127.0.0.1

blacklistedIPs

string[]

optional

A list of IP addresses for which the node will reject the connection for both outbound and inbound connections.

192.168.178.23

fixedPeers

object[]

optional

A set of peers to which a node will always try to connect, for outbound connections.

"fixedPeers": [{
	"ip": "192.110.01.12",
	"port": 5000
}]

whitelistedPeers

object[]

optional

Set of peers that are always allowed to connect to the node through inbound connections.

"whitelistedPeers": [{
	"ip": "192.110.01.12",
	"port": 5000
}]

maxOutboundConnections

number

optional

The maximum number of outbound connections allowed.

20[1]

maxInboundConnections

number

optional

The maximum number of inbound connections allowed.

100[1]

wsMaxPayload

number

optional

The maximum size of the payload allowed per communication.

3048576[1]

advertiseAddress

boolean

optional

Defines whether to announce the IP/Port to other peers.

true[1]

const customConfig =
{
	// Other types of configurations.
	"network": {
		"version": "1.0",
		"seedPeers": [
			{
				"ip": "127.0.0.1",
				"port": 5000
			}
		],
		"port": 7667,
		"host": "127.0.0.1",
		"blacklistedIPs": [
			"172.112,31.0",
			"172.112,31.2"
		],
		"fixedPeers": [
			{
				"ip": "192.110.01.12",
				"port": 5000
			},
		],
		"whitelistedPeers": [
			{
				"ip": "192.110.01.12",
				"port": 5000
			},
		],
		"maxOutboundConnections": 20,
		"maxInboundConnections": 100,
		"wsMaxPayload": 3048576,
		"advertiseAddress": true,
		},
	// Other types of configurations.
}
The connectivity of the node might be negatively impacted if the fixedPeers configuration is used. Beware of declaring only trustworthy peers in whitelistedPeers as these could attack a node with a denial-of-service attack because the banning mechanism is deactivated.

rpc

Apps on Klayr can communicate with a node via the rpc communication protocol.

  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

modes

array

mandatory

Modes of communication between klayr node and external services.

IPC, WS, HTTP

port

number

mandatory

Port to be used for a 'WS' connection.

7887

host

string

mandatory

Address of the server to connect.

127.0.0.1

allowedMethods

array

optional

Allowed methods for the node to use. Add the namespace, to allow all endpoints of namespace, or namespace_endpointName to allow a specific endpoint. [*] allows all methods, [] none.

["generator", "system", "random"]

accessControlAllowOrigin

string

optional

Defines the Access Control Allow Origin for RPC requests.

"*"

const customConfig =
{
	// Other types of configurations.
	"rpc": {
		"modes": ["IPC"],
		"port": 7887,
		"host": "127.0.0.1",
	},
	// Other types of configurations.
}

system

The system configuration holds settings for the node.

  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

version

string

mandatory

The version of the system.

1.0

dataPath

string

mandatory

DataPath defines the folder path for the client application data.

~/.klayr/beta-sdk-app

keepEventsForHeights

number

mandatory

Defines the number of blocks for which the events should be maintained by the system. Usually, the events are based on the latest, given number of blocks.

300[1]

logLevel

string

mandatory

Level of the log to be maintained.

info

enableMetrics

boolean

optional

Tracks certain events in the system. If enabled, metrics can be queried via the system_getMetricReport endpoint. For development purposes.

false

const customConfig =
{
	// Other types of configurations.
	"system": {
		"version": "1.0",
		"dataPath": "~/.klayr/beta-sdk-app",
		"keepEventsForHeights": 300,
		"logLevel": "info",
	},
	// Other types of configurations.
}

modules

modules contains the module-specific configuration options for the blockchain client.

The module configurations should only be changed by the blockchain developer, and not by the node operator! If a node operator changes any of the module-specific configurations, it might cause the node to fork.

Please check the available documentation for the respective module to learn about the available configuration options.

plugins

plugins contains the plugin-specific configuration options for the blockchain client.

Please check the available documentation for the respective plugin to learn about the available configuration options.

Optional configurations

generator

The generator configuration is used to read validator keys from a file, which are then stored in the database.

  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

keys

object

optional

Contains a path to the "keys" file of a generator/validator.

{"fromFile": "keys.json"}
const customConfig =
{
	// Other types of configurations.
	"generator": {
		"keys": {
			"fromFile": "keys.json",
		},
	},
	// Other types of configurations.
}

legacy

The legacy category contains the following configuration options:

  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

sync

boolean

optional

Boolean if it will sync the legacy blocks or not.

true

brackets

array

mandatory

Brackets specify the blocks of previous legacy blockchains. For example, in Klayr Core v4, it will store the height from Core v3 where it starts from, and where it ended.

[
    {
       "startHeight":1,
       "snapshotHeight":123,
       "snapshotBlockID":
	   "0f4ea1c3cfb61b99d38
	   7b26aaadf57936a528e
	   5c713c6e55aa06f4d62
	   1b7e6f0"
    }
]
const customConfig =
{
	// Other types of configurations.
	"legacy": {
		"sync": true,
		"brackets": [{"startHeight": 1,"snapshotHeight": 123,"snapshotBlockID": "0f4ea1c3cfb61b99d387b26aaadf57936a528e5c713c6e55aa06f4d621b7e6f0"}]
	},
	// Other types of configurations.
}

transactionPool

This type of configuration holds the settings for the transaction pool.

  • Properties

  • Sample

Property’s Name Datatype Optionality Description Sample

maxTransactions

number

optional

The maximum number of transactions in the pool.

4096

maxTransactionsPerAccount

number

optional

The maximum number of transactions in the pool per sender account.

64

transactionExpiryTime

number

optional

Defines the timeout (milliseconds) of the transaction in the pool.

3 * 60 * 60 * 1000

minEntranceFeePriority

string

optional

The minimum fee required for a transaction to be added to the transaction pool.

0

minReplacementFeeDifference

string

optional

The difference of minimum fee required to replace a transaction with the same nonce

10

const customConfig =
{
	// Other types of configurations.
	"transactionPool": {
		"maxTransactions": 4096,
		"maxTransactionsPerAccount": 64,
		"transactionExpiryTime": 3 * 60 * 60 * 1000,
		"minEntranceFeePriority": "0",
		"minReplacementFeeDifference": "10",
	},
	// Other types of configurations.
}

1. This is the default value.