github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/mobile/params.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 12:09:43</date> 10 //</624342654368354304> 11 12 13 //包含params包中的所有包装器。 14 15 package geth 16 17 import ( 18 "encoding/json" 19 20 "github.com/ethereum/go-ethereum/core" 21 "github.com/ethereum/go-ethereum/p2p/discv5" 22 "github.com/ethereum/go-ethereum/params" 23 ) 24 25 //MainNetGenesis返回用于主以太坊网络的JSON规范。它 26 //实际上是空的,因为它默认为硬编码的二进制genesis块。 27 func MainnetGenesis() string { 28 return "" 29 } 30 31 //TestNetGenesis返回用于以太坊测试网络的JSON规范。 32 func TestnetGenesis() string { 33 enc, err := json.Marshal(core.DefaultTestnetGenesisBlock()) 34 if err != nil { 35 panic(err) 36 } 37 return string(enc) 38 } 39 40 //RinkebyGenesis返回用于Rinkeby测试网络的JSON规范 41 func RinkebyGenesis() string { 42 enc, err := json.Marshal(core.DefaultRinkebyGenesisBlock()) 43 if err != nil { 44 panic(err) 45 } 46 return string(enc) 47 } 48 49 //FoundationBootnodes返回所操作的p2p引导节点的enode URL 50 //通过运行V5发现协议的基础。 51 func FoundationBootnodes() *Enodes { 52 nodes := &Enodes{nodes: make([]*discv5.Node, len(params.DiscoveryV5Bootnodes))} 53 for i, url := range params.DiscoveryV5Bootnodes { 54 nodes.nodes[i] = discv5.MustParseNode(url) 55 } 56 return nodes 57 } 58