From 232d2cd51df4dc3ef8a4328d17e0f0d9194e48db Mon Sep 17 00:00:00 2001 From: Simon Vermeersch Date: Sat, 22 Sep 2012 17:27:46 +0200 Subject: [PATCH] testnet3 --- .../bitcoin/core/NetworkParameters.java | 30 +++++++++++++++++++ .../bitcoin/discovery/IrcDiscovery.java | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java b/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java index e8accf5d..afa45536 100644 --- a/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java +++ b/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java @@ -141,6 +141,30 @@ public class NetworkParameters implements Serializable { public static final int TARGET_SPACING = 10 * 60; // 10 minutes per block. public static final int INTERVAL = TARGET_TIMESPAN / TARGET_SPACING; + /** Sets up the given Networkparemets with testnet3 values. */ + private static NetworkParameters createTestNet3(NetworkParameters n) { + // Genesis hash is 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 + n.proofOfWorkLimit = Utils.decodeCompactBits(0x1d00ffffL); + n.packetMagic = 0x0b110907; + n.port = 18333; + n.addressHeader = 111; + n.acceptableAddressCodes = new int[] { 111 }; + n.dumpedPrivateKeyHeader = 239; + n.interval = INTERVAL; + n.targetTimespan = TARGET_TIMESPAN; + n.alertSigningKey = SATOSHI_KEY; + n.genesisBlock = createGenesis(n); + n.genesisBlock.setTime(1296688602L); + n.genesisBlock.setDifficultyTarget(0x1d00ffffL); + n.genesisBlock.setNonce(414098458); + n.setSpendableCoinbaseDepth(100); + n.id = ID_TESTNET; + String genesisHash = n.genesisBlock.getHashAsString(); + checkState(genesisHash.equals("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"), + genesisHash); + return n; + } + /** Sets up the given NetworkParameters with testnet values. */ private static NetworkParameters createTestNet(NetworkParameters n) { // Genesis hash is 0000000224b1593e3ff16a0e3b61285bbc393a39f78c8aa48c456142671f7110 @@ -171,6 +195,12 @@ public class NetworkParameters implements Serializable { return createTestNet(n); } + /** The testnet3 chain created by Gavin, included in Bitcoin 0.7. */ + public static NetworkParameters testNet3() { + NetworkParameters n = new NetworkParameters(); + return createTestNet3(n); + } + /** The primary BitCoin chain created by Satoshi. */ public static NetworkParameters prodNet() { NetworkParameters n = new NetworkParameters(); diff --git a/core/src/main/java/com/google/bitcoin/discovery/IrcDiscovery.java b/core/src/main/java/com/google/bitcoin/discovery/IrcDiscovery.java index 1d41abd1..3a1aa5fb 100644 --- a/core/src/main/java/com/google/bitcoin/discovery/IrcDiscovery.java +++ b/core/src/main/java/com/google/bitcoin/discovery/IrcDiscovery.java @@ -48,7 +48,7 @@ public class IrcDiscovery implements PeerDiscovery { * Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then * disconnecting. * - * @param channel The IRC channel to join, either "#bitcoin" or "#bitcoinTEST" for the production and test networks + * @param channel The IRC channel to join, either "#bitcoin" or "#bitcoinTEST3" for the production and test networks * respectively. */ public IrcDiscovery(String channel) { @@ -60,7 +60,7 @@ public class IrcDiscovery implements PeerDiscovery { * disconnecting. * * @param server Name or textual IP address of the IRC server to join. - * @param channel The IRC channel to join, either "#bitcoin" or "#bitcoinTEST" for the production and test networks + * @param channel The IRC channel to join, either "#bitcoin" or "#bitcoinTEST3" for the production and test networks */ public IrcDiscovery(String channel, String server, int port) { this.channel = channel;