decred.org/dcrdex@v1.0.5/dex/networks/firo/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 firo
     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  const (
    14  	DefaultFee          = 1  // 0.00001000 FIRO/kB
    15  	DefaultFeeRateLimit = 20 // 0.00020000 FIRO/kB
    16  )
    17  
    18  // Firo v0.14.12.1 defaults:
    19  // -fallbackfee= (default: 20000) 	wallet.h: DEFAULT_FALLBACK_FEE unused afaics
    20  // -mintxfee= (default: 1000)  		for tx creation
    21  // -maxtxfee= (default: 1000000000) 10 FIRO .. also looks unused
    22  // -minrelaytxfee= (default: 1000) 	0.00001 firo,
    23  // -blockmintxfee= (default: 1000)
    24  
    25  func mustHash(hash string) *chainhash.Hash {
    26  	h, err := chainhash.NewHashFromStr(hash)
    27  	if err != nil {
    28  		panic(err.Error())
    29  	}
    30  	return h
    31  }
    32  
    33  // Clone ports.
    34  var NetPorts = btc.NetPorts{
    35  	Mainnet: "8888",
    36  	Testnet: "18888",
    37  	Simnet:  "28888",
    38  }
    39  
    40  var (
    41  	UnitInfo = dex.UnitInfo{
    42  		AtomicUnit: "Sats",
    43  		Conventional: dex.Denomination{
    44  			Unit:             "FIRO",
    45  			ConversionFactor: 1e8,
    46  		},
    47  		Alternatives: []dex.Denomination{
    48  			{
    49  				Unit:             "mFIRO",
    50  				ConversionFactor: 1e5,
    51  			},
    52  			{
    53  				Unit:             "µFIRO",
    54  				ConversionFactor: 1e2,
    55  			},
    56  		},
    57  		FeeRateDenom: "B",
    58  	}
    59  
    60  	// MainNetParams are the clone parameters for mainnet.
    61  	MainNetParams = btc.ReadCloneParams(&btc.CloneParams{
    62  		Name:             "mainnet",
    63  		PubKeyHashAddrID: 0x52, // 82 - start with 'a' & occasionally 'Z'
    64  		ScriptHashAddrID: 0x07, // 07 - start with 3 or 4
    65  		Bech32HRPSegwit:  "",   // no segwit
    66  		CoinbaseMaturity: 100,
    67  		Net:              0xe3d9fef1,
    68  		GenesisHash:      mustHash("4381deb85b1b2c9843c222944b616d997516dcbd6a964e1eaf0def0830695233"),
    69  	})
    70  	// TestNetParams are the clone parameters for testnet.
    71  	TestNetParams = btc.ReadCloneParams(&btc.CloneParams{
    72  		Name:             "testnet3",
    73  		PubKeyHashAddrID: 0x41, // 65 - start with T
    74  		ScriptHashAddrID: 0xb2, // 178 - start with 2
    75  		Bech32HRPSegwit:  "",   // no segwit
    76  		CoinbaseMaturity: 100,
    77  		Net:              0xcffcbeea,
    78  		GenesisHash:      mustHash("aa22adcc12becaf436027ffe62a8fb21b234c58c23865291e5dc52cf53f64fca"),
    79  	})
    80  	// RegressionNetParams are the clone parameters for simnet.
    81  	RegressionNetParams = btc.ReadCloneParams(&btc.CloneParams{
    82  		Name:             "regtest",
    83  		PubKeyHashAddrID: 0x41, // 65 - start with T
    84  		ScriptHashAddrID: 0xb2, // 178 - start with 2
    85  		Bech32HRPSegwit:  "",   // no segwit
    86  		CoinbaseMaturity: 100,
    87  		// Net is not the standard for Firo simnet, since they never changed it
    88  		// from the BTC regtest value: 0xfabfb5da
    89  		// The only place we currently use Net is in btcd/chaincfg.Register,
    90  		// where it is checked to prevent duplicate registration, so our only
    91  		// requirement is that it is unique. This one was just generated with a prng.
    92  		Net:         0x7da7d6db,
    93  		GenesisHash: mustHash("a42b98f04cc2916e8adfb5d9db8a2227c4629bc205748ed2f33180b636ee885b"),
    94  	})
    95  )
    96  
    97  func init() {
    98  	for _, params := range []*chaincfg.Params{MainNetParams, TestNetParams, RegressionNetParams} {
    99  		err := chaincfg.Register(params)
   100  		if err != nil {
   101  			panic("failed to register firo parameters: " + err.Error())
   102  		}
   103  	}
   104  }