Genesis

Genesis

// Genesis specifies the header fields, state of a genesis block. It also defines hard
// fork switch-over blocks through the chain configuration.
type Genesis struct {
    Config *params.ChainConfig `json:"config"`
    //Nonce      uint64              `json:"nonce"`
    Timestamp  uint64         `json:"timestamp"`
    ExtraData  []byte         `json:"extraData"`
    GasLimit   uint64         `json:"gasLimit"   gencodec:"required"`
    Difficulty *big.Int       `json:"difficulty" gencodec:"required"`
    Mixhash    common.Hash    `json:"mixHash"`
    Coinbase   common.Address `json:"coinbase"`
    Alloc      GenesisAlloc   `json:"alloc"      gencodec:"required"`

    // These fields are used for consensus tests. Please don't use them
    // in actual genesis blocks.
    Number     uint64      `json:"number"`
    GasUsed    uint64      `json:"gasUsed"`
    ParentHash common.Hash `json:"parentHash"`
}

GenesisAlloc

// GenesisAlloc specifies the initial state that is part of the genesis block.
type GenesisAlloc map[common.Address]GenesisAccount

GenesisAccount

// GenesisAccount is an account in the state of the genesis block.
type GenesisAccount struct {
    Code    []byte                      `json:"code,omitempty"`
    Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
    Balance *big.Int                    `json:"balance" gencodec:"required"`
    Nonce   uint64                      `json:"nonce,omitempty"`
}

Last updated

Was this helpful?