Documentation ¶
Overview ¶
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func FileExists(name string) bool
- func LoadGenesis(path string) error
- func ParseAndSetDebugLevels(debugLevel string) error
- func Register(params *Params) error
- func TransferGenesisData(data []byte) map[string][]ContractInfo
- func Version() string
- type BitcoinParams
- type Checkpoint
- type ConsensusDeployment
- type ContractInfo
- type DNSSeed
- type FConfig
- type Params
Constants ¶
const ( DefaultConfigFilename = "asimovd.conf" DefaultGenesisFilename = "genesis.json" DefaultDataDirname = "data" DefaultLogLevel = "info" DefaultLogDirname = "logs" DefaultStateDirname = "state" DefaultMaxPeers = 125 DefaultBanDuration = time.Hour * 24 DefaultBanThreshold = 100 DefaultMaxRPCClients = 10 DefaultMaxRPCWebsockets = 25 DefaultMaxRPCConcurrentReqs = 8 // DefaultMinTxPrice is the minimum price in xing that is required // for a transaction to be treated as free for relay and mining // purposes. It is also used to help determine if a transaction is // considered as a base for calculating minimum required fees // for larger transactions. DefaultMinTxPrice = 0.01 DefaultMaxOrphanTransactions = 100 DefaultMaxOrphanTxSize = 100000 DefaultAutoSignUpGasLimit = 300000 DefaultMergeLimit = 10 // DefaultMaxTimeOffsetSeconds is the maximum number of seconds a block // time is allowed to be ahead of the current time. DefaultMaxTimeOffsetSeconds = 30 DefaultHTTPEndPoint = "127.0.0.1:8545" // Default endpoint interface for the HTTP RPC server DefaultWSEndPoint = "127.0.0.1:8546" // Default endpoint interface for the websocket RPC server // DefaultBlockProductedTimeOut is the default value for the policy // `BlockProductedTimeOut`. There are four steps which take the main // time of a block interval: // 1. producing a block (*) // 2. process block in the miner node // 3. broadcast the block // 4. process block in other nodes DefaultBlockProductedTimeOut = 0.5 // DefaultTxConnectTimeOut is the default value for the policy // `TxConnectTimeOut`. The whole progress of producing a block contains: // 1. fetch txs from mempool & order them // 2. validating utxos (*UtxoValidateTimeOut) // 3. connect txs (*DefaultTxConnectTimeOut) // 4. create coinbase (maybe coinbase tx need execute vm) // 5. commit state db. DefaultTxConnectTimeOut = 0.75 // refer to doc of DefaultTxConnectTimeOut DefaultUtxoValidateTimeOut = 0.25 //DefaultSyncBlockTime is the default time cost for synchronizing a block DefaultSyncBlockTime = 1000 )
const ( // DeploymentTestDummy defines the rule change deployment ID for testing // purposes. DeploymentTestDummy = iota // DefinedDeployments is the number of currently defined deployments. DefinedDeployments )
Constants that define the deployment offset in the deployments field of the parameters for each deployment. This is useful to be able to get the details of a specific deployment by name.
const ( AppMajor uint = 0 AppMinor uint = 1 AppPatch uint = 0 )
These constants define the application Version and follow the semantic versioning 0.1.0 spec (http://semver.org/).
Variables ¶
var ( HomeDir = asiutil.HomeDir() DefaultAppDataDir = cleanAndExpandPath(asiutil.AppDataDir("asimovd", false)) DefaultConfigFile = filepath.Join(DefaultAppDataDir, DefaultConfigFilename) DefaultGenesisPath = DefaultAppDataDir DefaultDataDir = filepath.Join(DefaultAppDataDir, DefaultDataDirname) DefaultRPCKeyFile = filepath.Join(DefaultAppDataDir, "rpc.key") DefaultRPCCertFile = filepath.Join(DefaultAppDataDir, "rpc.cert") DefaultLogDir = filepath.Join(DefaultAppDataDir, DefaultLogDirname) DefaultStateDir = filepath.Join(DefaultAppDataDir, DefaultStateDirname) Cfg *FConfig DefaultHttpModules = []string{"net", "web3"} DefaultHTTPVirtualHosts = []string{"localhost"} DefaultWSOrigins = []string{"*"} DefaultWSModules = []string{"net", "web3"} )
var ( OfficialAddress = common.HexToAddress("0x660000000000000000000000000000000000000000") NetConstructorArgsMap = map[string]map[string][]common.Address{ common.DevelopNet.String(): { "genesisCitizens": { common.HexToAddress("0x66b28f9dd1cf6314a8b5d691aeec6c6eaf456cbd9a"), common.HexToAddress("0x6684eb1e592de5f92059f6c7766a04f2c9fd5587ad"), common.HexToAddress("0x66a8c1def9e07589415ebf59b55f76b9d5115064c9"), common.HexToAddress("0x662306d43258293846ab198810879e31feac759fac"), common.HexToAddress("0x6697a7f6e03dcff5cd9cbf99b5a77e7b31dd07153c"), common.HexToAddress("0x660832b804c7ef67bcc224de8a48c9e7a3a55b3c1f"), common.HexToAddress("0x6661d84abf1832cae49adc891d0331cbbba0d92963"), }, "_validators": { common.HexToAddress("0x66b28f9dd1cf6314a8b5d691aeec6c6eaf456cbd9a"), common.HexToAddress("0x6684eb1e592de5f92059f6c7766a04f2c9fd5587ad"), common.HexToAddress("0x66a8c1def9e07589415ebf59b55f76b9d5115064c9"), common.HexToAddress("0x662306d43258293846ab198810879e31feac759fac"), common.HexToAddress("0x6697a7f6e03dcff5cd9cbf99b5a77e7b31dd07153c"), }, "_admins": { common.HexToAddress("0x66b28f9dd1cf6314a8b5d691aeec6c6eaf456cbd9a"), }, "_miners": { common.HexToAddress("0x6684eb1e592de5f92059f6c7766a04f2c9fd5587ad"), common.HexToAddress("0x66a8c1def9e07589415ebf59b55f76b9d5115064c9"), }, }, common.TestNet.String(): { "genesisCitizens": { common.HexToAddress("0x66b28f9dd1cf6314a8b5d691aeec6c6eaf456cbd9a"), common.HexToAddress("0x6684eb1e592de5f92059f6c7766a04f2c9fd5587ad"), common.HexToAddress("0x66a8c1def9e07589415ebf59b55f76b9d5115064c9"), common.HexToAddress("0x662306d43258293846ab198810879e31feac759fac"), common.HexToAddress("0x6697a7f6e03dcff5cd9cbf99b5a77e7b31dd07153c"), common.HexToAddress("0x660832b804c7ef67bcc224de8a48c9e7a3a55b3c1f"), common.HexToAddress("0x6661d84abf1832cae49adc891d0331cbbba0d92963"), }, "_validators": { common.HexToAddress("0x66b28f9dd1cf6314a8b5d691aeec6c6eaf456cbd9a"), common.HexToAddress("0x6684eb1e592de5f92059f6c7766a04f2c9fd5587ad"), common.HexToAddress("0x66a8c1def9e07589415ebf59b55f76b9d5115064c9"), common.HexToAddress("0x662306d43258293846ab198810879e31feac759fac"), common.HexToAddress("0x6697a7f6e03dcff5cd9cbf99b5a77e7b31dd07153c"), }, "_admins": { common.HexToAddress("0x66b28f9dd1cf6314a8b5d691aeec6c6eaf456cbd9a"), }, "_miners": { common.HexToAddress("0x6684eb1e592de5f92059f6c7766a04f2c9fd5587ad"), common.HexToAddress("0x66a8c1def9e07589415ebf59b55f76b9d5115064c9"), }, }, common.MainNet.String(): { "genesisCitizens": { common.HexToAddress("0x665ed50a57537b53757f77455a14f0ca561e97ccf0"), common.HexToAddress("0x665c1eba3c28f0040e8f50f0855d1f259654b89a53"), common.HexToAddress("0x66289ac97751f4e9b46061311eb17ebbd406a47479"), common.HexToAddress("0x6605ae9e08413ba416cd34b9a77161555257915a70"), common.HexToAddress("0x66f53528a1cae2650451a00a5643157ac0d7164461"), common.HexToAddress("0x66e0b010b4052f68bbee5a065d029b09b3c0b13ffb"), common.HexToAddress("0x6645673025c64c1337eea4995eebfe34a3da8dcf87"), }, "_validators": { common.HexToAddress("0x665ed50a57537b53757f77455a14f0ca561e97ccf0"), common.HexToAddress("0x665c1eba3c28f0040e8f50f0855d1f259654b89a53"), common.HexToAddress("0x66289ac97751f4e9b46061311eb17ebbd406a47479"), common.HexToAddress("0x6605ae9e08413ba416cd34b9a77161555257915a70"), common.HexToAddress("0x66f53528a1cae2650451a00a5643157ac0d7164461"), common.HexToAddress("0x66e0b010b4052f68bbee5a065d029b09b3c0b13ffb"), common.HexToAddress("0x6645673025c64c1337eea4995eebfe34a3da8dcf87"), }, }, } )
Params for genesis contracts
var ( // ErrDuplicateNet describes an error where the parameters for a Bitcoin // network could not be set due to the network already being a standard // network or previously-registered into this package. ErrDuplicateNet = errors.New("duplicate Bitcoin network") // ErrUnknownHDKeyID describes an error where the provided id which // is intended to identify the network for a hierarchical deterministic // private extended key is not registered. ErrUnknownHDKeyID = errors.New("unknown hd private extended key bytes") )
var ActiveNetParams = &mainNetParams
ActiveNetParams is a pointer to the parameters specific to the currently active bitcoin network.
var DevelopNetParams = Params{ Net: common.DevelopNet, DefaultPort: "18700", DNSSeeds: []DNSSeed{ {"seed1.asimov.tech", true}, {"seed2.asimov.tech", false}, }, GenesisHash: &devnetGenesisHash, GenesisCandidates: []common.Address{ common.HexToAddress("0x6632032786c61472128d1b3185c92626f8ff0ee4d3"), common.HexToAddress("0x668bd8118cc510f8ccd1089bd9d5e44bdc20d6e373"), common.HexToAddress("0x66e8e93bb62ade708ccb5715736a75df4a981b20c5"), }, CoinbaseMaturity: 1, SubsidyReductionInterval: 25000000, RoundSize: 120, BtcBlocksPerRound: 1, CollectHeight: 10100, CollectInterval: 144, MappingDelayInterval: 2, KeepAliveInterval: 2, Checkpoints: nil, RuleChangeActivationThreshold: 108, MinerConfirmationWindow: 20, Deployments: [DefinedDeployments]ConsensusDeployment{ DeploymentTestDummy: { BitNumber: 28, StartTime: 0, ExpireTime: math.MaxInt64, }, }, FvmParam: params.TestnetChainConfig, Bitcoin: []*BitcoinParams{ { Host: "devnet-btc.asimov.tech:18554", RpcUser: "asimov", RpcPassword: "asimov", }, }, }
DevelopNetParams defines the network parameters for the develop Asimov network.
var MainNetParams = Params{ Net: common.MainNet, DefaultPort: "8777", DNSSeeds: []DNSSeed{ {"seed1.asimov.testnet", false}, {"seed2.asimov.testnet", false}, }, GenesisHash: &mainnetGenesisHash, GenesisCandidates: []common.Address{ common.HexToAddress("0x66e0b010b4052f68bbee5a065d029b09b3c0b13ffb"), common.HexToAddress("0x6645673025c64c1337eea4995eebfe34a3da8dcf87"), common.HexToAddress("0x66f29f0fd5008c9b676a32744839d9953d07e2bfc6"), common.HexToAddress("0x66347c825835a984374d16bddbf674cfb6645e7bc1"), common.HexToAddress("0x663cb5d3ec78b7e37a218f7ee50c84118e59e46a76"), }, CoinbaseMaturity: 4320, SubsidyReductionInterval: 25000000, RoundSize: 720, BtcBlocksPerRound: 6, CollectHeight: 632500, CollectInterval: 2016, MappingDelayInterval: 24 * 3, KeepAliveInterval: 24, RuleChangeActivationThreshold: 1916, MinerConfirmationWindow: 2016, Deployments: [DefinedDeployments]ConsensusDeployment{}, FvmParam: params.MainnetChainConfig, Bitcoin: []*BitcoinParams{ { Host: "btc.asimov.network:8300", RpcUser: "asimov", RpcPassword: "asimov", }, }, }
MainNetParams defines the network parameters for the main Bitcoin network.
var TestNetParams = Params{ Net: common.TestNet, DefaultPort: "18721", DNSSeeds: []DNSSeed{ {"seed1.asimov.pro", true}, {"seed2.asimov.pro", false}, }, GenesisHash: &testnetGenesisHash, GenesisCandidates: []common.Address{ common.HexToAddress("0x6632032786c61472128d1b3185c92626f8ff0ee4d3"), common.HexToAddress("0x668bd8118cc510f8ccd1089bd9d5e44bdc20d6e373"), common.HexToAddress("0x66e8e93bb62ade708ccb5715736a75df4a981b20c5"), }, CoinbaseMaturity: 240, SubsidyReductionInterval: 25000000, RoundSize: 240, BtcBlocksPerRound: 2, CollectHeight: 60, CollectInterval: 144, MappingDelayInterval: 2, KeepAliveInterval: 24, RuleChangeActivationThreshold: 1512, MinerConfirmationWindow: 2016, Deployments: [DefinedDeployments]ConsensusDeployment{ DeploymentTestDummy: { BitNumber: 28, StartTime: 1199145601, ExpireTime: 1230767999, }, }, FvmParam: params.TestnetChainConfig, Bitcoin: []*BitcoinParams{ { Host: "testnet-btc.asimov.tech:18332", RpcUser: "asimov", RpcPassword: "asimov", }, }, }
TestNetParams defines the network parameters for the test flow network. Not to be confused with the regression test network, this network is sometimes simply called "testnet".
Functions ¶
func FileExists ¶
filesExists reports whether the named file or directory exists.
func LoadGenesis ¶
LoadGenesis loads genesis data from the given path
func ParseAndSetDebugLevels ¶
ParseAndSetDebugLevels attempts to parse the specified debug level and set the levels accordingly. An appropriate error is returned if anything is invalid.
func Register ¶
Register registers the network parameters for a Bitcoin network. This may error with ErrDuplicateNet if the network is already registered (either due to a previous Register call, or the network being one of the default networks).
Network parameters should be registered into this package by a main package as early as possible. Then, library packages may lookup networks or network parameters based on inputs and work regardless of the network being standard or not.
func TransferGenesisData ¶
func TransferGenesisData(data []byte) map[string][]ContractInfo
Decode a bytes array into a map, it is only used for genesis block's data.
func Version ¶
func Version() string
Version returns the application Version as a properly formed string per the semantic versioning 2.0.0 spec (http://semver.org/).
Types ¶
type BitcoinParams ¶
type Checkpoint ¶
Checkpoint identifies a known good point in the block chain. Using checkpoints allows a few optimizations for old blocks during initial download and also prevents forks from old blocks.
Each checkpoint is selected based upon several factors. See the documentation for blockchain.IsCheckpointCandidate for details on the selection criteria.
type ConsensusDeployment ¶
type ConsensusDeployment struct { // BitNumber defines the specific bit number within the block version // this particular soft-fork deployment refers to. BitNumber uint8 // StartTime is the median block time after which voting on the // deployment starts. StartTime int64 // ExpireTime is the median block time after which the attempted // deployment expires. ExpireTime int64 }
ConsensusDeployment defines details related to a specific consensus rule change that is voted in. This is part of BIP0009.
type ContractInfo ¶
type ContractInfo struct { // name of contract Name string // an address for some contract instance Address []byte // compiled code for contract, contains ctor and params. Code string // abis for contract AbiInfo string // init params InitCode string // block height where the contract active. BlockHeight int32 }
ContractInfo defines all fields for a contract.
type DNSSeed ¶
type DNSSeed struct { // Host defines the hostname of the seed. Host string // HasFiltering defines whether the seed supports filtering // by service flags (wire.ServiceFlag). HasFiltering bool }
DNSSeed identifies a DNS seed.
type FConfig ¶
type FConfig struct { ShowVersion bool `short:"V" long:"Version" description:"Display Version information and exit"` ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"` DataDir string `short:"b" long:"datadir" description:"Directory to store data"` LogDir string `long:"logdir" description:"Directory to logger output."` StateDir string `long:"statedir" description:"Directory to state data."` AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"` ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"` DisableListen bool `` /* 217-byte string literal not displayed */ Listeners []string `` /* 127-byte string literal not displayed */ MaxPeers int `long:"maxpeers" description:"Max number of inbound and outbound peers"` DisableBanning bool `long:"nobanning" description:"Disable banning of misbehaving peers"` BanDuration time.Duration `long:"banduration" description:"How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second"` BanThreshold uint32 `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."` WhitelistsArr []string `long:"whitelist" description:"Add an IP network or IP that will not be banned. (eg. 192.168.1.0/24 or ::1)"` AgentBlacklist []string `` /* 186-byte string literal not displayed */ AgentWhitelist []string `` /* 309-byte string literal not displayed */ RPCUser string `short:"u" long:"rpcuser" description:"Username for RPC connections"` RPCPass string `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"` RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"` RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"` RPCCert string `long:"rpccert" description:"File containing the certificate file"` RPCKey string `long:"rpckey" description:"File containing the certificate key"` RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"` RPCMaxWebsockets int `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"` RPCMaxConcurrentReqs int `long:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"` DisableRPC bool `` /* 165-byte string literal not displayed */ DisableTLS bool `` /* 127-byte string literal not displayed */ DisableDNSSeed bool `long:"nodnsseed" description:"Disable DNS seeding for peers"` ExternalIPs []string `long:"externalip" description:"Add an ip to the list of local addresses we claim to listen on to peers"` Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"` ProxyUser string `long:"proxyuser" description:"Username for proxy server"` ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"` OnionProxy string `long:"onion" description:"Connect to tor hidden services via SOCKS5 proxy (eg. 127.0.0.1:9050)"` OnionProxyUser string `long:"onionuser" description:"Username for onion proxy server"` OnionProxyPass string `long:"onionpass" default-mask:"-" description:"Password for onion proxy server"` NoOnion bool `long:"noonion" description:"Disable connecting to tor hidden services"` TorIsolation bool `long:"torisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."` TestNet bool `long:"testnet" description:"Use the test network"` RejectReplacement bool `` /* 176-byte string literal not displayed */ DevelopNet bool `long:"devnet" description:"Use the develop network"` ChainId uint64 `` /* 127-byte string literal not displayed */ AddCheckpointsArr []string `long:"addcheckpoint" description:"Add a custom checkpoint. Format: '<height>:<hash>'"` DisableCheckpoints bool `long:"nocheckpoints" description:"Disable built-in checkpoints. Don't do this unless you know what you're doing."` Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"` CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"` DebugLevel string `` /* 278-byte string literal not displayed */ Upnp bool `long:"upnp" description:"Use UPnP to map our listening port outside of NAT"` MinTxPrice float64 `long:"mintxprice" description:"The minimum transaction price, it should not less than 0.01"` BlkProductedTimeOut float64 `long:"blkproductedtimeout" description:"the value for the policy BlockProductedTimeOut,the value must be in range of (0, 1)"` TxConnectTimeOut float64 `long:"txconnecttimeout" description:"the value for the policy TxConnectTimeOut,the value must be in range of (0, 1)"` UtxoValidateTimeOut float64 `long:"utxovalidatetimeout" description:"the time for validating utxos,the value must be in range of (0, 1)"` BlockSyncTime float64 `long:"blocksynctime" description:"the time for synchronizing a block,the time unit is millisecond"` DisableBlockEarly bool `long:"disableblockearly" description:"Generate blocks early when the last block is received and consensus is satoshi"` MaxOrphanTxs int `long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"` MaxOrphanTxSize int `long:"maxorphantxsize" description:"Max size of an orphan transaction to allow in memory"` Consensustype string `long:"consensustype" description:"Consensus type which the server uses"` Privatekey string `long:"privatekey" description:"Add the private key which is used to assign block header for generated blocks"` UserAgentComments []string `long:"uacomment" description:"Comment to add to the user agent -- See BIP 14 for more information."` NoPeerBloomFilters bool `long:"nopeerbloomfilters" description:"Disable bloom filtering support"` NoCFilters bool `long:"nocfilters" description:"Disable committed filtering (CF) support"` DropCfIndex bool `` /* 138-byte string literal not displayed */ BlocksOnly bool `long:"blocksonly" description:"Do not accept transactions from remote peers."` EmptyRound bool `long:"emptyround" description:"Allow round contains no blocks."` DropTxIndex bool `long:"droptxindex" description:"Deletes the hash-based transaction index from the database on start up and then exits."` DropAddrIndex bool `long:"dropaddrindex" description:"Deletes the address-based transaction index from the database on start up and then exits."` MaxTimeOffset int `` /* 150-byte string literal not displayed */ MergeLimit int `long:"mergeLimit" description:"It is a miner strategy that miner can merge its utxo and push into block."` AddCheckpoints []Checkpoint Whitelists []*net.IPNet EwasmOptions string `long:"vm.ewasm" description:"Ewasm options"` EvmOptions string `long:"vm.evm" description:"Evm options"` HTTPEndpoint string `long:"httpendpoint" description:"Http endpoint to listen for HTTP RPC connections (default port: 127.0.0.1:8545)"` HTTPModules []string `long:"httpmodule" description:"HTTP RPC modules supported by current node (default [\"net\", \"web3\"])"` HTTPCors []string `long:"httpcor" description:"HTTPCors is the Cross-Origin Resource Sharing header to send to requesting"` HTTPVirtualHosts []string `` /* 146-byte string literal not displayed */ HTTPTimeouts rpc.HTTPTimeouts WSEndpoint string `long:"wsendpoint" description:"Ws endpoint to listen for Websocket connections (default port: 127.0.0.1:8546)"` WSOrigins []string `long:"wsorigins" description:"Ws origins is whitelist of ws (default *)"` WSModules []string `long:"wsmodule" description:"WebSocket modules supported by current node (default [\"net\", \"web3\"])"` AddBtc []string `long:"addbtc" description:"Add a param to call btc server. Format: '<ip>:<port>:<rpcuser>:<rpcpassword>'"` BtcParams []*BitcoinParams GenesisPath string `long:"genesispath" description:"Path of genesis files"` GenesisBlockFile string GenesisParamFile string }
FConfig defines the configuration options for asimovd.
See loadConfig for details on the configuration load process.
func LoadConfig ¶
loadConfig initializes and parses the FConfig using a FConfig file and command line options.
The configuration proceeds as follows:
- Start with a default FConfig with sane settings
- Pre-parse the command line to check for an alternative FConfig file
- Load configuration file overwriting defaults with any specified options
- Parse CLI options and overwrite/add any specified options
The above results in btcd functioning properly without any FConfig settings while still allowing the user to override settings with FConfig files and command line options. Command line options always take precedence.
type Params ¶
type Params struct { // Net defines the magic bytes used to identify the network. Net common.AsimovNet // DefaultPort defines the default peer-to-peer port for the network. DefaultPort string // DNSSeeds defines a list of DNS seeds for the network that are used // as one method to discover peers. DNSSeeds []DNSSeed // GenesisBlock defines the first block of the chain. GenesisBlock *protos.MsgBlock // GenesisHash is the starting block hash. GenesisHash *common.Hash // GenesisHash is the default candidates for selecting validators GenesisCandidates []common.Address // CoinbaseMaturity is the number of blocks required before newly mined // coins (coinbase transactions) can be spent. CoinbaseMaturity int32 // SubsidyReductionInterval is the interval of blocks before the subsidy // is reduced. SubsidyReductionInterval int32 // ChainStartTime is the time of last slot in round 0. It also represents // the first expected block time - 5 seconds. ChainStartTime int64 // RoundSize is the interval of blocks before the next round is started. RoundSize uint16 // BtcBlocksPerRound is the expected number of blocks in bitcoin generated // in asimov round. BtcBlocksPerRound uint16 // CollectHeight is the height of bitcoin which is the initial collect // height. CollectHeight int32 // CollectInterval is the interval of blocks in bitcoin which used as a // poa round source data. CollectInterval int32 // MappingDelayInterval is the interval of block rounds when the // validator can work after a bitcoin mapping tx include in block. MappingDelayInterval uint32 // KeepAliveInterval is the interval of block rounds which is the // max number for a validator keep alive. KeepAliveInterval uint32 // Checkpoints ordered from oldest to newest. Checkpoints []Checkpoint // These fields are related to voting on consensus rule changes as // defined by BIP0009. // // RuleChangeActivationThreshold is the number of blocks in a threshold // state retarget window for which a positive vote for a rule change // must be cast in order to lock in a rule change. It should typically // be 95% for the main network and 75% for test networks. // // MinerConfirmationWindow is the number of blocks in each threshold // state retarget window. // // Deployments define the specific consensus rule changes to be voted // on. RuleChangeActivationThreshold uint32 MinerConfirmationWindow uint32 Deployments [DefinedDeployments]ConsensusDeployment FvmParam *params.ChainConfig Bitcoin []*BitcoinParams }
Params defines an asimov network by its parameters. These parameters may be used by asimov applications to differentiate networks as well as addresses and keys for one network from those intended for use on another network.