Package org.bitcoinj.wallet
Class DeterministicSeed
java.lang.Object
org.bitcoinj.wallet.DeterministicSeed
- All Implemented Interfaces:
 EncryptableItem
Holds the seed bytes for the BIP32 deterministic wallet algorithm, inside a
 
DeterministicKeyChain. The purpose of this wrapper is to simplify the encryption
 code.- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int - 
Constructor Summary
ConstructorsConstructorDescriptionDeterministicSeed(byte[] entropy, String passphrase, long creationTimeSecs) Deprecated.DeterministicSeed(String mnemonicString, byte[] seed, String passphrase, long creationTimeSecs) Deprecated.DeterministicSeed(SecureRandom random, int bits, String passphrase) Deprecated.DeterministicSeed(List<String> mnemonicCode, byte[] seed, String passphrase, long creationTimeSecs) Deprecated.DeterministicSeed(EncryptedData encryptedMnemonic, EncryptedData encryptedSeed, long creationTimeSecs) Deprecated.will be removed in a future release - 
Method Summary
Modifier and TypeMethodDescriptionvoidcheck()Check if our mnemonic is a valid mnemonic phrase for our word list.voidClears the creation time of this seed.decrypt(KeyCrypter crypter, String passphrase, AesKey aesKey) encrypt(KeyCrypter keyCrypter, AesKey aesKey) booleanReturns the time at which this encryptable item was first created/derived, or empty of unknown.Returns the initialization vector and encrypted secret bytes, or null if not encrypted.org.bitcoinj.protobuf.wallet.Protos.Wallet.EncryptionTypeReturns an enum constant describing what algorithm was used to encrypt the key or UNENCRYPTED.Get the mnemonic code, or null if unknown.Get the mnemonic code as string, or null if unknown.byte[]Returns the raw bytes of the item, if not encrypted, or null if encrypted or the secret is missing.byte[]inthashCode()booleanReturns whether the item is encrypted or not.static DeterministicSeedConstructs a BIP 39 mnemonic code and a seed from a given entropy.static DeterministicSeedConstructs a BIP 39 mnemonic code and a seed from a given entropy.static DeterministicSeedofMnemonic(String mnemonicCode, String passphrase) Constructs a seed from a BIP 39 mnemonic code.static DeterministicSeedofMnemonic(String mnemonicCode, String passphrase, Instant creationTime) Constructs a seed from a BIP 39 mnemonic code.static DeterministicSeedofMnemonic(List<String> mnemonicCode, String passphrase) Constructs a seed from a BIP 39 mnemonic code.static DeterministicSeedofMnemonic(List<String> mnemonicCode, String passphrase, Instant creationTime) Constructs a seed from a BIP 39 mnemonic code.static DeterministicSeedofRandom(SecureRandom random, int bits, String passphrase) Constructs a BIP 39 mnemonic code and a seed randomly.voidsetCreationTime(Instant creationTime) Sets the creation time of this seed.voidsetCreationTimeSeconds(long creationTimeSecs) Deprecated.Returns the seed as hex or null if encrypted.toString()toString(boolean includePrivate) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bitcoinj.crypto.EncryptableItem
getCreationTimeSeconds 
- 
Field Details
- 
DEFAULT_SEED_ENTROPY_BITS
public static final int DEFAULT_SEED_ENTROPY_BITS- See Also:
 
 - 
MAX_SEED_ENTROPY_BITS
public static final int MAX_SEED_ENTROPY_BITS- See Also:
 
 
 - 
 - 
Constructor Details
- 
DeterministicSeed
@Deprecated public DeterministicSeed(String mnemonicString, byte[] seed, String passphrase, long creationTimeSecs) Deprecated. - 
DeterministicSeed
@Deprecated public DeterministicSeed(EncryptedData encryptedMnemonic, @Nullable EncryptedData encryptedSeed, long creationTimeSecs) Deprecated.will be removed in a future release - 
DeterministicSeed
@Deprecated public DeterministicSeed(List<String> mnemonicCode, @Nullable byte[] seed, String passphrase, long creationTimeSecs) Deprecated. - 
DeterministicSeed
Deprecated. - 
DeterministicSeed
Deprecated. 
 - 
 - 
Method Details
- 
ofMnemonic
public static DeterministicSeed ofMnemonic(String mnemonicCode, String passphrase, Instant creationTime) Constructs a seed from a BIP 39 mnemonic code. SeeMnemonicCodefor more details on this scheme.- Parameters:
 mnemonicCode- list of words, space separatedpassphrase- user supplied passphrase, or empty string if there is no passphrasecreationTime- when the seed was originally created
 - 
