public AbstractLitecoinParams() { super(); interval = LITE_INTERVAL; targetTimespan = LITE_TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1e0fffffL); packetMagic = 0xfbc0b6db; bip32HeaderPub = 0x0488C42E; //The 4 byte header that serializes in base58 to "xpub". (?) bip32HeaderPriv = 0x0488E1F4; //The 4 byte header that serializes in base58 to "xprv" (?) }
/** * Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the * target is represented using a compact form. If this form decodes to a value that is out of bounds, an exception * is thrown. */ public BigInteger getDifficultyTargetAsInteger() throws VerificationException { BigInteger target = Utils.decodeCompactBits(difficultyTarget); if (target.signum() <= 0 || target.compareTo(params.maxTarget) > 0) throw new VerificationException("Difficulty target is bad: " + target.toString()); return target; }
/** * Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the * target is represented using a compact form. If this form decodes to a value that is out of bounds, an exception * is thrown. */ public BigInteger getDifficultyTargetAsInteger() throws VerificationException { BigInteger target = Utils.decodeCompactBits(difficultyTarget); if (target.signum() <= 0 || target.compareTo(params.maxTarget) > 0) throw new VerificationException("Difficulty target is bad: " + target.toString()); return target; }
/** * Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the * target is represented using a compact form. If this form decodes to a value that is out of bounds, an exception * is thrown. */ public BigInteger getDifficultyTargetAsInteger() throws VerificationException { BigInteger target = Utils.decodeCompactBits(difficultyTarget); if (target.signum() <= 0 || target.compareTo(params.maxTarget) > 0) throw new VerificationException("Difficulty target is bad: " + target.toString()); return target; }
/** * Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the * target is represented using a compact form. If this form decodes to a value that is out of bounds, an exception * is thrown. */ public BigInteger getDifficultyTargetAsInteger() throws VerificationException { BigInteger target = Utils.decodeCompactBits(difficultyTarget); if (target.signum() <= 0 || target.compareTo(params.maxTarget) > 0) throw new VerificationException("Difficulty target is bad: " + target.toString()); return target; }
public AbstractNamecoinParams() { super(); genesisBlock = createGenesis(this); interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1e0fffffL); // TODO: figure out the Namecoin value of this // BIP 43 recommends using these values regardless of which blockchain is in use. bip32HeaderPub = 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub". bip32HeaderPriv = 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv" }
public AbstractDogecoinParams(final int setDiffChangeTarget) { super(); genesisBlock = createGenesis(this); interval = DOGE_INTERVAL; newInterval = DOGE_INTERVAL_NEW; targetTimespan = DOGE_TARGET_TIMESPAN; newTargetTimespan = DOGE_TARGET_TIMESPAN_NEW; maxTarget = Utils.decodeCompactBits(0x1e0fffffL); diffChangeTarget = setDiffChangeTarget; packetMagic = 0xc0c0c0c0; bip32HeaderPub = 0x0488C42E; //The 4 byte header that serializes in base58 to "xpub". (?) bip32HeaderPriv = 0x0488E1F4; //The 4 byte header that serializes in base58 to "xprv" (?) }
BigInteger newTarget = Utils.decodeCompactBits(lastDifficultyTarget); newTarget = newTarget.multiply(BigInteger.valueOf(actualTime)); newTarget = newTarget.divide(BigInteger.valueOf(retargetTimespan));
public LitecoinTestNet3Params() { super(); id = ID_LITE_TESTNET; // Genesis hash is f5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f packetMagic = 0xfcc1b7dc; maxTarget = Utils.decodeCompactBits(0x1e0fffffL); port = 19333; addressHeader = 111; p2shHeader = 196; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; dumpedPrivateKeyHeader = 239; this.genesisBlock = createGenesis(this); spendableCoinbaseDepth = 30; subsidyDecreaseBlockCount = 100000; String genesisHash = genesisBlock.getHashAsString(); checkState(genesisHash.equals("f5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f")); alertSigningKey = Hex.decode("0449623fc74489a947c4b15d579115591add020e53b3490bf47297dfa3762250625f8ecc2fb4fc59f69bdce8f7080f3167808276ed2c79d297054367566038aa82"); majorityEnforceBlockUpgrade = TESTNET_MAJORITY_ENFORCE_BLOCK_UPGRADE; majorityRejectBlockOutdated = TESTNET_MAJORITY_REJECT_BLOCK_OUTDATED; majorityWindow = TESTNET_MAJORITY_WINDOW; dnsSeeds = new String[] { "testnet-seed.litecointools.com", "testnet-seed.ltc.xurious.com", "dnsseed.wemine-testnet.com" }; bip32HeaderPub = 0x043587CF; bip32HeaderPriv = 0x04358394; }
public LitecoinMainNetParams() { super(); id = ID_LITE_MAINNET; // Genesis hash is 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2 packetMagic = 0xfbc0b6db; maxTarget = Utils.decodeCompactBits(0x1e0fffffL); port = 9333; addressHeader = 48; p2shHeader = 5; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; dumpedPrivateKeyHeader = 176; this.genesisBlock = createGenesis(this); spendableCoinbaseDepth = 100; subsidyDecreaseBlockCount = 840000; String genesisHash = genesisBlock.getHashAsString(); checkState(genesisHash.equals("12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2")); alertSigningKey = Hex.decode("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9"); majorityEnforceBlockUpgrade = MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE; majorityRejectBlockOutdated = MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED; majorityWindow = MAINNET_MAJORITY_WINDOW; dnsSeeds = new String[] { "dnsseed.litecointools.com", "dnsseed.litecoinpool.org", "dnsseed.ltc.xurious.com", "dnsseed.koin-project.com", "dnsseed.weminemnc.com" }; bip32HeaderPub = 0x0488B21E; bip32HeaderPriv = 0x0488ADE4; }
interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1d00ffffL); port = 18333; addressHeader = 111;
public TestNet2Params() { super(); id = ID_TESTNET; packetMagic = 0xfabfb5daL; port = 18333; addressHeader = 111; p2shHeader = 196; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1d0fffffL); dumpedPrivateKeyHeader = 239; genesisBlock.setTime(1296688602L); genesisBlock.setDifficultyTarget(0x1d07fff8L); genesisBlock.setNonce(384568319); spendableCoinbaseDepth = 100; subsidyDecreaseBlockCount = 210000; String genesisHash = genesisBlock.getHashAsString(); checkState(genesisHash.equals("00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008")); dnsSeeds = null; addrSeeds = null; bip32HeaderPub = 0x043587CF; bip32HeaderPriv = 0x04358394; majorityEnforceBlockUpgrade = TESTNET_MAJORITY_ENFORCE_BLOCK_UPGRADE; majorityRejectBlockOutdated = TESTNET_MAJORITY_REJECT_BLOCK_OUTDATED; majorityWindow = TESTNET_MAJORITY_WINDOW; }
public TestNet2Params() { super(); id = ID_TESTNET; packetMagic = 0xfabfb5daL; port = 18333; addressHeader = 111; p2shHeader = 196; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1d0fffffL); dumpedPrivateKeyHeader = 239; genesisBlock.setTime(1296688602L); genesisBlock.setDifficultyTarget(0x1d07fff8L); genesisBlock.setNonce(384568319); spendableCoinbaseDepth = 100; subsidyDecreaseBlockCount = 210000; String genesisHash = genesisBlock.getHashAsString(); checkState(genesisHash.equals("00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008")); dnsSeeds = null; addrSeeds = null; bip32HeaderPub = 0x043587CF; bip32HeaderPriv = 0x04358394; majorityEnforceBlockUpgrade = TESTNET_MAJORITY_ENFORCE_BLOCK_UPGRADE; majorityRejectBlockOutdated = TESTNET_MAJORITY_REJECT_BLOCK_OUTDATED; majorityWindow = TESTNET_MAJORITY_WINDOW; }
public TestNet2Params() { super(); id = ID_TESTNET; packetMagic = 0xdab5bffaL; port = 18333; addressHeader = 111; p2shHeader = 196; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1d0fffffL); dumpedPrivateKeyHeader = 239; genesisBlock.setTime(1296688602L); genesisBlock.setDifficultyTarget(0x1d07fff8L); genesisBlock.setNonce(384568319); spendableCoinbaseDepth = 100; subsidyDecreaseBlockCount = 210000; String genesisHash = genesisBlock.getHashAsString(); checkState(genesisHash.equals("00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008")); dnsSeeds = null; addrSeeds = null; bip32HeaderPub = 0x043587CF; bip32HeaderPriv = 0x04358394; majorityEnforceBlockUpgrade = TESTNET_MAJORITY_ENFORCE_BLOCK_UPGRADE; majorityRejectBlockOutdated = TESTNET_MAJORITY_REJECT_BLOCK_OUTDATED; majorityWindow = TESTNET_MAJORITY_WINDOW; /** Activation time at which the cash HF kicks in. */ cashHardForkActivationTime = 1510600000; daaHeight = 1188697; }
interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1d00ffffL); port = 18333; addressHeader = 111;
interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; maxTarget = Utils.decodeCompactBits(0x1d00ffffL); port = 18333; addressHeader = 111;
public DogecoinTestNet3Params() { super(DIFFICULTY_CHANGE_TARGET); id = ID_DOGE_TESTNET; packetMagic = 0xfcc1b7dc; maxTarget = Utils.decodeCompactBits(0x1e0fffffL); port = 44556; addressHeader = 113; p2shHeader = 196; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; dumpedPrivateKeyHeader = 241; genesisBlock.setTime(1391503289L); genesisBlock.setDifficultyTarget(0x1e0ffff0L); genesisBlock.setNonce(997879); spendableCoinbaseDepth = 30; subsidyDecreaseBlockCount = 100000; String genesisHash = genesisBlock.getHashAsString(); checkState(genesisHash.equals("bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e")); alertSigningKey = Hex.decode("042756726da3c7ef515d89212ee1705023d14be389e25fe15611585661b9a20021908b2b80a3c7200a0139dd2b26946606aab0eef9aa7689a6dc2c7eee237fa834"); majorityEnforceBlockUpgrade = TESTNET_MAJORITY_ENFORCE_BLOCK_UPGRADE; majorityRejectBlockOutdated = TESTNET_MAJORITY_REJECT_BLOCK_OUTDATED; majorityWindow = TESTNET_MAJORITY_WINDOW; dnsSeeds = new String[] { "testseed.jrn.me.uk" }; // Note this is the same as the BIP32 testnet, as BIP44 makes HD wallets // chain agnostic. Dogecoin mainnet has its own headers for legacy reasons. bip32HeaderPub = 0x043587CF; bip32HeaderPriv = 0x04358394; }
@Test public void compactEncoding() throws Exception { assertEquals(new BigInteger("1234560000", 16), Utils.decodeCompactBits(0x05123456L)); assertEquals(new BigInteger("c0de000000", 16), Utils.decodeCompactBits(0x0600c0de)); assertEquals(0x05123456L, Utils.encodeCompactBits(new BigInteger("1234560000", 16))); assertEquals(0x0600c0deL, Utils.encodeCompactBits(new BigInteger("c0de000000", 16))); }
timespan = targetTimespan * 4; BigInteger newTarget = Utils.decodeCompactBits(prev.getDifficultyTarget()); newTarget = newTarget.multiply(BigInteger.valueOf(timespan)); newTarget = newTarget.divide(BigInteger.valueOf(targetTimespan));
timespan = targetTimespan * 4; BigInteger newTarget = Utils.decodeCompactBits(prev.getDifficultyTarget()); newTarget = newTarget.multiply(BigInteger.valueOf(timespan)); newTarget = newTarget.divide(BigInteger.valueOf(targetTimespan));