Class BlockchainConfig

java.lang.Object
com.privatechain.core.builder.BlockchainConfig

public final class BlockchainConfig extends Object
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:

Since:
1.0.0
See Also:
  • Method Details

    • builder

      public static BlockchainConfig.Builder builder()
      Returns a new, pre-populated BlockchainConfig.Builder with production-ready defaults.
      Returns:
      a mutable builder
    • getConsensusEngine

      public ConsensusEngine getConsensusEngine()
      Returns the configured consensus engine.
      Returns:
      non-null ConsensusEngine
    • getTransactionValidators

      public List<TransactionValidator> getTransactionValidators()
      Returns the ordered list of transaction validators.
      Returns:
      non-null, possibly empty, unmodifiable list
    • getStorage

      public BlockchainStorage getStorage()
      Returns the configured storage backend.
      Returns:
      non-null BlockchainStorage
    • getEventBus

      public BlockchainEventBus getEventBus()
      Returns the shared event bus instance. Always non-null.
      Returns:
      non-null BlockchainEventBus
    • getEventListeners

      public List<BlockchainEventListener> getEventListeners()
      Returns the list of event listeners pre-registered during configuration.
      Returns:
      non-null, possibly empty, unmodifiable list
    • getTransactionPrioritizer

      public TransactionPrioritizer 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

      public String getChainId()
      Returns the stable chain identifier used to create the genesis block.
      Returns:
      non-null, non-blank chain ID
    • getMempoolTtl

      public Duration 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)