Class ConsensusParams.Builder

java.lang.Object
io.hotmoka.nodes.ConsensusParams.Builder
Enclosing class:
ConsensusParams

public static class ConsensusParams.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public ConsensusParams build()
      Builds the parameters.
      Returns:
      the parameters
    • setChainId

      public ConsensusParams.Builder setChainId(String chainId)
      Specifies the chain identifier that will be set for the node. This defaults to the empty string.
      Parameters:
      chainId - the chain identifier
      Returns:
      this same builder
    • setGenesisTime

      public ConsensusParams.Builder setGenesisTime(String genesisTime)
      Specifies the genesis time that will be set for the node. This defaults to the time of creation of this object.
      Parameters:
      genesisTime - the genesis time, UTC, in ISO8601 pattern
      Returns:
      this same builder
    • setMaxErrorLength

      public ConsensusParams.Builder setMaxErrorLength(int maxErrorLength)
      Sets the maximal length of the error message kept in the store of the node. Beyond this threshold, the message gets truncated. It defaults to 300 characters.
      Parameters:
      maxErrorLength - the maximal error length
      Returns:
      this builder
    • setMaxDependencies

      public ConsensusParams.Builder setMaxDependencies(int maxDependencies)
      Sets the maximal number of dependencies per transaction. These are the jars that form the class path of a transaction. It defaults to 20.
      Parameters:
      maxDependencies - the maximal number of dependencies
      Returns:
      this builder
    • setMaxCumulativeSizeOfDependencies

      public ConsensusParams.Builder setMaxCumulativeSizeOfDependencies(long maxSizeOfDependencies)
      Sets the maximal cumulative size of the dependencies per transaction. These are the number of bytes of the instrumented jars that form the class path of a transaction. It defaults to 10,000,000.
      Parameters:
      maxSizeOfDependencies - the maximal number of dependencies
      Returns:
      this builder
    • allowSelfCharged

      public ConsensusParams.Builder allowSelfCharged(boolean allowsSelfCharged)
      Specifies to allow the @@SelfCharged annotation in the Takamaka code that runs in the node.
      Parameters:
      allowsSelfCharged - true if and only if the annotation is allowed
      Returns:
      this builder
    • allowUnsignedFaucet

      public ConsensusParams.Builder allowUnsignedFaucet(boolean allowsUnsignedFaucet)
      Specifies to allow the faucet() methods of the gametes without a valid signature. This is only useful for testing networks, where users can freely fill their accounts at the faucet.
      Parameters:
      allowsUnsignedFaucet - true if and only if the faucet of the gametes can be used without a valid signature
      Returns:
      this builder
    • allowMintBurnFromGamete

      public ConsensusParams.Builder allowMintBurnFromGamete(boolean allowsMintBurnFromGamete)
      Specifies to allow the gamete of the node to call, for free, the add method of the accounts ledger and the mint/burn methods of the accounts, without paying gas and without paying for the minted coins.
      Parameters:
      allowsMintBurnFromGamete - true if and only if the gamete is allowed
      Returns:
      this builder
    • signRequestsWith

      public ConsensusParams.Builder signRequestsWith(String signature)
      Specifies to signature algorithm to use to sign the requests sent to the node. It defaults to "ed25519";
      Parameters:
      signature - the name of the signature algorithm. Currently, this includes "ed25519", "ed25519det", "sha256dsa", "empty", "qtesla1" and "qtesla3"
      Returns:
      this builder
    • setInitialGasPrice

      public ConsensusParams.Builder setInitialGasPrice(BigInteger initialGasPrice)
      Sets the initial gas price. It defaults to 100.
      Parameters:
      initialGasPrice - the initial gas price to set.
    • setMaxGasPerTransaction

      public ConsensusParams.Builder setMaxGasPerTransaction(BigInteger maxGasPerTransaction)
      Sets the maximal amount of gas that a non-view transaction can consume. It defaults to 1_000_000_000.
    • setTargetGasAtReward

      public ConsensusParams.Builder setTargetGasAtReward(BigInteger targetGasAtReward)
      Sets the units of gas that are aimed to be rewarded at each reward. If the actual reward is smaller, the price of gas must decrease. If it is larger, the price of gas must increase. It defaults to 1_000_000.
    • setOblivion

      public ConsensusParams.Builder setOblivion(long oblivion)
      Sets how quick the gas consumed at previous rewards is forgotten: 0 means never, 1_000_000 means immediately. Hence a smaller level means that the latest rewards are heavier in the determination of the gas price. Use 0 to keep the gas price constant. It defaults to 250_000L.
    • setInitialInflation

      public ConsensusParams.Builder setInitialInflation(long initialInflation)
      Sets the initial inflation applied to the gas consumed by transactions before it gets sent as reward to the validators. 1,000,000 means 1%. Inflation can be negative. For instance, -300,000 means -0.3%. It defaults to 100,000 (that is, inflation is 0.1% by default).
    • setPercentStaked

      public ConsensusParams.Builder setPercentStaked(int percentStaked)
      Sets the amount of validators' rewards that gets staked. The rest is sent to the validators immediately. 1000000 = 1%. It defaults to 75%.
      Parameters:
      percentStaked - the buyer surcharge to set
      Returns:
      this builder
    • setBuyerSurcharge

      public ConsensusParams.Builder setBuyerSurcharge(int buyerSurcharge)
      Sets the extra tax paid when a validator acquires the shares of another validator (in percent of the offer cost). 1000000 = 1%. It defaults to 50%.
      Parameters:
      buyerSurcharge - the buyer surcharge to set
      Returns:
      this builder
    • setSlashingForMisbehaving

      public ConsensusParams.Builder setSlashingForMisbehaving(int slashingForMisbehaving)
      Sets the percent of stake that gets slashed for each misbehaving validator. 1000000 means 1%. It defaults to 1%.
      Parameters:
      slashingForMisbehaving - the slashing for misbehaving validators
      Returns:
      this builder
    • setSlashingForNotBehaving

      public ConsensusParams.Builder setSlashingForNotBehaving(int slashingForNotBehaving)
      Sets the percent of stake that gets slashed for each not behaving (not voting) validator. 1000000 means 1%. It defaults to 1%.
      Parameters:
      slashingForNotBehaving - the slashing for not behaving validators
      Returns:
      this builder
    • ignoreGasPrice

      public ConsensusParams.Builder ignoreGasPrice(boolean ignoresGasPrice)
      Specifies that the minimum gas price for transactions is 0, so that the current gas price is not relevant for the execution of the transactions. It defaults to false.
      Parameters:
      ignoresGasPrice - true if and only if the minimum gas price must be ignored
      Returns:
      this builder
    • skipVerification

      public ConsensusParams.Builder skipVerification(boolean skipsVerification)
      Requires to skip the verification of the classes of the jars installed in the node. It defaults to false.
      Parameters:
      skipsVerification - true if and only if the verification must be disabled
      Returns:
      this builder
    • setVerificationVersion

      public ConsensusParams.Builder setVerificationVersion(int verificationVersion)
      Sets the version of the verification module to use. It defaults to 0.
      Parameters:
      verificationVersion - the version of the verification module
      Returns:
      this builder
    • setInitialSupply

      public ConsensusParams.Builder setInitialSupply(BigInteger initialSupply)
      Sets the initial supply of coins of the node. It defaults to 0.
      Parameters:
      initialSupply - the initial supply of coins of the node
      Returns:
      this builder
    • setInitialRedSupply

      public ConsensusParams.Builder setInitialRedSupply(BigInteger initialRedSupply)
      Sets the initial supply of red coins of the node. It defaults to 0.
      Parameters:
      initialRedSupply - the initial supply of red coins of the node
      Returns:
      this builder
    • setPublicKeyOfGamete

      public ConsensusParams.Builder setPublicKeyOfGamete(String publicKeyOfGamete)
      Sets the public key for the gamete account. It defaults to "" (hence a non-existent key).
      Parameters:
      publicKeyOfGamete - the Base64-encoded public key of the gamete account
      Returns:
      this builder
    • setFinalSupply

      public ConsensusParams.Builder setFinalSupply(BigInteger finalSupply)
      Sets the final supply of coins of the node. It defaults to 0.
      Parameters:
      finalSupply - the final supply of coins of the node
      Returns:
      this builder
    • setTicketForNewPoll

      public ConsensusParams.Builder setTicketForNewPoll(BigInteger ticketForNewPoll)
      Sets the amount of coins that must be payed to start a new poll amount to validators, for instance to change a consensus parameter. It defaults to 100.