Package org.bitcoinj.wallet
Class DeterministicKeyChain.Builder<T extends DeterministicKeyChain.Builder<T>>
- java.lang.Object
-
- org.bitcoinj.wallet.DeterministicKeyChain.Builder<T>
-
- Enclosing class:
- DeterministicKeyChain
public static class DeterministicKeyChain.Builder<T extends DeterministicKeyChain.Builder<T>> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected HDPathaccountPathprotected intbitsprotected java.time.InstantcreationTimeprotected byte[]entropyprotected ScriptTypeoutputScriptTypeprotected java.lang.Stringpassphraseprotected java.security.SecureRandomrandomprotected DeterministicSeedseedprotected DeterministicKeyspendingKeyprotected DeterministicKeywatchingKey
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TaccountPath(java.util.List<ChildNumber> accountPath)Use an account path other than the defaultDeterministicKeyChain.ACCOUNT_ZERO_PATH.DeterministicKeyChainbuild()Tentropy(byte[] entropy, long creationTimeSecs)Deprecated.Tentropy(byte[] entropy, java.time.Instant creationTime)Creates a deterministic key chain starting from the given entropy.protected java.lang.StringgetPassphrase()ToutputScriptType(ScriptType outputScriptType)Tpassphrase(java.lang.String passphrase)The passphrase to use with the generated mnemonic, or null if you would like to use the default empty string.Trandom(java.security.SecureRandom random)Generates a new key chain with 128 bits of entropy selected randomly from the givenSecureRandomobject.Trandom(java.security.SecureRandom random, int bits)Generates a new key chain with entropy selected randomly from the givenSecureRandomobject and of the requested size in bits.Tseed(DeterministicSeed seed)Creates a deterministic key chain starting from the given seed.protected Tself()Tspend(DeterministicKey accountKey)Creates a key chain that can spend from the given account key.Twatch(DeterministicKey accountKey)Creates a key chain that watches the given account key.
-
-
-
Field Detail
-
random
protected java.security.SecureRandom random
-
bits
protected int bits
-
passphrase
protected java.lang.String passphrase
-
creationTime
@Nullable protected java.time.Instant creationTime
-
entropy
protected byte[] entropy
-
seed
protected DeterministicSeed seed
-
outputScriptType
protected ScriptType outputScriptType
-
watchingKey
protected DeterministicKey watchingKey
-
spendingKey
protected DeterministicKey spendingKey
-
accountPath
protected HDPath accountPath
-
-
Method Detail
-
self
protected T self()
-
entropy
public T entropy(byte[] entropy, java.time.Instant creationTime)
Creates a deterministic key chain starting from the given entropy. All keys yielded by this chain will be the same if the starting entropy is the same. You should provide the creation time for the chain: this lets us know from what part of the chain we can expect to see derived keys appear.- Parameters:
entropy- entropy to create the chain withcreationTime- creation time for the chain
-
entropy
@Deprecated public T entropy(byte[] entropy, long creationTimeSecs)
Deprecated.
-
seed
public T seed(DeterministicSeed seed)
Creates a deterministic key chain starting from the given seed. All keys yielded by this chain will be the same if the starting seed is the same.
-
random
public T random(java.security.SecureRandom random, int bits)
Generates a new key chain with entropy selected randomly from the givenSecureRandomobject and of the requested size in bits. The derived seed is further protected with a user selected passphrase (see BIP 39).- Parameters:
random- the random number generator - use new SecureRandom().bits- The number of bits of entropy to use when generating entropy. Either 128 (default), 192 or 256.
-
random
public T random(java.security.SecureRandom random)
Generates a new key chain with 128 bits of entropy selected randomly from the givenSecureRandomobject. The derived seed is further protected with a user selected passphrase (see BIP 39).- Parameters:
random- the random number generator - use new SecureRandom().
-
watch
public T watch(DeterministicKey accountKey)
Creates a key chain that watches the given account key.
-
spend
public T spend(DeterministicKey accountKey)
Creates a key chain that can spend from the given account key.
-
outputScriptType
public T outputScriptType(ScriptType outputScriptType)
-
passphrase
public T passphrase(java.lang.String passphrase)
The passphrase to use with the generated mnemonic, or null if you would like to use the default empty string. Currently must be the empty string.
-
accountPath
public T accountPath(java.util.List<ChildNumber> accountPath)
Use an account path other than the defaultDeterministicKeyChain.ACCOUNT_ZERO_PATH.
-
build
public DeterministicKeyChain build()
-
getPassphrase
protected java.lang.String getPassphrase()
-
-