/* * Copyright 2013 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.bitcoin.params; import com.google.bitcoin.core.CoinDefinition; import com.google.bitcoin.core.NetworkParameters; import com.google.bitcoin.core.Utils; import org.spongycastle.util.encoders.Hex; import static com.google.common.base.Preconditions.checkState; /** * Parameters for the testnet, a separate public instance of Bitcoin that has relaxed rules suitable for development * and testing of applications and new Bitcoin versions. */ public class TestNet3Params extends NetworkParameters { public TestNet3Params() { super(); id = ID_TESTNET; // Genesis hash is 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 packetMagic = 0x0b110907; interval = INTERVAL; targetTimespan = TARGET_TIMESPAN; proofOfWorkLimit = Utils.decodeCompactBits(0x1d00ffffL); port = 18333; addressHeader = CoinDefinition.testnetAddressHeader; p2shHeader = CoinDefinition.testnetp2shHeader; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; dumpedPrivateKeyHeader = 128 + CoinDefinition.testnetAddressHeader; genesisBlock.setTime(CoinDefinition.testnetGenesisBlockTime); genesisBlock.setDifficultyTarget(CoinDefinition.testnetGenesisBlockDifficultyTarget); genesisBlock.setNonce(CoinDefinition.testnetGenesisBlockNonce); spendableCoinbaseDepth = 100; subsidyDecreaseBlockCount = CoinDefinition.subsidyDecreaseBlockCount; String genesisHash = genesisBlock.getHashAsString(); if(CoinDefinition.supportsTestNet) checkState(genesisHash.equals(CoinDefinition.testnetGenesisHash)); alertSigningKey = Hex.decode(CoinDefinition.TESTNET_SATOSHI_KEY); dnsSeeds = CoinDefinition.dnsSeeds; } private static TestNet3Params instance; public static synchronized TestNet3Params get() { if (instance == null) { instance = new TestNet3Params(); } return instance; } public String getPaymentProtocolId() { return PAYMENT_PROTOCOL_ID_TESTNET; } }