github.com/shrimpyuk/bor@v0.2.15-0.20220224151350-fb4ec6020bae/internal/cli/server/chains/developer.go (about)

     1  package chains
     2  
     3  import (
     4  	"math/big"
     5  
     6  	"github.com/ethereum/go-ethereum/common"
     7  	"github.com/ethereum/go-ethereum/core"
     8  	"github.com/ethereum/go-ethereum/crypto"
     9  	"github.com/ethereum/go-ethereum/params"
    10  )
    11  
    12  // GetDeveloperChain returns the developer mode configs.
    13  func GetDeveloperChain(period uint64, faucet common.Address) *Chain {
    14  	// Override the default period to the user requested one
    15  	config := *params.AllCliqueProtocolChanges
    16  	config.Clique = &params.CliqueConfig{
    17  		Period: period,
    18  		Epoch:  config.Clique.Epoch,
    19  	}
    20  
    21  	// Assemble and return the chain having genesis with the
    22  	// precompiles and faucet pre-funded
    23  	return &Chain{
    24  		Hash:      common.Hash{},
    25  		NetworkId: 1337,
    26  		Genesis: &core.Genesis{
    27  			Config:     &config,
    28  			ExtraData:  append(append(make([]byte, 32), faucet[:]...), make([]byte, crypto.SignatureLength)...),
    29  			GasLimit:   11500000,
    30  			BaseFee:    big.NewInt(params.InitialBaseFee),
    31  			Difficulty: big.NewInt(1),
    32  			Alloc: map[common.Address]core.GenesisAccount{
    33  				common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover
    34  				common.BytesToAddress([]byte{2}): {Balance: big.NewInt(1)}, // SHA256
    35  				common.BytesToAddress([]byte{3}): {Balance: big.NewInt(1)}, // RIPEMD
    36  				common.BytesToAddress([]byte{4}): {Balance: big.NewInt(1)}, // Identity
    37  				common.BytesToAddress([]byte{5}): {Balance: big.NewInt(1)}, // ModExp
    38  				common.BytesToAddress([]byte{6}): {Balance: big.NewInt(1)}, // ECAdd
    39  				common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul
    40  				common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
    41  				common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
    42  				faucet:                           {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))},
    43  			},
    44  		},
    45  		Bootnodes: []string{},
    46  	}
    47  }