code: func (g *Genesis) Commit(db ethdb.Database) (*types.Block, error) {
  	block := g.ToBlock(db)
  	if block.Number().Sign() != 0 {
  		return nil, fmt.Errorf("can't commit genesis block with number > 0")
  	}
  	rawdb.WriteTd(db, block.Hash(), block.NumberU64(), g.Difficulty)
  	rawdb.WriteBlock(db, block)
  	rawdb.WriteReceipts(db, block.Hash(), block.NumberU64(), nil)
  	rawdb.WriteCanonicalHash(db, block.Hash(), block.NumberU64())
  	rawdb.WriteHeadBlockHash(db, block.Hash())
  	rawdb.WriteHeadHeaderHash(db, block.Hash())
  
  	config := g.Config
  	if config == nil {
  		config = params.AllEthashProtocolChanges
  	}
  	rawdb.WriteChainConfig(db, block.Hash(), config)
  	return block, nil
  }
docs: // Commit writes the block and state of a genesis specification to the database.
  // The block is committed as the canonical head block.