github.com/cheng762/platon-go@v1.8.17-0.20190529111256-7deff2d7be26/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 geth
    20  
    21  import (
    22  	"encoding/json"
    23  	"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
    24  
    25  	"github.com/PlatONnetwork/PlatON-Go/core"
    26  	"github.com/PlatONnetwork/PlatON-Go/p2p/discv5"
    27  	"github.com/PlatONnetwork/PlatON-Go/params"
    28  )
    29  
    30  // MainnetGenesis returns the JSON spec to use for the main Ethereum network. It
    31  // is actually empty since that defaults to the hard coded binary genesis block.
    32  func MainnetGenesis() string {
    33  	return ""
    34  }
    35  
    36  // TestnetGenesis returns the JSON spec to use for the Alpha test network.
    37  func TestnetGenesis() string {
    38  	enc, err := json.Marshal(core.DefaultTestnetGenesisBlock())
    39  	if err != nil {
    40  		panic(err)
    41  	}
    42  	return string(enc)
    43  }
    44  
    45  // BetanetGenesis returns the JSON spec to use for the Beta test network
    46  func BetanetGenesis() string {
    47  	enc, err := json.Marshal(core.DefaultBetanetGenesisBlock())
    48  	if err != nil {
    49  		panic(err)
    50  	}
    51  	return string(enc)
    52  }
    53  
    54  // InnerTestnetGenesis returns the JSON spec to use for the inner test network.
    55  func InnerTestnetGenesis() string {
    56  	enc, err := json.Marshal(core.DefaultInnerTestnetGenesisBlock(utils.InnerTimeFlag.Value))
    57  	if err != nil {
    58  		panic(err)
    59  	}
    60  	return string(enc)
    61  }
    62  
    63  // InnerDevnetGenesis returns the JSON spec to use for the inner test network.
    64  func InnerDevnetGenesis() string {
    65  	enc, err := json.Marshal(core.DefaultInnerDevnetGenesisBlock(utils.InnerTimeFlag.Value))
    66  	if err != nil {
    67  		panic(err)
    68  	}
    69  	return string(enc)
    70  }
    71  
    72  
    73  // FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated
    74  // by the foundation running the V5 discovery protocol.
    75  func FoundationBootnodes() *Enodes {
    76  	nodes := &Enodes{nodes: make([]*discv5.Node, len(params.DiscoveryV5Bootnodes))}
    77  	for i, url := range params.DiscoveryV5Bootnodes {
    78  		nodes.nodes[i] = discv5.MustParseNode(url)
    79  	}
    80  	return nodes
    81  }