Class BlockchainProperties

java.lang.Object
com.privatechain.spring.BlockchainProperties

@ConfigurationProperties(prefix="blockchain") public class BlockchainProperties extends Object
Configuration properties for the private-blockchain Spring Boot autoconfiguration.

All properties are bound to the blockchain.* prefix in application.yml / application.properties. Every field has a production-ready default so that zero configuration is required to start a working in-memory PoW chain (FR-CFG-02, AC-10).

Minimal YAML


 blockchain:
   enabled: true   # default; omit to keep the node active
 

Full YAML reference


 blockchain:
   enabled: true
   chain-id: my-chain
   network-port: 8545
   block-time-seconds: 10
   difficulty: 4
   max-peers: 25
   mempool:
     ttl: 30m         # Duration — supports 30m, PT30M, 1800s, etc.
     max-size: 10000
 

IDE autocomplete for all properties is generated at compile time by the spring-boot-configuration-processor annotation processor, which produces META-INF/spring-configuration-metadata.json (T-071).

Since:
1.0.0
See Also:
  • Constructor Details

    • BlockchainProperties

      public BlockchainProperties()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Returns whether blockchain autoconfiguration is enabled.
      Returns:
      true if the BlockchainNode bean should be created
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether blockchain autoconfiguration is enabled.
      Parameters:
      enabled - false to suppress BlockchainNode bean creation
    • getChainId

      public String getChainId()
      Returns the chain identifier embedded in the genesis block.
      Returns:
      non-null, non-blank chain ID
    • setChainId

      public void setChainId(String chainId)
      Sets the chain identifier.
      Parameters:
      chainId - non-null, non-blank identifier
      Throws:
      NullPointerException - if chainId is null
    • getNetworkPort

      public int getNetworkPort()
      Returns the TCP port for the P2P node server.
      Returns:
      port number in [1024, 65535]
    • setNetworkPort

      public void setNetworkPort(int networkPort)
      Sets the TCP port for the P2P node server.
      Parameters:
      networkPort - port number in [1024, 65535]
    • getBlockTimeSeconds

      public int getBlockTimeSeconds()
      Returns the target block time in seconds.
      Returns:
      block time (≥ 1)
    • setBlockTimeSeconds

      public void setBlockTimeSeconds(int blockTimeSeconds)
      Sets the target block time in seconds.
      Parameters:
      blockTimeSeconds - block time (≥ 1)
    • getDifficulty

      public int getDifficulty()
      Returns the Proof-of-Work difficulty (leading zero bit count).
      Returns:
      difficulty (≥ 1)
    • setDifficulty

      public void setDifficulty(int difficulty)
      Sets the Proof-of-Work difficulty.
      Parameters:
      difficulty - leading zero bit count (≥ 1)
    • getMaxPeers

      public int getMaxPeers()
      Returns the maximum number of simultaneous peer connections.
      Returns:
      max peers (≥ 1)
    • setMaxPeers

      public void setMaxPeers(int maxPeers)
      Sets the maximum number of simultaneous peer connections.
      Parameters:
      maxPeers - max peers (≥ 1)
    • getMempool

      public BlockchainProperties.Mempool getMempool()
      Returns the mempool configuration.
      Returns:
      non-null BlockchainProperties.Mempool properties
    • setMempool

      public void setMempool(BlockchainProperties.Mempool mempool)
      Sets the mempool configuration.
      Parameters:
      mempool - non-null mempool properties
      Throws:
      NullPointerException - if mempool is null