github.com/mit-dci/lit@v0.0.0-20221102210550-8c3d3b49f2ce/coinparam/dummyusd.go (about)

     1  package coinparam
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/mit-dci/lit/btcutil/chaincfg/chainhash"
     7  	"github.com/mit-dci/lit/wire"
     8  )
     9  
    10  // DummyUsdNetParams for DummyUsd fork defines the network parameters for the DummyUsd network.
    11  var DummyUsdNetParams = Params{
    12  	Name:          "dollar",
    13  	NetMagicBytes: 0x44535564,
    14  	DefaultPort:   "26999",
    15  	DNSSeeds:      []string{},
    16  
    17  	// Chain parameters
    18  	GenesisBlock: &DummyUsdGenesisBlock,
    19  	GenesisHash:  &DummyUsdGenesisHash,
    20  	PoWFunction: func(b []byte, height int32) chainhash.Hash {
    21  		return chainhash.DoubleHashH(b)
    22  	},
    23  	DiffCalcFunction: func(headers []*wire.BlockHeader, height int32, p *Params) (uint32, error) {
    24  		return p.PowLimitBits, nil
    25  	},
    26  	FeePerByte:               80,
    27  	PowLimit:                 regressionPowLimit,
    28  	PowLimitBits:             0x207fffff,
    29  	CoinbaseMaturity:         100,
    30  	SubsidyReductionInterval: 150,
    31  	TargetTimespan:           time.Hour * 24 * 14, // 14 days
    32  	TargetTimePerBlock:       time.Minute * 10,    // 10 minutes
    33  	RetargetAdjustmentFactor: 4,                   // 25% less, 400% more
    34  	ReduceMinDifficulty:      true,
    35  	MinDiffReductionTime:     time.Minute * 20, // TargetTimePerBlock * 2
    36  	GenerateSupported:        true,
    37  
    38  	// Checkpoints ordered from oldest to newest.
    39  	Checkpoints: nil,
    40  
    41  	// Enforce current block version once majority of the network has
    42  	// upgraded.
    43  	// 75% (750 / 1000)
    44  	// Reject previous block versions once a majority of the network has
    45  	// upgraded.
    46  	// 95% (950 / 1000)
    47  	BlockEnforceNumRequired: 750,
    48  	BlockRejectNumRequired:  950,
    49  	BlockUpgradeNumToCheck:  1000,
    50  
    51  	// Mempool parameters
    52  	RelayNonStdTxs: true,
    53  
    54  	// Address encoding magics
    55  	PubKeyHashAddrID: 0x1e, // starts with D
    56  	ScriptHashAddrID: 0x5a, // starts with d
    57  	PrivateKeyID:     0x83, // starts with u
    58  	Bech32Prefix:     "dusd",
    59  
    60  	// BIP32 hierarchical deterministic extended key magics
    61  	HDPrivateKeyID: [4]byte{0x04, 0xA5, 0xB3, 0xF4}, // starts with tprv
    62  	HDPublicKeyID:  [4]byte{0x04, 0xA5, 0xB7, 0x8F}, // starts with tpub
    63  
    64  	// BIP44 coin type used in the hierarchical deterministic path for
    65  	// address generation.
    66  	HDCoinType: 262,
    67  	TestCoin:   true,
    68  }
    69  
    70  var DummyUsdGenesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
    71  	0xd8, 0x69, 0x52, 0xad, 0x56, 0xac, 0xda, 0xe2,
    72  	0x32, 0x33, 0xa9, 0xb3, 0x24, 0x66, 0x27, 0x89,
    73  	0xf7, 0x39, 0x60, 0xa3, 0x7a, 0x17, 0xae, 0xf7,
    74  	0x69, 0x2e, 0xf0, 0x1b, 0x6d, 0x33, 0x4d, 0x19,
    75  })
    76  
    77  var DummyUsdGenesisMerkleRoot = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
    78  	0x7e, 0xb6, 0x28, 0xda, 0xa0, 0xd2, 0xef, 0x48,
    79  	0x1f, 0x45, 0x9f, 0x5b, 0x35, 0x47, 0x18, 0x41,
    80  	0xb6, 0x69, 0x20, 0xdc, 0x12, 0xa3, 0xbf, 0x94,
    81  	0x92, 0xca, 0xfe, 0xfc, 0x4e, 0xab, 0xb0, 0x72,
    82  })
    83  
    84  var DummyUsdGenesisCoinbaseTx = wire.MsgTx{
    85  	Version: 1,
    86  	TxIn: []*wire.TxIn{
    87  		{
    88  			PreviousOutPoint: wire.OutPoint{
    89  				Hash:  chainhash.Hash{},
    90  				Index: 0xffffffff,
    91  			},
    92  			SignatureScript: []byte{
    93  				0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x41,
    94  				0x49, 0x20, 0x77, 0x6f, 0x6e, 0x64, 0x65, 0x72,
    95  				0x20, 0x69, 0x66, 0x20, 0x70, 0x65, 0x6f, 0x70,
    96  				0x6c, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20,
    97  				0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x20, 0x74,
    98  				0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6a,
    99  				0x75, 0x73, 0x74, 0x20, 0x62, 0x69, 0x74, 0x63,
   100  				0x6f, 0x69, 0x6e, 0x20, 0x77, 0x69, 0x74, 0x68,
   101  				0x20, 0x61, 0x20, 0x66, 0x6c, 0x61, 0x76, 0x6f,
   102  				0x72,
   103  			},
   104  			Sequence: 0xffffffff,
   105  		},
   106  	},
   107  	TxOut: []*wire.TxOut{
   108  		{
   109  			Value: 0x12a05f200,
   110  			PkScript: []byte{
   111  				0x41, 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, /* |A.g....U| */
   112  				0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, /* |H'.g..q0| */
   113  				0xb7, 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, /* |..\..(.9| */
   114  				0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, /* |..yb...a| */
   115  				0xde, 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, /* |..I..?L.| */
   116  				0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, /* |8..U....| */
   117  				0x12, 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, /* |..\8M...| */
   118  				0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, /* |.W.Lp+k.| */
   119  				0x1d, 0x5f, 0xac, /* |._.| */
   120  			},
   121  		},
   122  	},
   123  	LockTime: 0,
   124  }
   125  
   126  // regTestGenesisBlock defines the genesis block of the block chain which serves
   127  // as the public transaction ledger for the regression test network.
   128  var DummyUsdGenesisBlock = wire.MsgBlock{
   129  	Header: wire.BlockHeader{
   130  		Version:    1,
   131  		PrevBlock:  chainhash.Hash{}, // 0000000000000000000000000000000000000000000000000000000000000000
   132  		MerkleRoot: DummyUsdGenesisMerkleRoot,
   133  		Timestamp:  time.Unix(1537252543, 0),
   134  		Bits:       0x207fffff,
   135  		Nonce:      0,
   136  	},
   137  	Transactions: []*wire.MsgTx{&DummyUsdGenesisCoinbaseTx},
   138  }