Package org.bitcoinj.wallet
Class Protos.Key
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite<MessageType,BuilderType>
-
- com.google.protobuf.GeneratedMessageLite<Protos.Key,Protos.Key.Builder>
-
- org.bitcoinj.wallet.Protos.Key
-
- All Implemented Interfaces:
com.google.protobuf.MessageLite,com.google.protobuf.MessageLiteOrBuilder,Protos.KeyOrBuilder
- Enclosing class:
- Protos
public static final class Protos.Key extends com.google.protobuf.GeneratedMessageLite<Protos.Key,Protos.Key.Builder> implements Protos.KeyOrBuilder
A key used to control Bitcoin spending. Either the private key, the public key or both may be present. It is recommended that if the private key is provided that the public key is provided too because deriving it is slow. If only the public key is provided, the key can only be used to watch the blockchain and verify transactions, and not for spending.
Protobuf typewallet.Key
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProtos.Key.BuilderA key used to control Bitcoin spending.static classProtos.Key.OutputScriptTypeProtobuf enumwallet.Key.OutputScriptTypestatic classProtos.Key.TypeProtobuf enumwallet.Key.Type-
Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageLite
com.google.protobuf.GeneratedMessageLite.DefaultInstanceBasedParser<T extends com.google.protobuf.GeneratedMessageLite<T,?>>, com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageLite.GeneratedExtension<ContainingType extends com.google.protobuf.MessageLite,Type extends java.lang.Object>, com.google.protobuf.GeneratedMessageLite.MethodToInvoke, com.google.protobuf.GeneratedMessageLite.SerializedForm
-
-
Field Summary
Fields Modifier and Type Field Description static intACCOUNT_PATH_FIELD_NUMBERstatic intCREATION_TIMESTAMP_FIELD_NUMBERstatic intDETERMINISTIC_KEY_FIELD_NUMBERstatic intDETERMINISTIC_SEED_FIELD_NUMBERstatic intENCRYPTED_DATA_FIELD_NUMBERstatic intENCRYPTED_DETERMINISTIC_SEED_FIELD_NUMBERstatic intLABEL_FIELD_NUMBERstatic intOUTPUT_SCRIPT_TYPE_FIELD_NUMBERstatic intPUBLIC_KEY_FIELD_NUMBERstatic intSECRET_BYTES_FIELD_NUMBERstatic intTYPE_FIELD_NUMBER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectdynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, java.lang.Object arg0, java.lang.Object arg1)intgetAccountPath(int index)The path to the root.intgetAccountPathCount()The path to the root.java.util.List<java.lang.Integer>getAccountPathList()The path to the root.longgetCreationTimestamp()Timestamp stored as millis since epoch.static Protos.KeygetDefaultInstance()Protos.DeterministicKeygetDeterministicKey()optional .wallet.DeterministicKey deterministic_key = 7;com.google.protobuf.ByteStringgetDeterministicSeed()The seed for a deterministic key hierarchy.Protos.EncryptedDatagetEncryptedData()If the secret data is encrypted, then secret_bytes is missing and this field is set.Protos.EncryptedDatagetEncryptedDeterministicSeed()Encrypted version of the seedjava.lang.StringgetLabel()User-provided label associated with the key.com.google.protobuf.ByteStringgetLabelBytes()User-provided label associated with the key.Protos.Key.OutputScriptTypegetOutputScriptType()Type of addresses (aka output scripts) to generate for receiving.com.google.protobuf.ByteStringgetPublicKey()The public EC key derived from the private key.com.google.protobuf.ByteStringgetSecretBytes()Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.Protos.Key.TypegetType()required .wallet.Key.Type type = 1;booleanhasCreationTimestamp()Timestamp stored as millis since epoch.booleanhasDeterministicKey()optional .wallet.DeterministicKey deterministic_key = 7;booleanhasDeterministicSeed()The seed for a deterministic key hierarchy.booleanhasEncryptedData()If the secret data is encrypted, then secret_bytes is missing and this field is set.booleanhasEncryptedDeterministicSeed()Encrypted version of the seedbooleanhasLabel()User-provided label associated with the key.booleanhasOutputScriptType()Type of addresses (aka output scripts) to generate for receiving.booleanhasPublicKey()The public EC key derived from the private key.booleanhasSecretBytes()Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.booleanhasType()required .wallet.Key.Type type = 1;static Protos.Key.BuildernewBuilder()static Protos.Key.BuildernewBuilder(Protos.Key prototype)static Protos.KeyparseDelimitedFrom(java.io.InputStream input)static Protos.KeyparseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static Protos.KeyparseFrom(byte[] data)static Protos.KeyparseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static Protos.KeyparseFrom(com.google.protobuf.ByteString data)static Protos.KeyparseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static Protos.KeyparseFrom(com.google.protobuf.CodedInputStream input)static Protos.KeyparseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static Protos.KeyparseFrom(java.io.InputStream input)static Protos.KeyparseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static Protos.KeyparseFrom(java.nio.ByteBuffer data)static Protos.KeyparseFrom(java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static com.google.protobuf.Parser<Protos.Key>parser()-
Methods inherited from class com.google.protobuf.GeneratedMessageLite
createBuilder, createBuilder, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, getSerializedSize, hashCode, isInitialized, isInitialized, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newMessageInfo, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, registerDefaultInstance, toBuilder, toString, writeTo
-
Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
-
-
-
-
Field Detail
-
TYPE_FIELD_NUMBER
public static final int TYPE_FIELD_NUMBER
- See Also:
- Constant Field Values
-
SECRET_BYTES_FIELD_NUMBER
public static final int SECRET_BYTES_FIELD_NUMBER
- See Also:
- Constant Field Values
-
ENCRYPTED_DATA_FIELD_NUMBER
public static final int ENCRYPTED_DATA_FIELD_NUMBER
- See Also:
- Constant Field Values
-
PUBLIC_KEY_FIELD_NUMBER
public static final int PUBLIC_KEY_FIELD_NUMBER
- See Also:
- Constant Field Values
-
LABEL_FIELD_NUMBER
public static final int LABEL_FIELD_NUMBER
- See Also:
- Constant Field Values
-
CREATION_TIMESTAMP_FIELD_NUMBER
public static final int CREATION_TIMESTAMP_FIELD_NUMBER
- See Also:
- Constant Field Values
-
DETERMINISTIC_KEY_FIELD_NUMBER
public static final int DETERMINISTIC_KEY_FIELD_NUMBER
- See Also:
- Constant Field Values
-
DETERMINISTIC_SEED_FIELD_NUMBER
public static final int DETERMINISTIC_SEED_FIELD_NUMBER
- See Also:
- Constant Field Values
-
ENCRYPTED_DETERMINISTIC_SEED_FIELD_NUMBER
public static final int ENCRYPTED_DETERMINISTIC_SEED_FIELD_NUMBER
- See Also:
- Constant Field Values
-
ACCOUNT_PATH_FIELD_NUMBER
public static final int ACCOUNT_PATH_FIELD_NUMBER
- See Also:
- Constant Field Values
-
OUTPUT_SCRIPT_TYPE_FIELD_NUMBER
public static final int OUTPUT_SCRIPT_TYPE_FIELD_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
hasType
public boolean hasType()
required .wallet.Key.Type type = 1;- Specified by:
hasTypein interfaceProtos.KeyOrBuilder- Returns:
- Whether the type field is set.
-
getType
public Protos.Key.Type getType()
required .wallet.Key.Type type = 1;- Specified by:
getTypein interfaceProtos.KeyOrBuilder- Returns:
- The type.
-
hasSecretBytes
public boolean hasSecretBytes()
Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed. If the secret is encrypted, or this is a "watching entry" then this is missing.
optional bytes secret_bytes = 2;- Specified by:
hasSecretBytesin interfaceProtos.KeyOrBuilder- Returns:
- Whether the secretBytes field is set.
-
getSecretBytes
public com.google.protobuf.ByteString getSecretBytes()
Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed. If the secret is encrypted, or this is a "watching entry" then this is missing.
optional bytes secret_bytes = 2;- Specified by:
getSecretBytesin interfaceProtos.KeyOrBuilder- Returns:
- The secretBytes.
-
hasEncryptedData
public boolean hasEncryptedData()
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;- Specified by:
hasEncryptedDatain interfaceProtos.KeyOrBuilder- Returns:
- Whether the encryptedData field is set.
-
getEncryptedData
public Protos.EncryptedData getEncryptedData()
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;- Specified by:
getEncryptedDatain interfaceProtos.KeyOrBuilder- Returns:
- The encryptedData.
-
hasPublicKey
public boolean hasPublicKey()
The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing.
optional bytes public_key = 3;- Specified by:
hasPublicKeyin interfaceProtos.KeyOrBuilder- Returns:
- Whether the publicKey field is set.
-
getPublicKey
public com.google.protobuf.ByteString getPublicKey()
The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing.
optional bytes public_key = 3;- Specified by:
getPublicKeyin interfaceProtos.KeyOrBuilder- Returns:
- The publicKey.
-
hasLabel
public boolean hasLabel()
User-provided label associated with the key.
optional string label = 4;- Specified by:
hasLabelin interfaceProtos.KeyOrBuilder- Returns:
- Whether the label field is set.
-
getLabel
public java.lang.String getLabel()
User-provided label associated with the key.
optional string label = 4;- Specified by:
getLabelin interfaceProtos.KeyOrBuilder- Returns:
- The label.
-
getLabelBytes
public com.google.protobuf.ByteString getLabelBytes()
User-provided label associated with the key.
optional string label = 4;- Specified by:
getLabelBytesin interfaceProtos.KeyOrBuilder- Returns:
- The bytes for label.
-
hasCreationTimestamp
public boolean hasCreationTimestamp()
Timestamp stored as millis since epoch. Useful for skipping block bodies before this point. The reason it's optional is that keys derived from a parent don't have this data.
optional int64 creation_timestamp = 5;- Specified by:
hasCreationTimestampin interfaceProtos.KeyOrBuilder- Returns:
- Whether the creationTimestamp field is set.
-
getCreationTimestamp
public long getCreationTimestamp()
Timestamp stored as millis since epoch. Useful for skipping block bodies before this point. The reason it's optional is that keys derived from a parent don't have this data.
optional int64 creation_timestamp = 5;- Specified by:
getCreationTimestampin interfaceProtos.KeyOrBuilder- Returns:
- The creationTimestamp.
-
hasDeterministicKey
public boolean hasDeterministicKey()
optional .wallet.DeterministicKey deterministic_key = 7;- Specified by:
hasDeterministicKeyin interfaceProtos.KeyOrBuilder- Returns:
- Whether the deterministicKey field is set.
-
getDeterministicKey
public Protos.DeterministicKey getDeterministicKey()
optional .wallet.DeterministicKey deterministic_key = 7;- Specified by:
getDeterministicKeyin interfaceProtos.KeyOrBuilder- Returns:
- The deterministicKey.
-
hasDeterministicSeed
public boolean hasDeterministicSeed()
The seed for a deterministic key hierarchy. Derived from the mnemonic, but cached here for quick startup. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
optional bytes deterministic_seed = 8;- Specified by:
hasDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- Whether the deterministicSeed field is set.
-
getDeterministicSeed
public com.google.protobuf.ByteString getDeterministicSeed()
The seed for a deterministic key hierarchy. Derived from the mnemonic, but cached here for quick startup. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
optional bytes deterministic_seed = 8;- Specified by:
getDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- The deterministicSeed.
-
hasEncryptedDeterministicSeed
public boolean hasEncryptedDeterministicSeed()
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;- Specified by:
hasEncryptedDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- Whether the encryptedDeterministicSeed field is set.
-
getEncryptedDeterministicSeed
public Protos.EncryptedData getEncryptedDeterministicSeed()
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;- Specified by:
getEncryptedDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- The encryptedDeterministicSeed.
-
getAccountPathList
public java.util.List<java.lang.Integer> getAccountPathList()
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Specified by:
getAccountPathListin interfaceProtos.KeyOrBuilder- Returns:
- A list containing the accountPath.
-
getAccountPathCount
public int getAccountPathCount()
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Specified by:
getAccountPathCountin interfaceProtos.KeyOrBuilder- Returns:
- The count of accountPath.
-
getAccountPath
public int getAccountPath(int index)
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Specified by:
getAccountPathin interfaceProtos.KeyOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The accountPath at the given index.
-
hasOutputScriptType
public boolean hasOutputScriptType()
Type of addresses (aka output scripts) to generate for receiving.
optional .wallet.Key.OutputScriptType output_script_type = 11;- Specified by:
hasOutputScriptTypein interfaceProtos.KeyOrBuilder- Returns:
- Whether the outputScriptType field is set.
-
getOutputScriptType
public Protos.Key.OutputScriptType getOutputScriptType()
Type of addresses (aka output scripts) to generate for receiving.
optional .wallet.Key.OutputScriptType output_script_type = 11;- Specified by:
getOutputScriptTypein interfaceProtos.KeyOrBuilder- Returns:
- The outputScriptType.
-
parseFrom
public static Protos.Key parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static Protos.Key parseFrom(java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static Protos.Key parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static Protos.Key parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static Protos.Key parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static Protos.Key parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static Protos.Key parseFrom(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Protos.Key parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
parseDelimitedFrom
public static Protos.Key parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseDelimitedFrom
public static Protos.Key parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Protos.Key parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Protos.Key parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
newBuilder
public static Protos.Key.Builder newBuilder()
-
newBuilder
public static Protos.Key.Builder newBuilder(Protos.Key prototype)
-
dynamicMethod
protected final java.lang.Object dynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, java.lang.Object arg0, java.lang.Object arg1)- Specified by:
dynamicMethodin classcom.google.protobuf.GeneratedMessageLite<Protos.Key,Protos.Key.Builder>
-
getDefaultInstance
public static Protos.Key getDefaultInstance()
-
parser
public static com.google.protobuf.Parser<Protos.Key> parser()
-
-