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 Name | Description |
---|---|
config | The blokchain configuration. See the section Config. |
nonce | (deprecated) This field is derived from the Ethereum, but not used in Klaytn. |
timestamp | The unix time when a block is created. |
extraData | The data combined field for signer vanity and RLP-encoded istanbul extra data that contains validator list, proposer seal, and commit seals. |
gasLimit | The 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. |
coinbase | An address to which miner receives the reward. This field is only used for Clique consensus engine. |
alloc | The predefined accounts. |
number | The block number field. |
gasUsed | The amount of the gas which used for a block. |
parentHash | The hash value of the previous block. |
Config β
The config
field stores the information related to the chain.
Field Name | Description |
---|---|
chainId | It identifies the current chain and is used for prevention from the replay attack. |
istanbulCompatibleBlock | A block number to which istanbul change is applied. |
istanbul, clique | The type of consensus engine. |
unitPrice | Unit price. |
deriveShaImpl | Defines a method to generate transaction hash and receipt hash. |
governance | Governance 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 650x0
. - CommittedSeal: the list of commitment signature seals as consensus proof. For
genesis.json
, it is an empty array.
Example
Field | Type | Value |
---|---|---|
Vanity | 32-byte hex string | 0x0000000000000000000000000000000000000000000000000000000000000000 |
Validators | []address | [0x48009b4e20ec72aadf306577cbe2eaf54b0ebb16,0x089fcc42fd83baeee4831319375413b8bae3aceb] |
Seal | byte 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.
Fields | Description |
---|---|
period | The minimum time interval between the consecutive blocks (unit: second). |
epoch | The number of blocks to reset votes and marked as a checkpoint. |
Istanbul β
The istanbul
field stores the configuration for Istanbul based sealing.
Fields | Description |
---|---|
epoch | The number of blocks to reset votes to be a checkpoint. |
policy | The block proposer selection policy. [0: Round Robin, 1: Sticky, 2: Weighted Random] |
sub | Committee size. |
Governance β
The governance
field stores governance information for a network.
Fields | Description |
---|---|
governanceMode | One of three governance modes. [none , single , ballot ] |
governingNode | Designated governing node's address. It only works if the governance mode is single . |
reward | It stores the reward configuration. See the section Reward. |