Config.json complete reference for v1.0 [EN]

Reference: https://github.com/nknorg/nkn/blob/master/config/config.go

type Configuration struct {
	Version                      int           `json:"Version"`
	SeedList                     []string      `json:"SeedList"`
	HttpWssDomain                string        `json:"HttpWssDomain"`
	HttpWssCert                  string        `json:"HttpWssCert"`
	HttpWssKey                   string        `json:"HttpWssKey"`
	HttpWsPort                   uint16        `json:"HttpWsPort"`
	HttpWssPort                  uint16        `json:"HttpWssPort"`
	HttpJsonPort                 uint16        `json:"HttpJsonPort"`
	HttpsJsonDomain              string        `json:"HttpsJsonDomain"`
	HttpsJsonCert                string        `json:"HttpsJsonCert"`
	HttpsJsonKey                 string        `json:"HttpsJsonKey"`
	HttpsJsonPort                uint16        `json:"HttpsJsonPort"`
	DefaultTlsCert               string        `json:"DefaultTlsCert"`
	DefaultTlsKey                string        `json:"DefaultTlsKey"`
	DefaultTlsDomainTmpl         string        `json:"DefaultTlsDomainTmpl"`
	ACMEUserFile                 string        `json:"ACMEUserFile"`
	ACMEResourceFile             string        `json:"ACMEResourceFile"`
	CertRenewBefore              uint16        `json:"CertRenewBefore"`   //in hours
	CertCheckInterval            time.Duration `json:"CertCheckInterval"` // in seconds
	CertDirectory                string        `json:"CertDirectory"`
	NodePort                     uint16        `json:"-"`
	LogLevel                     int           `json:"LogLevel"`
	MaxLogFileSize               uint32        `json:"MaxLogSize"`
	MaxLogFileTotalSize          uint32        `json:"MaxLogFileTotalSize"`
	GenesisBlockProposer         string        `json:"GenesisBlockProposer"`
	NumLowFeeTxnPerBlock         uint32        `json:"NumLowFeeTxnPerBlock"`
	LowFeeTxnSizePerBlock        uint32        `json:"LowFeeTxnSizePerBlock"` // in bytes
	MinTxnFee                    int64         `json:"MinTxnFee"`
	RegisterIDRegFee             int64         `json:"RegisterIDRegFee"`
	RegisterIDTxnFee             int64         `json:"RegisterIDTxnFee"`
	Hostname                     string        `json:"Hostname"`
	Transport                    string        `json:"Transport"`
	NAT                          bool          `json:"NAT"`
	Mining                       bool          `json:"Mining"`
	MiningDebug                  bool          `json:"MiningDebug"`
	BeneficiaryAddr              string        `json:"BeneficiaryAddr"`
	SyncHeaderMaxSize            uint32        `json:"SyncHeaderMaxSize"`
	SyncHeaderMaxMemorySize      uint32        `json:"SyncHeaderMaxMemorySize"`
	SyncBatchWindowSize          uint32        `json:"SyncBatchWindowSize"`
	SyncBlockHeadersBatchSize    uint32        `json:"SyncBlockHeadersBatchSize"`
	SyncBlocksBatchSize          uint32        `json:"SyncBlocksBatchSize"`
	SyncBlocksMaxMemorySize      uint32        `json:"SyncBlocksMaxMemorySize"` // in megabytes (MB)
	NumTxnPerBlock               uint32        `json:"NumTxnPerBlock"`
	TxPoolPerAccountTxCap        uint32        `json:"TxPoolPerAccountTxCap"`
	TxPoolTotalTxCap             uint32        `json:"TxPoolTotalTxCap"`
	TxPoolMaxMemorySize          uint32        `json:"TxPoolMaxMemorySize"` // in megabytes (MB)
	RPCReadTimeout               time.Duration `json:"RPCReadTimeout"`      // in seconds
	RPCWriteTimeout              time.Duration `json:"RPCWriteTimeout"`     // in seconds
	RPCIdleTimeout               time.Duration `json:"RPCIdleTimeout"`      // in seconds
	RPCKeepAlivesEnabled         bool          `json:"RPCKeepAlivesEnabled"`
	NATPortMappingTimeout        time.Duration `json:"NATPortMappingTimeout"` // in seconds
	LogPath                      string        `json:"LogPath"`
	ChainDBPath                  string        `json:"ChainDBPath"`
	WalletFile                   string        `json:"WalletFile"`
	MaxGetIDSeeds                uint32        `json:"MaxGetIDSeeds"`
	DBFilesCacheCapacity         uint32        `json:"DBFilesCacheCapacity"`
	AllowEmptyBeneficiaryAddress bool          `json:"AllowEmptyBeneficiaryAddress"`
	WebGuiListenAddress          string        `json:"WebGuiListenAddress"`
	WebGuiPort                   uint16        `json:"WebGuiPort"`
	WebGuiCreateWallet           bool          `json:"WebGuiCreateWallet"`
	PasswordFile                 string        `json:"PasswordFile"`
	StatePruningMode             string        `json:"StatePruningMode"`
	RecentStateCount             uint32        `json:"RecentStateCount"`
	RecentBlockCount             uint32        `json:"RecentBlockCount"`
	MinPruningCompactHeights     uint32        `json:"MinPruningCompactHeights"`
	RPCRateLimit                 float64       `json:"RPCRateLimit"` // requests per second
	RPCRateBurst                 uint32        `json:"RPCRateBurst"`
	SyncBlockHeaderRateLimit     float64       `json:"SyncBlockHeaderRateLimit"` // headers per second
	SyncBlockHeaderRateBurst     uint32        `json:"SyncBlockHeaderRateBurst"`
	SyncBlockRateLimit           float64       `json:"SyncBlockRateLimit"` // blocks per second
	SyncBlockRateBurst           uint32        `json:"SyncBlockRateBurst"`
	BlockHeaderCacheSize         uint32        `json:"BlockHeaderCacheSize"`
	SigChainCacheSize            uint32        `json:"SigChainCacheSize"`
	SyncMode                     string        `json:"SyncMode"`
	MaxRollbackBlocks            uint32        `json:"MaxRollbackBlocks"`
}

