decred.org/dcrdex@v1.0.3/dex/networks/dash/params.go (about)

     1  // This code is available on the terms of the project LICENSE.md file,
     2  // also available online at https://blueoakcouncil.org
     3  
     4  package dash
     5  
     6  import (
     7  	"decred.org/dcrdex/dex"
     8  	"decred.org/dcrdex/dex/networks/btc"
     9  	"github.com/btcsuite/btcd/chaincfg"
    10  	"github.com/btcsuite/btcd/chaincfg/chainhash"
    11  )
    12  
    13  func mustHash(hash string) *chainhash.Hash {
    14  	h, err := chainhash.NewHashFromStr(hash)
    15  	if err != nil {
    16  		panic(err.Error())
    17  	}
    18  	return h
    19  }
    20  
    21  const (
    22  	DefaultFee          = 1  // 1 sat/byte
    23  	DefaultFeeRateLimit = 20 // 20 sats/byte
    24  )
    25  
    26  var (
    27  	UnitInfo = dex.UnitInfo{
    28  		AtomicUnit: "Sats",
    29  		Conventional: dex.Denomination{
    30  			Unit:             "DASH",
    31  			ConversionFactor: 1e8,
    32  		},
    33  		Alternatives: []dex.Denomination{
    34  			{
    35  				Unit:             "mDASH",
    36  				ConversionFactor: 1e5,
    37  			},
    38  			{
    39  				Unit:             "µDASH",
    40  				ConversionFactor: 1e2,
    41  			},
    42  		},
    43  		FeeRateDenom: "B",
    44  	}
    45  
    46  	// MainNetParams are the clone parameters for mainnet.
    47  	MainNetParams = btc.ReadCloneParams(&btc.CloneParams{
    48  		Name:             "mainnet",
    49  		PubKeyHashAddrID: 0x4c, // (76) starts with X
    50  		ScriptHashAddrID: 0x10, // (16) starts with 7
    51  		Bech32HRPSegwit:  "",   // no segwit
    52  		CoinbaseMaturity: 100,
    53  		Net:              0xbf0c6bbd,
    54  		HDPrivateKeyID:   [4]byte{0x04, 0x88, 0xAD, 0xE4}, // starts with xprv
    55  		HDPublicKeyID:    [4]byte{0x04, 0x88, 0xB2, 0x1E}, // starts with xpub
    56  		GenesisHash:      mustHash("00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6"),
    57  	})
    58  	// TestNetParams are the clone parameters for testnet.
    59  	TestNetParams = btc.ReadCloneParams(&btc.CloneParams{
    60  		Name:             "testnet3",
    61  		PubKeyHashAddrID: 0x8c, // (140) starts with y
    62  		ScriptHashAddrID: 0x13, // (19) starts with 6 or 9
    63  		Bech32HRPSegwit:  "",   // no segwit
    64  		CoinbaseMaturity: 100,
    65  		// The real dash value 0xcee2caff is duplicated with several coins. This
    66  		// is pseudo-ransomly generated and is currently unique across dcrdex netids.
    67  		Net:            0x881823,
    68  		HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with tprv
    69  		HDPublicKeyID:  [4]byte{0x04, 0x35, 0x87, 0xCF}, // starts with tpub
    70  		GenesisHash:    mustHash("00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c"),
    71  	})
    72  	// RegressionNetParams are the clone parameters for simnet.
    73  	RegressionNetParams = btc.ReadCloneParams(&btc.CloneParams{
    74  		Name:             "regtest",
    75  		PubKeyHashAddrID: 0x8c, // (140) starts with y
    76  		ScriptHashAddrID: 0x13, // (19) starts with 6 or 9
    77  		Bech32HRPSegwit:  "",   // no segwit
    78  		CoinbaseMaturity: 100,
    79  		// The real dash value 0xfcc1b7dc is duplicated with several coins. This
    80  		// is pseudo-ransomly generated and is currently unique across dcrdex netids.
    81  		// See Also:
    82  		// https://github.com/dan-da/coinparams/blob/master/coinparams.json
    83  		Net:            0x848a5332,
    84  		HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with tprv
    85  		HDPublicKeyID:  [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with tpub
    86  		GenesisHash:    mustHash("000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"),
    87  	})
    88  )
    89  
    90  func init() {
    91  	for _, params := range []*chaincfg.Params{MainNetParams, TestNetParams, RegressionNetParams} {
    92  		err := chaincfg.Register(params)
    93  		if err != nil {
    94  			panic("failed to register dash parameters: " + err.Error())
    95  		}
    96  	}
    97  }