com.google.bitcoin.core
Class NetworkParameters

java.lang.Object
  extended by com.google.bitcoin.core.NetworkParameters
All Implemented Interfaces:
Serializable

public class NetworkParameters
extends Object
implements Serializable

NetworkParameters contains the data needed for working with an instantiation of a BitCoin chain. Currently there are only two, the production chain and the test chain. But in future as BitCoin evolves there may be more. You can create your own as long as they don't conflict.

See Also:
Serialized Form

Field Summary
 int addressHeader
          First byte of a base58 encoded address.
 int dumpedPrivateKeyHeader
          First byte of a base58 encoded dumped private key.
 Block genesisBlock
          Genesis block for this chain.
 int interval
          How many blocks pass between difficulty adjustment periods.
 long packetMagic
          The header bytes that identify the start of a packet on this network.
 int port
          Default TCP port on which to connect to nodes.
 BigInteger proofOfWorkLimit
          What the easiest allowable proof of work should be.
static int PROTOCOL_VERSION
          The protocol version this library implements.
 int targetTimespan
          How much time in seconds is supposed to pass between "interval" blocks.
 
Constructor Summary
NetworkParameters()
           
 
Method Summary
static NetworkParameters prodNet()
          The primary BitCoin chain created by Satoshi.
static NetworkParameters testNet()
          The test chain created by Gavin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_VERSION

public static final int PROTOCOL_VERSION
The protocol version this library implements. A value of 31800 means 0.3.18.00.

See Also:
Constant Field Values

genesisBlock

public Block genesisBlock
Genesis block for this chain.

The first block in every chain is a well known constant shared between all BitCoin implemenetations. For a block to be valid, it must be eventually possible to work backwards to the genesis block by following the prevBlockHash pointers in the block headers.

The genesis blocks for both test and prod networks contain the timestamp of when they were created, and a message in the coinbase transaction. It says, "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks".


proofOfWorkLimit

public BigInteger proofOfWorkLimit
What the easiest allowable proof of work should be.


port

public int port
Default TCP port on which to connect to nodes.


packetMagic

public long packetMagic
The header bytes that identify the start of a packet on this network.


addressHeader

public int addressHeader
First byte of a base58 encoded address. See Address


dumpedPrivateKeyHeader

public int dumpedPrivateKeyHeader
First byte of a base58 encoded dumped private key. See DumpedPrivateKey.


interval

public int interval
How many blocks pass between difficulty adjustment periods. BitCoin standardises this to be 2015.


targetTimespan

public int targetTimespan
How much time in seconds is supposed to pass between "interval" blocks. If the actual elapsed time is significantly different from this value, the network difficulty formula will produce a different value. Both test and production BitCoin networks use 2 weeks (1209600 seconds).

Constructor Detail

NetworkParameters

public NetworkParameters()
Method Detail

testNet

public static NetworkParameters testNet()
The test chain created by Gavin.


prodNet

public static NetworkParameters prodNet()
The primary BitCoin chain created by Satoshi.



Copyright © 2011. All Rights Reserved.