github.com/MetalBlockchain/metalgo@v1.11.9/genesis/genesis_local.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package genesis
     5  
     6  import (
     7  	"time"
     8  
     9  	_ "embed"
    10  
    11  	"github.com/MetalBlockchain/metalgo/utils/cb58"
    12  	"github.com/MetalBlockchain/metalgo/utils/crypto/secp256k1"
    13  	"github.com/MetalBlockchain/metalgo/utils/units"
    14  	"github.com/MetalBlockchain/metalgo/utils/wrappers"
    15  	"github.com/MetalBlockchain/metalgo/vms/platformvm/reward"
    16  	"github.com/MetalBlockchain/metalgo/vms/platformvm/txs/fee"
    17  )
    18  
    19  // PrivateKey-vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE => P-local1g65uqn6t77p656w64023nh8nd9updzmxyymev2
    20  // PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN => X-local18jma8ppw3nhx5r4ap8clazz0dps7rv5u00z96u
    21  // 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 => 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
    22  
    23  const (
    24  	VMRQKeyStr          = "vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE"
    25  	VMRQKeyFormattedStr = secp256k1.PrivateKeyPrefix + VMRQKeyStr
    26  
    27  	EWOQKeyStr          = "ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN"
    28  	EWOQKeyFormattedStr = secp256k1.PrivateKeyPrefix + EWOQKeyStr
    29  )
    30  
    31  var (
    32  	VMRQKey *secp256k1.PrivateKey
    33  	EWOQKey *secp256k1.PrivateKey
    34  
    35  	//go:embed genesis_local.json
    36  	localGenesisConfigJSON []byte
    37  
    38  	// LocalParams are the params used for local networks
    39  	LocalParams = Params{
    40  		StaticConfig: fee.StaticConfig{
    41  			TxFee:                         units.MilliAvax,
    42  			CreateAssetTxFee:              units.MilliAvax,
    43  			CreateSubnetTxFee:             100 * units.MilliAvax,
    44  			TransformSubnetTxFee:          100 * units.MilliAvax,
    45  			CreateBlockchainTxFee:         100 * units.MilliAvax,
    46  			AddPrimaryNetworkValidatorFee: 0,
    47  			AddPrimaryNetworkDelegatorFee: 0,
    48  			AddSubnetValidatorFee:         units.MilliAvax,
    49  			AddSubnetDelegatorFee:         units.MilliAvax,
    50  		},
    51  		StakingConfig: StakingConfig{
    52  			UptimeRequirement: .8, // 80%
    53  			MinValidatorStake: 2 * units.KiloAvax,
    54  			MaxValidatorStake: 3 * units.MegaAvax,
    55  			MinDelegatorStake: 25 * units.Avax,
    56  			MinDelegationFee:  20000, // 2%
    57  			MinStakeDuration:  24 * time.Hour,
    58  			MaxStakeDuration:  365 * 24 * time.Hour,
    59  			RewardConfig: reward.Config{
    60  				MaxConsumptionRate: .12 * reward.PercentDenominator,
    61  				MinConsumptionRate: .10 * reward.PercentDenominator,
    62  				MintingPeriod:      365 * 24 * time.Hour,
    63  				SupplyCap:          720 * units.MegaAvax,
    64  			},
    65  		},
    66  	}
    67  )
    68  
    69  func init() {
    70  	errs := wrappers.Errs{}
    71  	vmrqBytes, err := cb58.Decode(VMRQKeyStr)
    72  	errs.Add(err)
    73  	ewoqBytes, err := cb58.Decode(EWOQKeyStr)
    74  	errs.Add(err)
    75  
    76  	VMRQKey, err = secp256k1.ToPrivateKey(vmrqBytes)
    77  	errs.Add(err)
    78  	EWOQKey, err = secp256k1.ToPrivateKey(ewoqBytes)
    79  	errs.Add(err)
    80  
    81  	if errs.Err != nil {
    82  		panic(errs.Err)
    83  	}
    84  }