github.com/cerberus-wallet/blockbook@v0.3.2/bchain/coins/digibyte/digibyteparser.go (about) 1 package digibyte 2 3 import ( 4 "blockbook/bchain/coins/btc" 5 6 "github.com/martinboehm/btcd/wire" 7 "github.com/martinboehm/btcutil/chaincfg" 8 ) 9 10 const ( 11 // MainnetMagic is mainnet network constant 12 MainnetMagic wire.BitcoinNet = 0xdab6c3fa 13 ) 14 15 var ( 16 // MainNetParams are parser parameters for mainnet 17 MainNetParams chaincfg.Params 18 ) 19 20 func init() { 21 MainNetParams = chaincfg.MainNetParams 22 MainNetParams.Net = MainnetMagic 23 MainNetParams.PubKeyHashAddrID = []byte{30} 24 MainNetParams.ScriptHashAddrID = []byte{63} 25 MainNetParams.Bech32HRPSegwit = "dgb" 26 } 27 28 // DigiByteParser handle 29 type DigiByteParser struct { 30 *btc.BitcoinParser 31 } 32 33 // NewDigiByteParser returns new VertcoinParser instance 34 func NewDigiByteParser(params *chaincfg.Params, c *btc.Configuration) *DigiByteParser { 35 return &DigiByteParser{BitcoinParser: btc.NewBitcoinParser(params, c)} 36 } 37 38 // GetChainParams contains network parameters for the main DigiByte network 39 func GetChainParams(chain string) *chaincfg.Params { 40 if !chaincfg.IsRegistered(&MainNetParams) { 41 err := chaincfg.Register(&MainNetParams) 42 if err != nil { 43 panic(err) 44 } 45 } 46 return &MainNetParams 47 }