Configuration options

  • SeedList

Before a new node can join NKN network, it needs to acquire neighbor information from any of the existing live nodes in NKN network
When nknd is initiated, it will randomly pick a seed node, and send request to that seed node to get its neighbor list
Any live node can become seed node for others. NKN project team provide 8 seed nodes that can run stably for long period of time.

  • IsTLS

If HttpJson RPC service is using TLS for connection

  • HttpJsonPort

NKN’s designated port for HttpJson service, and its default value is 30003.

  • RPCCert、RPCKey

When HttpJson is using TLS connection, RPCCert is the certificate while RPCKey is the private key.

  • HttpWsPort

NKN’s designated port for WebSocket service, and its default value is 30002. If the last 3 digits of port is 440 (for example 30443), then it is TLS connection.

  • NodePort

nkn network overlay portand its default value is 30001

  • LogLevel

Level of logging: [0:Debug, 1:Info, 2:Warning, 3:Error]

  • MaxLogSize

The maximum log file size before a new log file is created.
unit in MBand its default value is 20MB

  • GenesisBlockProposer

Public key of the designated generis block proposer, default value is the public key of NKN developer team.

  • NumLowFeeTxnPerBlock

The number of low fee transactions that miners are willing to include within each block. 0 means there is no limit, and the default value is 0.

  • LowFeeTxnSizePerBlock

The max allowed size (in Bytes) per block for all the low fee transactions. 0 means there is no limit. Default value is 4096.

  • MinTxnFee

The minimum acceptable fee (in NKN) per transaction for this node. If the fees included in the transaction is lower than this, this transaction will not be included in the block. Default value is 0.1.

  • RegisterIDRegFee

The amount registration fee this node is willing to pay for GenerateID. The default value is 0.

  • RegisterIDTxnFee

The amount transaction fee this node is willing to accept for including this GenerateID into the block. The default value is 0.

  • Hostname

Designated public IP address of this node. Upon bootup, the node will use external service to find out own public IP address. Default value is empty.
If you want to run a local testnet with a single machine, Hostname should be set to “127.0.0.1”

  • NAT

Whether automatic port forwarding is enabled (requires home router to support UPnP and PMP functionality). Default value is True.

  • Mining

On/Off switch for enabling/disabling mining. Default value is True.

  • Transport

Whether use tcp or udp for socket connection. Default value is “tcp”.

  • MiningDebug

Whether to display node’s current timestamp and proposalSubmitted in getnodestate API. It will help debug Mining issues. Default value is True.

  • BeneficiaryAddr

Configure the wallet address that will receive mining rewards. This will enable the decoupling of miner wallet and asset holding wallet, thus improving security.
If this configuration is not empty, all mining reward will go to BeneficiaryAddr wallet address. Otherwise the mining reward will go to local mining wallet. Default value is empty.

  • SyncMode

Define if it is “full”, “light”, or “fast” synchronization. Default is “full”.

  1. Fast sync: node will sync the same full block history as before, but much faster by syncing the state trie directly. Think of it as a decentralized replacement of the ChainDB snapshot that many people are using.
  2. Light sync: node will only sync headers of old blocks without transactions. The local ledger size will be much smaller than before (ChainDB size is about 4GB at the time of the release), but node will not be able to respond to getblock and gettransaction RPC requests for old blocks/transactions. We recommend using light sync only when node disk space is not enough.
  • SyncBatchWindowSize

During initial synchronization of blockchain data, the number of concurrent job threads. default value is 1024.
The higher the window size, the faster the initial synchronization speed.
However on smaller devices built with less RAM, smaller window size is recommended to avoid out of memory errors during initial synchronization.

  • SyncBlockHeadersBatchSize

During blockchain data synchronization, the number of BlockHeaders each job thread will fetch. Default value is 256.

  • SyncBlocksBatchSize

During blockchain data synchronization, the number of Blocks each job thread will fetch. Default value is 8.

  • NumTxnPerBlock

Maximum amount of transactions per block. Default value is 4096.

  • TxPoolPerAccountTxCap

Maximum amount of transactions per account in the transaction pool. Default value is 32.

  • TxPoolTotalTxCap

Maximum amount of total transactions from all accounts in the transaction pool. 0 means there is no limit. Default value is 0.

  • TxPoolMaxMemorySize

Maximum size (in Mega Bytes or MB) of total transactions from all accounts in the transaction pool. 0 means there is no limit. Default value is 32 (MB).

  • RPCReadTimeoutRPCWriteTimeoutKeepAliveTimeout

Timeout intervals for Read, Write and KeepAlive of HttpJson service

3 Likes