Package org.bitcoinj.params
Class AbstractBitcoinNetParams
java.lang.Object
org.bitcoinj.core.NetworkParameters
org.bitcoinj.params.AbstractBitcoinNetParams
- Direct Known Subclasses:
MainNetParams,RegTestParams,TestNet3Params,UnitTestParams
Parameters for Bitcoin-like networks.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bitcoinj.core.NetworkParameters
NetworkParameters.ProtocolVersion -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringScheme part for Bitcoin URIs.protected Blocklazy-initialized by the first call toNetworkParameters.getGenesisBlock()static final intFields inherited from class org.bitcoinj.core.NetworkParameters
addressHeader, addrSeeds, BIP16_ENFORCE_TIME, bip32HeaderP2PKHpriv, bip32HeaderP2PKHpub, bip32HeaderP2WPKHpriv, bip32HeaderP2WPKHpub, checkpoints, defaultSerializer, dnsSeeds, dumpedPrivateKeyHeader, httpSeeds, id, ID_MAINNET, ID_REGTEST, ID_TESTNET, ID_UNITTESTNET, interval, INTERVAL, majorityEnforceBlockUpgrade, majorityRejectBlockOutdated, majorityWindow, MAX_COINS, MAX_MONEY, maxTarget, p2shHeader, packetMagic, PAYMENT_PROTOCOL_ID_MAINNET, PAYMENT_PROTOCOL_ID_REGTEST, PAYMENT_PROTOCOL_ID_TESTNET, PAYMENT_PROTOCOL_ID_UNIT_TESTS, port, segwitAddressHrp, spendableCoinbaseDepth, subsidyDecreaseBlockCount, TARGET_SPACING, TARGET_TIMESPAN, targetTimespan -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckDifficultyTransitions(StoredBlock storedPrev, Block nextBlock, BlockStore blockStore) Throws an exception if the block's difficulty is not correct.getBlockInflation(int height) A utility method that calculates how much new Bitcoin would be created by the block at the given height.Returns the number of coins that will be produced in total, on this network.Deprecated.The monetary object for this currency.intgetSerializer(boolean parseRetain) Construct and return a custom serializer.Scheme part for URIs, for example "bitcoin".booleanReturns whether this network has a maximum number of coins (finite supply) or not.final booleanisDifficultyTransitionPoint(int previousHeight) Checks if we are at a difficulty transition point.final booleanisRewardHalvingPoint(int previousHeight) Checks if we are at a reward halving point.Methods inherited from class org.bitcoinj.core.NetworkParameters
allowEmptyPeerChain, equals, fromID, fromPmtProtocolID, getAddressHeader, getAddrSeeds, getBip32HeaderP2PKHpriv, getBip32HeaderP2PKHpub, getBip32HeaderP2WPKHpriv, getBip32HeaderP2WPKHpub, getBlockVerificationFlags, getDefaultSerializer, getDnsSeeds, getDumpedPrivateKeyHeader, getGenesisBlock, getHttpSeeds, getId, getInterval, getMajorityEnforceBlockUpgrade, getMajorityRejectBlockOutdated, getMajorityWindow, getMaxTarget, getP2SHHeader, getPacketMagic, getPaymentProtocolId, getPort, getSegwitAddressHrp, getSpendableCoinbaseDepth, getSubsidyDecreaseBlockCount, getTargetTimespan, getTransactionVerificationFlags, hashCode, isCheckpoint, passesCheckpoint
-
Field Details
-
BITCOIN_SCHEME
Scheme part for Bitcoin URIs.- See Also:
-
REWARD_HALVING_INTERVAL
public static final int REWARD_HALVING_INTERVAL- See Also:
-
genesisBlock
lazy-initialized by the first call toNetworkParameters.getGenesisBlock()
-
-
Constructor Details
-
AbstractBitcoinNetParams
public AbstractBitcoinNetParams()
-
-
Method Details
-
isRewardHalvingPoint
public final boolean isRewardHalvingPoint(int previousHeight) Checks if we are at a reward halving point.- Parameters:
previousHeight- The height of the previous stored block- Returns:
- If this is a reward halving point
-
getBlockInflation
A utility method that calculates how much new Bitcoin would be created by the block at the given height. The inflation of Bitcoin is predictable and drops roughly every 4 years (210,000 blocks). At the dawn of the system it was 50 coins per block, in late 2012 it went to 25 coins per block, and so on. The size of a coinbase transaction is inflation plus fees.
The half-life is controlled by
NetworkParameters.getSubsidyDecreaseBlockCount().- Parameters:
height- the height of the block to calculate inflation for
-
isDifficultyTransitionPoint
public final boolean isDifficultyTransitionPoint(int previousHeight) Checks if we are at a difficulty transition point.- Parameters:
previousHeight- The height of the previous stored block- Returns:
- If this is a difficulty transition point
-
checkDifficultyTransitions
public void checkDifficultyTransitions(StoredBlock storedPrev, Block nextBlock, BlockStore blockStore) throws VerificationException, BlockStoreException Description copied from class:NetworkParametersThrows an exception if the block's difficulty is not correct.- Specified by:
checkDifficultyTransitionsin classNetworkParameters- Throws:
VerificationException- if the block's difficulty is not correct.BlockStoreException
-
getMaxMoney
Description copied from class:NetworkParametersReturns the number of coins that will be produced in total, on this network. Where not applicable, a very large number of coins is returned instead (i.e. the main coin issue for Dogecoin).- Specified by:
getMaxMoneyin classNetworkParameters
-
getMinNonDustOutput
Deprecated.- Specified by:
getMinNonDustOutputin classNetworkParameters
-
getMonetaryFormat
Description copied from class:NetworkParametersThe monetary object for this currency.- Specified by:
getMonetaryFormatin classNetworkParameters
-
getProtocolVersionNum
- Specified by:
getProtocolVersionNumin classNetworkParameters
-
getSerializer
Description copied from class:NetworkParametersConstruct and return a custom serializer.- Specified by:
getSerializerin classNetworkParameters
-
getUriScheme
Description copied from class:NetworkParametersScheme part for URIs, for example "bitcoin".- Specified by:
getUriSchemein classNetworkParameters
-
hasMaxMoney
public boolean hasMaxMoney()Description copied from class:NetworkParametersReturns whether this network has a maximum number of coins (finite supply) or not. Always returns true for Bitcoin, but exists to be overridden for other networks.- Specified by:
hasMaxMoneyin classNetworkParameters
-
TransactionOutput.getMinNonDustValue()