Class KeyChainGroup.Builder

java.lang.Object
org.bitcoinj.wallet.KeyChainGroup.Builder
Enclosing class:
KeyChainGroup

public static class KeyChainGroup.Builder extends Object
Builder for KeyChainGroup. Use KeyChainGroup.builder(Network) to acquire an instance.
  • Method Details

    • fromRandom

      public KeyChainGroup.Builder fromRandom(ScriptType outputScriptType)

      Add chain from a random source.

      In the case of P2PKH, just a P2PKH chain is created and activated which is then the default chain for fresh addresses. It can be upgraded to P2WPKH later.

      In the case of P2WPKH, both a P2PKH and a P2WPKH chain are created and activated, the latter being the default chain. This behaviour will likely be changed in future such that only a P2WPKH chain is created and activated.

      Parameters:
      outputScriptType - type of addresses (aka output scripts) to generate for receiving
    • fromSeed

      public KeyChainGroup.Builder fromSeed(DeterministicSeed seed, ScriptType outputScriptType)

      Add chain from a given seed.

      In the case of P2PKH, just a P2PKH chain is created and activated which is then the default chain for fresh addresses. It can be upgraded to P2WPKH later.

      In the case of P2WPKH, both a P2PKH and a P2WPKH chain are created and activated, the latter being the default chain. This behaviour will likely be changed in future such that only a P2WPKH chain is created and activated.

      Parameters:
      seed - deterministic seed to derive all keys from
      outputScriptType - type of addresses (aka output scripts) to generate for receiving
    • fromKey

      public KeyChainGroup.Builder fromKey(DeterministicKey accountKey, ScriptType outputScriptType)

      Add chain from a given account key.

      In the case of P2PKH, just a P2PKH chain is created and activated which is then the default chain for fresh addresses. It can be upgraded to P2WPKH later.

      In the case of P2WPKH, both a P2PKH and a P2WPKH chain are created and activated, the latter being the default chain. This behaviour will likely be changed with bitcoinj 0.16 such that only a P2WPKH chain is created and activated.

      Parameters:
      accountKey - deterministic account key to derive all keys from
      outputScriptType - type of addresses (aka output scripts) to generate for receiving
    • addChain

      Add a single chain.
      Parameters:
      chain - to add
    • chains

      Add multiple chains.
      Parameters:
      chains - to add
    • lookaheadSize

      public KeyChainGroup.Builder lookaheadSize(int lookaheadSize)
      Set a custom lookahead size for all deterministic chains
      Parameters:
      lookaheadSize - lookahead size
    • lookaheadThreshold

      public KeyChainGroup.Builder lookaheadThreshold(int lookaheadThreshold)
      Set a custom lookahead threshold for all deterministic chains
      Parameters:
      lookaheadThreshold - lookahead threshold
    • build

      public KeyChainGroup build()