ofMnemonic
Constructs a seed from a BIP 39 mnemonic code. SeeMnemonicCodefor more details on this scheme. Use this if you don't know the seed's creation time.- Parameters:
 mnemonicCode- list of words, space separatedpassphrase- user supplied passphrase, or empty string if there is no passphrase
 - 
ofMnemonic
public static DeterministicSeed ofMnemonic(List<String> mnemonicCode, String passphrase, Instant creationTime) Constructs a seed from a BIP 39 mnemonic code. SeeMnemonicCodefor more details on this scheme.- Parameters:
 mnemonicCode- list of wordspassphrase- user supplied passphrase, or empty string if there is no passphrasecreationTime- when the seed was originally created
 - 
ofMnemonic
Constructs a seed from a BIP 39 mnemonic code. SeeMnemonicCodefor more details on this scheme. Use this if you don't know the seed's creation time.- Parameters:
 mnemonicCode- list of wordspassphrase- user supplied passphrase, or empty string if there is no passphrase
 - 
ofEntropy
Constructs a BIP 39 mnemonic code and a seed from a given entropy. SeeMnemonicCodefor more details on this scheme.- Parameters:
 entropy- entropy bits, length must be at least 128 bits and a multiple of 32 bitspassphrase- user supplied passphrase, or empty string if there is no passphrasecreationTime- when the seed was originally created
 - 
ofEntropy
Constructs a BIP 39 mnemonic code and a seed from a given entropy. SeeMnemonicCodefor more details on this scheme. Use this if you don't know the seed's creation time.- Parameters:
 entropy- entropy bits, length must be at least 128 bits and a multiple of 32 bitspassphrase- user supplied passphrase, or empty string if there is no passphrase
 - 
ofRandom
Constructs a BIP 39 mnemonic code and a seed randomly. SeeMnemonicCodefor more details on this scheme.- Parameters:
 random- random source for the entropybits- number of bits of entropy, must be at least 128 bits and a multiple of 32 bitspassphrase- user supplied passphrase, or empty string if there is no passphrase
 - 
isEncrypted
public boolean isEncrypted()Description copied from interface:EncryptableItemReturns whether the item is encrypted or not. If it is, thenEncryptableItem.getSecretBytes()will return null.- Specified by:
 isEncryptedin interfaceEncryptableItem
 - 
toString
 - 
toString
 - 
toHexString
Returns the seed as hex or null if encrypted. - 
getSecretBytes
@Nullable public byte[] getSecretBytes()Description copied from interface:EncryptableItemReturns the raw bytes of the item, if not encrypted, or null if encrypted or the secret is missing.- Specified by:
 getSecretBytesin interfaceEncryptableItem
 - 
getSeedBytes
@Nullable public byte[] getSeedBytes() - 
getEncryptedData
Description copied from interface:EncryptableItemReturns the initialization vector and encrypted secret bytes, or null if not encrypted.- Specified by:
 getEncryptedDatain interfaceEncryptableItem
 - 
getEncryptionType
public org.bitcoinj.protobuf.wallet.Protos.Wallet.EncryptionType getEncryptionType()Description copied from interface:EncryptableItemReturns an enum constant describing what algorithm was used to encrypt the key or UNENCRYPTED.- Specified by:
 getEncryptionTypein interfaceEncryptableItem
 - 
getEncryptedSeedData
 - 
getCreationTime
Description copied from interface:EncryptableItemReturns the time at which this encryptable item was first created/derived, or empty of unknown.- Specified by:
 getCreationTimein interfaceEncryptableItem
 - 
setCreationTime
Sets the creation time of this seed.- Parameters:
 creationTime- creation time of this seed
 - 
clearCreationTime
public void clearCreationTime()Clears the creation time of this seed. This is mainly used deserialization and cloning. Normally you should not need to use this, as keys should have proper creation times whenever possible. - 
setCreationTimeSeconds
Deprecated. - 
encrypt
 - 
decrypt
 - 
equals
 - 
hashCode
public int hashCode() - 
check
Check if our mnemonic is a valid mnemonic phrase for our word list. Does nothing if we are encrypted.- Throws:
 MnemonicException- if check fails
 - 
getMnemonicCode
Get the mnemonic code, or null if unknown. - 
getMnemonicString
Get the mnemonic code as string, or null if unknown. 
 - 
 
ofEntropy(byte[], String, Instant)orofEntropy(byte[], String)