github.com/mit-dci/lit@v0.0.0-20221102210550-8c3d3b49f2ce/coinparam/litecoin.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  	"golang.org/x/crypto/scrypt"
    10  )
    11  
    12  // LiteCoinTestNet4Params are the parameters for the litecoin test network 4.
    13  var LiteCoinTestNet4Params = Params{
    14  	Name:          "litetest4",
    15  	NetMagicBytes: 0xf1c8d2fd,
    16  	DefaultPort:   "19335",
    17  	DNSSeeds: []string{
    18  		"testnet-seed.litecointools.com",
    19  		"seed-b.litecoin.loshan.co.uk",
    20  		"dnsseed-testnet.thrasher.io",
    21  	},
    22  
    23  	// Chain parameters
    24  	GenesisBlock: &bc2GenesisBlock, // no it's not
    25  	GenesisHash:  &liteCoinTestNet4GenesisHash,
    26  	PoWFunction: func(b []byte, height int32) chainhash.Hash {
    27  		scryptBytes, _ := scrypt.Key(b, b, 1024, 1, 1, 32)
    28  		asChainHash, _ := chainhash.NewHash(scryptBytes)
    29  		return *asChainHash
    30  	},
    31  	DiffCalcFunction: diffBitcoin,
    32  	StartHeader: [80]byte{
    33  		0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    34  		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    35  		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    36  		0xd9, 0xce, 0xd4, 0xed, 0x11, 0x30, 0xf7, 0xb7, 0xfa, 0xad, 0x9b, 0xe2,
    37  		0x53, 0x23, 0xff, 0xaf, 0xa3, 0x32, 0x32, 0xa1, 0x7c, 0x3e, 0xdf, 0x6c,
    38  		0xfd, 0x97, 0xbe, 0xe6, 0xba, 0xfb, 0xdd, 0x97, 0xf6, 0x0b, 0xa1, 0x58,
    39  		0xf0, 0xff, 0x0f, 0x1e, 0xe1, 0x79, 0x04, 0x00,
    40  	},
    41  	StartHeight:              48384,
    42  	AssumeDiffBefore:         50401,
    43  	FeePerByte:               800,
    44  	PowLimit:                 liteCoinTestNet4PowLimit,
    45  	PowLimitBits:             0x1e0fffff,
    46  	CoinbaseMaturity:         100,
    47  	SubsidyReductionInterval: 840000,
    48  	TargetTimespan:           time.Hour * 84,    // 84 hours
    49  	TargetTimePerBlock:       time.Second * 150, // 150 seconds
    50  	RetargetAdjustmentFactor: 4,                 // 25% less, 400% more
    51  	ReduceMinDifficulty:      true,
    52  	MinDiffReductionTime:     time.Minute * 10, // ?? unknown
    53  	GenerateSupported:        false,
    54  
    55  	// Checkpoints ordered from oldest to newest.
    56  	Checkpoints: []Checkpoint{},
    57  
    58  	// Enforce current block version once majority of the network has
    59  	// upgraded.
    60  	// 51% (51 / 100)
    61  	// Reject previous block versions once a majority of the network has
    62  	// upgraded.
    63  	// 75% (75 / 100)
    64  	BlockEnforceNumRequired: 51,
    65  	BlockRejectNumRequired:  75,
    66  	BlockUpgradeNumToCheck:  100,
    67  
    68  	// Mempool parameters
    69  	RelayNonStdTxs: true,
    70  
    71  	// Address encoding magics
    72  	PubKeyHashAddrID: 0x6f, // starts with m or n
    73  	ScriptHashAddrID: 0xc4, // starts with 2
    74  	Bech32Prefix:     "tltc",
    75  	PrivateKeyID:     0xef, // starts with 9 7(uncompressed) or c (compressed)
    76  
    77  	// BIP32 hierarchical deterministic extended key magics
    78  	HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with tprv
    79  	HDPublicKeyID:  [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with tpub
    80  
    81  	// BIP44 coin type used in the hierarchical deterministic path for
    82  	// address generation.
    83  	HDCoinType: 65537, // i dunno, 0x010001 ?
    84  }
    85  
    86  // LiteCoinTestNet4Params are the parameters for the litecoin test network 4.
    87  var LiteRegNetParams = Params{
    88  	Name:          "litereg",
    89  	NetMagicBytes: 0xdab5bffa,
    90  	DefaultPort:   "19444",
    91  	DNSSeeds:      []string{},
    92  
    93  	// Chain parameters
    94  	GenesisBlock: &liteCoinRegTestGenesisBlock, // no it's not
    95  	GenesisHash:  &liteCoinRegTestGenesisHash,
    96  	PoWFunction: func(b []byte, height int32) chainhash.Hash {
    97  		scryptBytes, _ := scrypt.Key(b, b, 1024, 1, 1, 32)
    98  		asChainHash, _ := chainhash.NewHash(scryptBytes)
    99  		return *asChainHash
   100  	},
   101  	DiffCalcFunction:         diffBitcoin,
   102  	FeePerByte:               800,
   103  	PowLimit:                 regressionPowLimit,
   104  	PowLimitBits:             0x207fffff,
   105  	CoinbaseMaturity:         100,
   106  	SubsidyReductionInterval: 150,
   107  	TargetTimespan:           time.Hour * 84,    // 84 hours (3.5 days)
   108  	TargetTimePerBlock:       time.Second * 150, // 150 seconds (2.5 min)
   109  	RetargetAdjustmentFactor: 4,                 // 25% less, 400% more
   110  	ReduceMinDifficulty:      true,
   111  	MinDiffReductionTime:     time.Minute * 10, // ?? unknown
   112  	GenerateSupported:        true,
   113  
   114  	// Checkpoints ordered from oldest to newest.
   115  	Checkpoints: []Checkpoint{},
   116  
   117  	// Enforce current block version once majority of the network has
   118  	// upgraded.
   119  	// 51% (51 / 100)
   120  	// Reject previous block versions once a majority of the network has
   121  	// upgraded.
   122  	// 75% (75 / 100)
   123  	BlockEnforceNumRequired: 51,
   124  	BlockRejectNumRequired:  75,
   125  	BlockUpgradeNumToCheck:  100,
   126  
   127  	// Mempool parameters
   128  	RelayNonStdTxs: true,
   129  
   130  	// Address encoding magics
   131  	PubKeyHashAddrID: 0x6f, // starts with m or n
   132  	ScriptHashAddrID: 0xc4, // starts with 2
   133  	Bech32Prefix:     "rltc",
   134  	PrivateKeyID:     0xef, // starts with 9 7(uncompressed) or c (compressed)
   135  
   136  	// BIP32 hierarchical deterministic extended key magics
   137  	HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with tprv
   138  	HDPublicKeyID:  [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with tpub
   139  
   140  	// BIP44 coin type used in the hierarchical deterministic path for
   141  	// address generation.
   142  	HDCoinType: 258, // i dunno
   143  	TestCoin:   true,
   144  }
   145  
   146  // liteCoinTestNet4GenesisHash is the first hash in litecoin testnet4
   147  var liteCoinTestNet4GenesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
   148  	0xa0, 0x29, 0x3e, 0x4e, 0xeb, 0x3d, 0xa6, 0xe6, 0xf5, 0x6f, 0x81, 0xed,
   149  	0x59, 0x5f, 0x57, 0x88, 0x0d, 0x1a, 0x21, 0x56, 0x9e, 0x13, 0xee, 0xfd,
   150  	0xd9, 0x51, 0x28, 0x4b, 0x5a, 0x62, 0x66, 0x49,
   151  })
   152  
   153  var liteCoinTestNet4MerkleRoot = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
   154  	0xd9, 0xce, 0xd4, 0xed, 0x11, 0x30, 0xf7, 0xb7, 0xfa, 0xad, 0x9b, 0xe2,
   155  	0x53, 0x23, 0xff, 0xaf, 0xa3, 0x32, 0x32, 0xa1, 0x7c, 0x3e, 0xdf, 0x6c,
   156  	0xfd, 0x97, 0xbe, 0xe6, 0xba, 0xfb, 0xdd, 0x97,
   157  })
   158  
   159  // liteCoinTestNet4GenesisBlock has is like completely its own thing
   160  var liteCoinTestNet4GenesisBlock = wire.MsgBlock{
   161  	Header: wire.BlockHeader{
   162  		Version:    1,
   163  		PrevBlock:  chainhash.Hash{}, // empty
   164  		MerkleRoot: liteCoinTestNet4MerkleRoot,
   165  		Timestamp:  time.Unix(1486949366, 0), // later
   166  		Bits:       0x1e0ffff0,
   167  		Nonce:      293345,
   168  	},
   169  	//	Transactions: []*wire.MsgTx{&genesisCoinbaseTx}, // this is wrong... will it break?
   170  }
   171  
   172  // ==================== LiteRegNet
   173  
   174  // liteCoinRegTestGenesisHash is the first hash in litecoin regtest
   175  var liteCoinRegTestGenesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
   176  	0xf9, 0x16, 0xc4, 0x56, 0xfc, 0x51, 0xdf, 0x62,
   177  	0x78, 0x85, 0xd7, 0xd6, 0x74, 0xed, 0x02, 0xdc,
   178  	0x88, 0xa2, 0x25, 0xad, 0xb3, 0xf0, 0x2a, 0xd1,
   179  	0x3e, 0xb4, 0x93, 0x8f, 0xf3, 0x27, 0x08, 0x53,
   180  })
   181  
   182  // is this the same...?
   183  var liteCoinRegTestMerkleRoot = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
   184  	0xd9, 0xce, 0xd4, 0xed, 0x11, 0x30, 0xf7, 0xb7, 0xfa, 0xad, 0x9b, 0xe2,
   185  	0x53, 0x23, 0xff, 0xaf, 0xa3, 0x32, 0x32, 0xa1, 0x7c, 0x3e, 0xdf, 0x6c,
   186  	0xfd, 0x97, 0xbe, 0xe6, 0xba, 0xfb, 0xdd, 0x97,
   187  })
   188  
   189  // liteCoinTestNet4GenesisBlock has is like completely its own thing
   190  var liteCoinRegTestGenesisBlock = wire.MsgBlock{
   191  	Header: wire.BlockHeader{
   192  		Version:    1,
   193  		PrevBlock:  chainhash.Hash{}, // empty
   194  		MerkleRoot: liteCoinRegTestMerkleRoot,
   195  		Timestamp:  time.Unix(1296688602, 0), // later
   196  		Bits:       0x207fffff,
   197  		Nonce:      0,
   198  	},
   199  	//	Transactions: []*wire.MsgTx{&genesisCoinbaseTx}, // this is wrong... will it break?
   200  }