github.com/btcsuite/btcd@v0.24.0/params.go (about) 1 // Copyright (c) 2013-2016 The btcsuite developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "github.com/btcsuite/btcd/chaincfg" 9 "github.com/btcsuite/btcd/wire" 10 ) 11 12 // activeNetParams is a pointer to the parameters specific to the 13 // currently active bitcoin network. 14 var activeNetParams = &mainNetParams 15 16 // params is used to group parameters for various networks such as the main 17 // network and test networks. 18 type params struct { 19 *chaincfg.Params 20 rpcPort string 21 } 22 23 // mainNetParams contains parameters specific to the main network 24 // (wire.MainNet). NOTE: The RPC port is intentionally different than the 25 // reference implementation because btcd does not handle wallet requests. The 26 // separate wallet process listens on the well-known port and forwards requests 27 // it does not handle on to btcd. This approach allows the wallet process 28 // to emulate the full reference implementation RPC API. 29 var mainNetParams = params{ 30 Params: &chaincfg.MainNetParams, 31 rpcPort: "8334", 32 } 33 34 // regressionNetParams contains parameters specific to the regression test 35 // network (wire.TestNet). NOTE: The RPC port is intentionally different 36 // than the reference implementation - see the mainNetParams comment for 37 // details. 38 var regressionNetParams = params{ 39 Params: &chaincfg.RegressionNetParams, 40 rpcPort: "18334", 41 } 42 43 // testNet3Params contains parameters specific to the test network (version 3) 44 // (wire.TestNet3). NOTE: The RPC port is intentionally different than the 45 // reference implementation - see the mainNetParams comment for details. 46 var testNet3Params = params{ 47 Params: &chaincfg.TestNet3Params, 48 rpcPort: "18334", 49 } 50 51 // simNetParams contains parameters specific to the simulation test network 52 // (wire.SimNet). 53 var simNetParams = params{ 54 Params: &chaincfg.SimNetParams, 55 rpcPort: "18556", 56 } 57 58 // sigNetParams contains parameters specific to the Signet network 59 // (wire.SigNet). 60 var sigNetParams = params{ 61 Params: &chaincfg.SigNetParams, 62 rpcPort: "38332", 63 } 64 65 // netName returns the name used when referring to a bitcoin network. At the 66 // time of writing, btcd currently places blocks for testnet version 3 in the 67 // data and log directory "testnet", which does not match the Name field of the 68 // chaincfg parameters. This function can be used to override this directory 69 // name as "testnet" when the passed active network matches wire.TestNet3. 70 // 71 // A proper upgrade to move the data and log directories for this network to 72 // "testnet3" is planned for the future, at which point this function can be 73 // removed and the network parameter's name used instead. 74 func netName(chainParams *params) string { 75 switch chainParams.Net { 76 case wire.TestNet3: 77 return "testnet" 78 default: 79 return chainParams.Name 80 } 81 }