Skip to main content

Genesis File

This page describes the details of genesis.json file.

Genesis JSON File Structure ​

The genesis.json file structure is described in the following table.

Field NameDescription
configThe blokchain configuration. See the section Config.
nonce(deprecated) This field is derived from the Ethereum, but not used in Klaytn.
timestampThe unix time when a block is created.
extraDataThe data combined field for signer vanity and RLP-encoded istanbul extra data that contains validator list, proposer seal, and commit seals.
gasLimitThe maximum gas amount that used in a block.
difficulty(deprecated) This field is derived from the Ethereum, but not used in Klaytn.
mixhash(deprecated) This field is derived from the Ethereum, but not used in Klaytn.
coinbaseAn address to which miner receives the reward. This field is only used for Clique consensus engine.
allocThe predefined accounts.
numberThe block number field.
gasUsedThe amount of the gas which used for a block.
parentHashThe hash value of the previous block.

Config ​

The config field stores the information related to the chain.

Field NameDescription
chainIdIt identifies the current chain and is used for prevention from the replay attack.
istanbulCompatibleBlockA block number to which istanbul change is applied.
istanbul, cliqueThe type of consensus engine.
unitPriceUnit price.
deriveShaImplDefines a method to generate transaction hash and receipt hash.
governanceGovernance information of the network. See the section Governance

extraData ​

The field extraData is a concatenation of the proposer vanity and the RLP-encoded istanbul extra data:

  • The proposer vanity is 32-byte data which contains arbitrary proposer vanity data.
  • The rest of the data is RLP-encoded istanbul extra data containing:
    • Validators: the list of validators in ascending order.
    • Seal: the proposer signature of the header. For genesis.json, it is a byte array initialized with 65 0x0.
    • CommittedSeal: the list of commitment signature seals as consensus proof. For genesis.json, it is an empty array.

Example

FieldTypeValue
Vanity32-byte hex string0x0000000000000000000000000000000000000000000000000000000000000000
Validators[]address[0x48009b4e20ec72aadf306577cbe2eaf54b0ebb16,0x089fcc42fd83baeee4831319375413b8bae3aceb]
Sealbyte array of 65 elements[0x0,...,0x0]
CommittedSeal[][]byte[]

extraData with the above data is created by


concat('0x',Vanity,RLPEncode({Validators,Seal,CommittedSeal}))

where concat is a string concatenation function, and RLPEncode is a function to convert a given structure to an RLP-encoded string.

With this function, the output extraData for this example is 0x0000000000000000000000000000000000000000000000000000000000000000f86fea9448009b4e20ec72aadf306577cbe2eaf54b0ebb1694089fcc42fd83baeee4831319375413b8bae3acebb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0.

Consensus Engine ​

The available consensus engines for Klaytn network are Clique and Istanbul. Each engine is explained as follows.

Clique ​

The clique field stores the configuration for Proof-Of-Authority (POA) based sealing.

FieldsDescription
periodThe minimum time interval between the consecutive blocks (unit: second).
epochThe number of blocks to reset votes and marked as a checkpoint.

Istanbul ​

The istanbul field stores the configuration for Istanbul based sealing.

FieldsDescription
epochThe number of blocks to reset votes to be a checkpoint.
policyThe block proposer selection policy. [0: Round Robin, 1: Sticky, 2: Weighted Random]
subCommittee size.

Governance ​

The governance field stores governance information for a network.

FieldsDescription
governanceModeOne of three governance modes. [none, single, ballot]
governingNodeDesignated governing node's address. It only works if the governance mode is single.
rewardIt stores the reward configuration. See the section Reward.

Reward ​

The reward field stores the information about the network's token economy.

FieldsDescription
mintingAmountAmount of peb minted when a block is generated. Double quotation marks are needed for a value.
ratioDistribution rate for a CN/KIR/PoC separated by /. The sum of all values has to be 100.
useGiniCoeffUse GINI coefficient or not.
deferredTxFeeA way to distribute TX fee for a block.
stakingUpdateIntervalTime interval in block height to update staking information.
proposerUpdateIntervalTime interval in block height to update proposer information.
minimumStakeMinimum amount of peb to join Core Cell Operators.

Example ​


{
"config": {
"chainId": 2019,
"istanbulCompatibleBlock": 0,
"istanbul": {
"epoch": 604800,
"policy": 2,
"sub": 13
},
"unitPrice": 25000000000,
"deriveShaImpl": 2,
"governance": {
"governingNode": "0x46b0bd6380005952759f605d02a6365552c776f3",
"governanceMode": "single",
"reward": {
"mintingAmount": 6400000000000000000,
"ratio": "50/40/10",
"useGiniCoeff": true,
"deferredTxFee": true,
"stakingUpdateInterval": 86400,
"proposerUpdateInterval": 3600,
"minimumStake": 5000000
}
}
},
"nonce": "0x0",
"timestamp": "0x5c9af60e",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f89af85494aeae0ab623d4118ac62a2decc386949b5ce67ce29446b0bd6380005952759f605d02a6365552c776f394699b607851c878e29499672f42a769b71f74be8e94e67598eb5831164574c876994d53f63eab4f36d7b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0",
"gasLimit": "0xe8d4a50fff",
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0000000000000000000000000000000000000400": {
"code": "0x6080604052600436106101505763ffffffff60e00a165627a7a7230582093756fe617053766b158f7c64998c746eb38f0d5431cc50231cc9fb2cd1fd9950029",
"balance": "0x0"
},
"46b0bd6380005952759f605d02a6365552c776f3": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
},
"699b607851c878e29499672f42a769b71f74be8e": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
},
"aeae0ab623d4118ac62a2decc386949b5ce67ce2": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
},
"e67598eb5831164574c876994d53f63eab4f36d7": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

Make this page better