The core package contains classes for network messages like
Transaction, peer connectivity via
PeerGroup, and block chain management. If what you're doing can be described as basic bitcoin tasks, the code is probably found here. To learn more please consult the documentation on the website.
Interface Summary Interface Description MonetaryClasses implementing this interface represent a monetary value, such as a Bitcoin or fiat amount. PeerFilterProviderAn interface which provides the information required to properly filter data downloaded from Peers. TransactionBagThis interface is used to abstract the
TransactionBroadcast.ProgressCallbackAn interface for receiving progress information on the propagation of the tx, from 0.0 to 1.0 TransactionBroadcasterA general interface which declares the ability to broadcast transactions. TransactionConfidence.ListenerA confidence listener is informed when the level of
TransactionConfidenceis updated by something, like for example a
UTXOProviderA UTXOProvider encapsulates functionality for returning unspent transaction outputs, for use by the wallet or other code that crafts spends.
Class Summary Class Description AbstractBlockChainAn AbstractBlockChain holds a series of
Blockobjects, links them together, and knows how to verify that the chain follows the rules of the
NetworkParametersfor this chain.
AddressBase class for addresses, e.g. AddressMessage AddressV1MessageRepresents an "addr" message on the P2P network, which contains broadcast IP addresses of other peers. AddressV2MessageRepresents an "addrv2" message on the P2P network, which contains broadcast IP addresses of other peers. Base58Base58 is a way to encode Bitcoin addresses (or arbitrary data) as alphanumeric strings. Bech32Implementation of the Bech32 encoding. Bech32.Bech32Data BitcoinSerializerMethods to serialize and de-serialize messages to the Bitcoin network format as defined in the protocol specification. BitcoinSerializer.BitcoinPacketHeader BlockA block is a group of transactions, and is one of the fundamental data structures of the Bitcoin system. BlockChainA BlockChain implements the simplified payment verification mode of the Bitcoin protocol. BlockLocatorRepresents Block Locator in GetBlocks and GetHeaders messages BloomFilterA Bloom filter is a probabilistic data structure which can be sent to another client so that it can avoid sending us transactions that aren't relevant to our set of keys. CheckpointManagerVends hard-coded
StoredBlocks for blocks throughout the chain.
ChildMessageRepresents a Message type that can be contained within another Message. CoinRepresents a monetary Bitcoin value. ContextThe Context object holds various objects and pieces of configuration that are scoped to a specific instantiation of bitcoinj for a specific network. DumpedPrivateKeyParses and generates private keys in the form used by the Bitcoin "dumpprivkey" command. ECKeyRepresents an elliptic curve public and (optionally) private key, usable for digital signatures but not encryption. ECKey.ECDSASignatureGroups the two components that make up a signature, and provides a way to encode to DER form, which is how ECDSA signatures are represented when embedded in other data structures in the Bitcoin protocol. EmptyMessageParent class for header only messages that don't have a payload. FeeFilterMessageRepresents an "feefilter" message on the P2P network, which instructs a peer to filter transaction invs for transactions that fall below the feerate provided. FilteredBlockA FilteredBlock is used to relay a block with its transactions filtered using a
FullPrunedBlockChainA FullPrunedBlockChain works in conjunction with a
FullPrunedBlockStoreto verify all the rules of the Bitcoin system, with the downside being a large cost in system resources.
GetAddrMessageRepresents the "getaddr" P2P protocol message, which requests network
AddressMessages from a peer.
GetBlocksMessageRepresents the "getblocks" P2P network message, which requests the hashes of the parts of the block chain we're missing. GetDataMessageRepresents the "getdata" P2P network message, which requests the contents of blocks or transactions given their hashes. GetHeadersMessageThe "getheaders" command is structurally identical to "getblocks", but has different meaning. GetUTXOsMessageThis command is supported only by Bitcoin XT nodes, which advertise themselves using the second service bit flag. HeadersMessageA protocol message that contains a repeated series of block headers, sent in response to the "getheaders" command. InventoryItem InventoryMessageRepresents the "inv" P2P network message. LegacyAddressA Bitcoin address looks like 1MsScoe2fTJoq4ZPdQgqyhgWeoNamYPevy and is derived from an elliptic curve public key plus a set of network parameters. ListMessageAbstract superclass of classes with list based payload, ie InventoryMessage and GetDataMessage. MemoryPoolMessageThe "mempool" message asks a remote peer to announce all transactions in its memory pool, possibly restricted by any Bloom filter set on the connection. MessageA Message is a data structure that can be serialized/deserialized using the Bitcoin serialization format. MessageSerializerGeneric interface for classes which serialize/deserialize messages. NetworkParametersNetworkParameters contains the data needed for working with an instantiation of a Bitcoin chain. NotFoundMessageSent by a peer when a getdata request doesn't find the requested data in the mempool. PartialMerkleTreeA data structure that contains proofs of block inclusion for one or more transactions, in an efficient manner. PeerA Peer handles the high level communication with a Bitcoin node, extending a
PeerSocketHandlerwhich handles low-level message (de)serialization.
PeerAddressA PeerAddress holds an IP address and port number representing the network location of a peer in the Bitcoin P2P network. PeerGroupRuns a set of connections to the P2P network, brings up connections to replace disconnected nodes and manages the interaction between them all. PeerSocketHandlerHandles high-level message (de)serialization for peers, acting as the bridge between the
PingInstances of this class are not safe for use by multiple threads. PongInstances of this class are not safe for use by multiple threads. PrefixedChecksummedBytesThe following format is often used to represent some type of data (e.g. RejectMessageA message sent by nodes when a message we sent was rejected (ie a transaction had too little fee/was invalid/etc). SegwitAddressImplementation of native segwit addresses. SendAddrV2MessageRepresents the
sendaddrv2P2P protocol message, which indicates that a node can understand and prefers to receive
addrv2messages instead of
SendHeadersMessageA new message, "sendheaders", which indicates that a node prefers to receive new block announcements via a "headers" message rather than an "inv". Sha256HashA
Sha256Hash.hashCode()work correctly, allowing it to be used as a key in a map.
Blockobject with extra data that can be derived from the block chain but is slow or inconvenient to calculate.
StoredUndoableBlockContains minimal data necessary to disconnect/connect the transactions in the stored block at will. TransactionA transaction represents the movement of coins from some addresses to some other addresses. TransactionBroadcastRepresents a single transaction broadcast that we are performing. TransactionConfidenceA TransactionConfidence object tracks data you can use to make a confidence decision about a transaction. TransactionConfidence.Factory TransactionInputA transfer of coins from one address to another creates a transaction in which the outputs can be claimed by the recipient in the input of another transaction. TransactionOutPointThis message is a reference or pointer to an output of a different transaction. TransactionOutputA TransactionOutput message contains a scriptPubKey that controls who is able to spend its value. TransactionOutputChangesTransactionOutputChanges represents a delta to the set of unspent outputs. TransactionWitness TxConfidenceTableTracks transactions that are being announced across the network. UnknownMessageInstances of this class are not safe for use by multiple threads. UnsafeByteArrayOutputStreamAn unsynchronized implementation of ByteArrayOutputStream that will return the backing byte array if its length == size(). UtilsA collection of various utility methods that are helpful for working with the Bitcoin protocol. UTXOA UTXO message contains the information necessary to check a spending transaction. UTXOsMessageMessage representing a list of unspent transaction outputs ("utxos"), returned in response to sending a
VarIntA variable-length encoded unsigned integer using Satoshi's encoding (a.k.a. VersionAckThe verack message, sent by a client accepting the version message they received from their peer. VersionMessageA VersionMessage holds information exchanged during connection setup with another peer.
Enum Summary Enum Description AbstractBlockChain.NewBlockTypeIndicates whether new Block was on the best chain or not Bech32.Encoding Block.VerifyFlagFlags used to control which elements of block validation are done on received blocks. BloomFilter.BloomUpdateThe BLOOM_UPDATE_* constants control when the bloom filter is auto-updated by the peer using it as a filter, either never, for all outputs or only for P2PK outputs (default) InventoryItem.Type NetworkParameters.ProtocolVersion PeerGroup.FilterRecalculateMode RejectMessage.RejectCode Transaction.PurposeThis enum describes the underlying reason the transaction was created. Transaction.SigHashThese constants are a part of a scriptSig signature on the inputs. TransactionConfidence.ConfidenceTypeDescribes the state of the transaction in general terms. TransactionConfidence.Listener.ChangeReasonAn enum that describes why a transaction confidence listener is being invoked (i.e. TransactionConfidence.SourceInformation about where the transaction was first seen (network, sent direct from peer, created by ourselves). TransactionInput.ConnectionResult TransactionInput.ConnectMode
Exception Summary Exception Description AddressFormatException AddressFormatException.InvalidCharacterThis exception is thrown by
PrefixedChecksummedByteshierarchy of classes when you try to decode data and a character isn't valid.
AddressFormatException.InvalidChecksumThis exception is thrown by
PrefixedChecksummedByteshierarchy of classes when you try to decode data and the checksum isn't valid.
AddressFormatException.InvalidDataLengthThis exception is thrown by
PrefixedChecksummedByteshierarchy of classes when you try to decode data and the data isn't of the right size.
AddressFormatException.InvalidPrefixThis exception is thrown by the
PrefixedChecksummedByteshierarchy of classes when you try and decode an address or private key with an invalid prefix (version header or human-readable part).
AddressFormatException.UnexpectedWitnessVersionThis exception is thrown by
SegwitAddresswhen you try to decode data and the witness version doesn't match the Bech32 encoding as per BIP350.
AddressFormatException.WrongNetworkThis exception is thrown by the
PrefixedChecksummedByteshierarchy of classes when you try and decode an address with a prefix (version header or human-readable part) that used by another network (usually: mainnet vs testnet).
ECKey.KeyIsEncryptedException ECKey.MissingPrivateKeyException InsufficientMoneyExceptionThrown to indicate that you don't have enough money available to perform the requested operation. PeerExceptionThrown when a problem occurs in communicating with a peer, and we should retry. ProtocolException PrunedExceptionPrunedException is thrown in cases where a fully verifying node has deleted (pruned) old block data that turned out to be necessary for handling a re-org. RejectedTransactionExceptionThis exception is used by the TransactionBroadcast class to indicate that a broadcast Transaction has been rejected by the network, for example because it violates a protocol rule. SignatureDecodeException UTXOProviderException VerificationException VerificationException.BlockVersionOutOfDate VerificationException.CoinbaseHeightMismatch VerificationException.CoinbaseScriptSizeOutOfRange VerificationException.DuplicatedOutPoint VerificationException.EmptyInputsOrOutputs VerificationException.ExcessiveValue VerificationException.LargerThanMaxBlockSize VerificationException.NegativeValueOutput VerificationException.NoncanonicalSignature VerificationException.UnexpectedCoinbaseInput