Class NetworkParameters

NetworkParameters contains the data needed for working with an instantiation of a Bitcoin chain.

This is an abstract class, concrete instantiations can be found in the params package. There are four:
one for the main network (MainNetParams), one for the public test network, and two others that are
intended for unit testing and local app development purposes. Although this class contains some aliases for
them, you are encouraged to call the static get() methods on each specific params class directly.

TARGET_SPACING

INTERVAL

BIP16_ENFORCE_TIME

public static final int BIP16_ENFORCE_TIME

Blocks with a timestamp after this should enforce BIP 16, aka "Pay to script hash". This BIP changed the
network rules in a soft-forking manner, that is, blocks that don't follow the rules are accepted but not
mined upon and thus will be quickly re-orged out as long as the majority are enforcing the rule.

getGenesisBlock

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 main 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".

getPort

public int getPort()

Default TCP port on which to connect to nodes.

getPacketMagic

public long getPacketMagic()

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

getAddressHeader

public int getAddressHeader()

First byte of a base58 encoded address. See Address. This is the same as acceptableAddressCodes[0] and
is the one used for "normal" addresses. Other types of address may be encountered with version codes found in
the acceptableAddressCodes array.

getP2SHHeader

public int getP2SHHeader()

First byte of a base58 encoded P2SH address. P2SH addresses are defined as part of BIP0013.

getDumpedPrivateKeyHeader

getTargetTimespan

public int getTargetTimespan()

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 main Bitcoin networks use 2 weeks (1209600 seconds).

getAcceptableAddressCodes

public int[] getAcceptableAddressCodes()

The version codes that prefix addresses which are acceptable on this network. Although Satoshi intended these to
be used for "versioning", in fact they are today used to discriminate what kind of data is contained in the
address and to prevent accidentally sending coins across chains which would destroy them.

allowEmptyPeerChain

public boolean allowEmptyPeerChain()

If we are running in testnet-in-a-box mode, we allow connections to nodes with 0 non-genesis blocks.

getInterval

public int getInterval()

How many blocks pass between difficulty adjustment periods. Bitcoin standardises this to be 2015.