Blockchain
Access and track a blockchain
Parameters
Specify which blockchain to track.
You may give this blockchain a name, for logging.
Provide an object that manages connections to blockchain data providers (full and electrum nodes).
Specify the genesis block hash for this blockchain
Specify the block hash of the parent of your chosen checkpoint. Use Hash256() if you are using the genesis block as your checkpoint.
Specify the block hash for your chosen checkpoint. A checkpoint is a block that is known to be on the main chain. The blockchain will start headers sync from this point. Some blockchain implementations (BCH) cannot rewind prior to this point to access wallet data. You may use the genesis block as your checkpoint.
Specify the block height of this checkpoint?
Specify the cumulative work (NOT THE BLOCK WORK) of all prior blocks including the checkpoint block. This information is available in block explorers, or via the full node getblock RPC call.
Block headers are stored in a database. Specify a prefix for DB name here (default is "blkhdr_"). The full name will be dbPrefix_name.db.
Properties
Increase this to increase the interval of time before a bloom filter needs to be refreshed. Bloom filters are modified by full nodes to automatically include information "of interest" based on current "of interest" information. For example if a tx is interesting, then its outputs will be added into the bloom filter. But the existence of false positives (and because the wallet is likely interested in only a subset of the outputs) means that the bloom filter will slowly fill up with useless information. Setting this multiplier the N will make a bloom filter that is N times your current data size meet the bloomFalsePositiveRate.
Change this to increase privacy at the expense of bandwidth
wake up the blockchain header processing loop
installable callback for when some blockchain or connection state changes
Functions
Return the ancestor of the passed block at the passed height, or the iBlockHeader of the passed hash is the height is larger. Throws RequestedPrehistoryHeader if you go back too far.
Return the ancestor of the passed block at the passed height, or the iBlockHeader of the passed hash is the height is larger. Throws RequestedPrehistoryHeader if you go back too far.
Add a wallet to start accessing the blockchain The blockchain will stop updating if no wallets are attached
Return the header corresponding to this hash.
Return the main chain block header at this height.
Takes a chain tip and produces a set of blocks that on that chain that allow someone to find the approximate fork location if they are on a different tip
remove a wallet from accessing this blockchain Right now its 1 wallet per chain, so stop this chain, but keep the DB around for a new wallet
In rare cases of a tie where one block is invalid, this will kick the wallet over to a different block.
Returns the header nearest to but before the passed epoch time. If the passed epoch time is later than the tip, the tip is returned.
return the cached tip or recalculate it if it is null. Returns null if the tip cannot be determined
return true if the passed block is on the most work chain
Attach these headers to existing chains in our DB and commit them. The passed hdrs list are expected to be in parent->child order
Download and save some headers that aren't at the end of the blockchain
Rediscover the chain tip by looking at the block header database
Erase all previous blockchain knowledge and re-download it
tell all nodes, including future connections, that we are only interested in these things. a handle to this data is returned that can be used to update or delete the data. Pass null to create a new entry This blockchain will take data from all callers, and combine them into a single Bloom filter for installation into connected full nodes.
Get all filter data connected wallets have offered us, and install it into all of our connections. Once all bloom filters are installed, call the passed callback.