Skip to content

WalletAppKit: remove internal use of NetworkParameters, deprecate params() - #4360

Draft
msgilligan wants to merge 5 commits into
bitcoinj:masterfrom
msgilligan:msgilligan/WalletAppKit-remove-NetworkParameters
Draft

msgilligan wants to merge 5 commits into
bitcoinj:masterfrom
msgilligan:msgilligan/WalletAppKit-remove-NetworkParameters

Conversation

@msgilligan

@msgilligan msgilligan commented Aug 29, 2026 •

Copy link
Copy Markdown
Member

This provides a factory for genesis blocks that does not require a
caller to have a NetworkParameters instance.

Block is the logical home for this method, because:

1. Genesis blocks are instances of `Block` and factories that provide
   well-known constant instances of a type make sense to place there.
2. We already have several `createGenesis()` static factories in `Block`
   (immediately below this new method)
3. We can't put it in `Network` because `Block` and other dependencies
   are in `o.b.core` not `o.b.base`.
In some classes (CheckpointManager, SPVBlockStore, and
MemoryFullPrunedBlockStore) the use of Block.getGenesis() removes the last
internal dependency on NetworkParameters and allows the constructor
taking NetworkParameters to be replaced with one that takes Network.

In FetchBlocks, PrivateKeys, and BlockFileLoaderBitcoindTest
NetworkParameters is completely removed.

In other classes use of Block.getGenesis() takes us closer to removing
NetworkParameters, but there are other uses that must be updated first.
Existing SPVBlockStore constructors that take NetworkParameters are
deprecated.

Note that the RestoreFromSeed example is now able to completely
remove imports of NetworkParameters and subclasses.

BlockImporter can drop NetworkParameters once the MemoryFullPrunedBlockStore
constructors are updated to take Network.

This is a step towards our goal of (typical) applications using only
(Bitcoin)Network in API calls.

This also opens the possibility of migrating genesis block parameters
out of network parameters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant