Package com.privatechain.core.builder
Class BlockchainConfig
java.lang.Object
com.privatechain.core.builder.BlockchainConfig
Fluent builder and single assembly point for all blockchain subsystems.
BlockchainConfig is the only place where modules are composed
(design.md §1 — Explicit Wiring). No global state, no service-locator, no classpath
scanning. Every dependency is provided explicitly via the builder (FR-CFG-01).
Minimum viable setup (FR-CFG-02)
BlockchainNode node = BlockchainConfig.builder().build();
node.start();
Milestone 8 additions (T-066)
Two new builder parameters control the mempool lifecycle wired into
BlockchainNode:
BlockchainConfig.Builder.mempoolTtl(Duration)— TTL for unconfirmed transactions (default: 30 minutes)BlockchainConfig.Builder.maxMempoolSize(int)— max pool capacity (default: unbounded)
- Since:
- 1.0.0
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockchainConfig.Builderbuilder()Returns a new, pre-populatedBlockchainConfig.Builderwith production-ready defaults.intReturns the target time (in seconds) between consecutive blocks.Returns the stable chain identifier used to create the genesis block.Returns the configured consensus engine.intReturns the PoW difficulty (leading zero bits required in a valid hash).Returns the shared event bus instance.Returns the list of event listeners pre-registered during configuration.intReturns the maximum number of transactions the mempool can hold (Milestone 8).intReturns the maximum number of simultaneous peer connections.Returns the TTL for unconfirmed transactions in the mempool (Milestone 8).intReturns the TCP port on which the P2P node server listens.Returns the configured storage backend.Returns the configured transaction prioritizer.Returns the ordered list of transaction validators.
-
Method Details
-
builder
Returns a new, pre-populatedBlockchainConfig.Builderwith production-ready defaults.- Returns:
- a mutable builder
-
getConsensusEngine
Returns the configured consensus engine.- Returns:
- non-null
ConsensusEngine
-
getTransactionValidators
Returns the ordered list of transaction validators.- Returns:
- non-null, possibly empty, unmodifiable list
-
getStorage
Returns the configured storage backend.- Returns:
- non-null
BlockchainStorage
-
getEventBus
Returns the shared event bus instance. Always non-null.- Returns:
- non-null
BlockchainEventBus
-
getEventListeners
Returns the list of event listeners pre-registered during configuration.- Returns:
- non-null, possibly empty, unmodifiable list
-
getTransactionPrioritizer
Returns the configured transaction prioritizer.- Returns:
- non-null
TransactionPrioritizer
-
getNetworkPort
public int getNetworkPort()Returns the TCP port on which the P2P node server listens.- Returns:
- port number (1024–65535)
-
getBlockTimeSeconds
public int getBlockTimeSeconds()Returns the target time (in seconds) between consecutive blocks.- Returns:
- block time in seconds (≥ 1)
-
getDifficulty
public int getDifficulty()Returns the PoW difficulty (leading zero bits required in a valid hash).- Returns:
- difficulty (≥ 1)
-
getMaxPeers
public int getMaxPeers()Returns the maximum number of simultaneous peer connections.- Returns:
- max peers (≥ 1)
-
getChainId
Returns the stable chain identifier used to create the genesis block.- Returns:
- non-null, non-blank chain ID
-
getMempoolTtl
Returns the TTL for unconfirmed transactions in the mempool (Milestone 8).- Returns:
- non-null, positive duration
-
getMaxMempoolSize
public int getMaxMempoolSize()Returns the maximum number of transactions the mempool can hold (Milestone 8).- Returns:
- max mempool size (≥ 1)
-