Class KeyChainGroup.Builder
- java.lang.Object
-
- org.bitcoinj.wallet.KeyChainGroup.Builder
-
- Enclosing class:
- KeyChainGroup
public static class KeyChainGroup.Builder extends java.lang.ObjectBuilder forKeyChainGroup. UseKeyChainGroup.builder(NetworkParameters)to acquire an instance.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyChainGroup.BuilderaddChain(DeterministicKeyChain chain)Add a single chain.KeyChainGroupbuild()KeyChainGroup.Builderchains(java.util.List<DeterministicKeyChain> chains)Add multiple chains.KeyChainGroup.BuilderfromKey(DeterministicKey accountKey, ScriptType outputScriptType)Add chain from a given account key.KeyChainGroup.BuilderfromRandom(ScriptType outputScriptType)Add chain from a random source.KeyChainGroup.BuilderfromSeed(DeterministicSeed seed, ScriptType outputScriptType)Add chain from a given seed.KeyChainGroup.BuilderlookaheadSize(int lookaheadSize)Set a custom lookahead size for all deterministic chainsKeyChainGroup.BuilderlookaheadThreshold(int lookaheadThreshold)Set a custom lookahead threshold for all deterministic chains
-
-
-
Method Detail
-
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 with bitcoinj 0.16 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 with bitcoinj 0.16 such that only a P2WPKH chain is created and activated.
- Parameters:
seed- deterministic seed to derive all keys fromoutputScriptType- 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 fromoutputScriptType- type of addresses (aka output scripts) to generate for receiving
-
addChain
public KeyChainGroup.Builder addChain(DeterministicKeyChain chain)
Add a single chain.- Parameters:
chain- to add
-
chains
public KeyChainGroup.Builder chains(java.util.List<DeterministicKeyChain> 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()
-
-