github.com/digdeepmining/go-atheios@v1.5.13-0.20180902133602-d5687a2e6f43/mobile/params.go (about)

     1  // Copyright 2016 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  // Contains all the wrappers from the params package.
    18  
    19  package gath
    20  
    21  import (
    22  	"github.com/atheioschain/go-atheios/core"
    23  	"github.com/atheioschain/go-atheios/p2p/discv5"
    24  	"github.com/atheioschain/go-atheios/params"
    25  )
    26  
    27  // MainnetChainConfig returns the chain configurations for the main Ethereum network.
    28  func MainnetChainConfig() *ChainConfig {
    29  	return &ChainConfig{
    30  		ChainID:        params.MainNetChainID.Int64(),
    31  		HomesteadBlock: params.MainNetHomesteadBlock.Int64(),
    32  		EIP150Block:    params.MainNetHomesteadGasRepriceBlock.Int64(),
    33  		EIP150Hash:     Hash{params.MainNetHomesteadGasRepriceHash},
    34  		EIP155Block:    params.MainNetSpuriousDragon.Int64(),
    35  		EIP158Block:    params.MainNetSpuriousDragon.Int64(),
    36  	}
    37  }
    38  
    39  // MainnetGenesis returns the JSON spec to use for the main Ethereum network. It
    40  // is actually empty since that defaults to the hard coded binary genesis block.
    41  func MainnetGenesis() string {
    42  	return ""
    43  }
    44  
    45  // TestnetChainConfig returns the chain configurations for the Ethereum test network.
    46  func TestnetChainConfig() *ChainConfig {
    47  	return &ChainConfig{
    48  		ChainID:        params.TestNetChainID.Int64(),
    49  		HomesteadBlock: params.TestNetHomesteadBlock.Int64(),
    50  		EIP150Block:    params.TestNetHomesteadGasRepriceBlock.Int64(),
    51  		EIP150Hash:     Hash{params.TestNetHomesteadGasRepriceHash},
    52  		EIP155Block:    params.TestNetSpuriousDragon.Int64(),
    53  		EIP158Block:    params.TestNetSpuriousDragon.Int64(),
    54  	}
    55  }
    56  
    57  // TestnetGenesis returns the JSON spec to use for the Ethereum test network.
    58  func TestnetGenesis() string {
    59  	return core.DefaultTestnetGenesisBlock()
    60  }
    61  
    62  // ChainConfig is the core config which determines the blockchain settings.
    63  type ChainConfig struct {
    64  	ChainID        int64 // Chain ID for replay protection
    65  	HomesteadBlock int64 // Homestead switch block
    66  	EIP150Block    int64 // Homestead gas reprice switch block
    67  	EIP150Hash     Hash  // Homestead gas reprice switch block hash
    68  	EIP155Block    int64 // Replay protection switch block
    69  	EIP158Block    int64 // Empty account pruning switch block
    70  }
    71  
    72  // NewChainConfig creates a new chain configuration that transitions immediately
    73  // to homestead and has no notion of the DAO fork (ideal for a private network).
    74  func NewChainConfig() *ChainConfig {
    75  	return new(ChainConfig)
    76  }
    77  
    78  // FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated
    79  // by the foundation running the V5 discovery protocol.
    80  func FoundationBootnodes() *Enodes {
    81  	nodes := &Enodes{nodes: make([]*discv5.Node, len(params.DiscoveryV5Bootnodes))}
    82  	for i, url := range params.DiscoveryV5Bootnodes {
    83  		nodes.nodes[i] = discv5.MustParseNode(url)
    84  	}
    85  	return nodes
    86  }