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 type wallet.Key
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A key used to control Bitcoin spending.
    static enum 
    Protobuf enum wallet.Key.OutputScriptType
    static enum 
    Protobuf enum wallet.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 Object>, com.google.protobuf.GeneratedMessageLite.MethodToInvoke, com.google.protobuf.GeneratedMessageLite.SerializedForm

    Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite

    com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     

    Fields inherited from class com.google.protobuf.GeneratedMessageLite

    memoizedSerializedSize, unknownFields

    Fields inherited from class com.google.protobuf.AbstractMessageLite

    memoizedHashCode
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final Object
    dynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1)
     
    int
    getAccountPath(int index)
    The path to the root.
    int
    The path to the root.
    The path to the root.
    long
    Timestamp stored as millis since epoch.
    static Protos.Key
     
    optional .wallet.DeterministicKey deterministic_key = 7;
    com.google.protobuf.ByteString
    The seed for a deterministic key hierarchy.
    If the secret data is encrypted, then secret_bytes is missing and this field is set.
    Encrypted version of the seed
    User-provided label associated with the key.
    com.google.protobuf.ByteString
    User-provided label associated with the key.
    Type of addresses (aka output scripts) to generate for receiving.
    com.google.protobuf.ByteString
    The public EC key derived from the private key.
    com.google.protobuf.ByteString
    Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.
    required .wallet.Key.Type type = 1;
    boolean
    Timestamp stored as millis since epoch.
    boolean
    optional .wallet.DeterministicKey deterministic_key = 7;
    boolean
    The seed for a deterministic key hierarchy.
    boolean
    If the secret data is encrypted, then secret_bytes is missing and this field is set.
    boolean
    Encrypted version of the seed
    boolean
    User-provided label associated with the key.
    boolean
    Type of addresses (aka output scripts) to generate for receiving.
    boolean
    The public EC key derived from the private key.
    boolean
    Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.
    boolean
    required .wallet.Key.Type type = 1;
     
     
    static Protos.Key
     
    static Protos.Key
    parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static Protos.Key
    parseFrom(byte[] data)
     
    static Protos.Key
    parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static Protos.Key
    parseFrom(com.google.protobuf.ByteString data)
     
    static Protos.Key
    parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static Protos.Key
    parseFrom(com.google.protobuf.CodedInputStream input)
     
    static Protos.Key
    parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static Protos.Key
     
    static Protos.Key
    parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static Protos.Key
     
    static Protos.Key
    parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static com.google.protobuf.Parser<Protos.Key>
     

    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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder

    getDefaultInstanceForType, isInitialized
  • Field Details

    • TYPE_FIELD_NUMBER

      public static final int TYPE_FIELD_NUMBER
      See Also:
    • SECRET_BYTES_FIELD_NUMBER

      public static final int SECRET_BYTES_FIELD_NUMBER
      See Also:
    • ENCRYPTED_DATA_FIELD_NUMBER

      public static final int ENCRYPTED_DATA_FIELD_NUMBER
      See Also:
    • PUBLIC_KEY_FIELD_NUMBER

      public static final int PUBLIC_KEY_FIELD_NUMBER
      See Also:
    • LABEL_FIELD_NUMBER

      public static final int LABEL_FIELD_NUMBER
      See Also:
    • CREATION_TIMESTAMP_FIELD_NUMBER

      public static final int CREATION_TIMESTAMP_FIELD_NUMBER
      See Also:
    • DETERMINISTIC_KEY_FIELD_NUMBER

      public static final int DETERMINISTIC_KEY_FIELD_NUMBER
      See Also:
    • DETERMINISTIC_SEED_FIELD_NUMBER

      public static final int DETERMINISTIC_SEED_FIELD_NUMBER
      See Also:
    • ENCRYPTED_DETERMINISTIC_SEED_FIELD_NUMBER

      public static final int ENCRYPTED_DETERMINISTIC_SEED_FIELD_NUMBER
      See Also:
    • ACCOUNT_PATH_FIELD_NUMBER

      public static final int ACCOUNT_PATH_FIELD_NUMBER
      See Also:
    • OUTPUT_SCRIPT_TYPE_FIELD_NUMBER

      public static final int OUTPUT_SCRIPT_TYPE_FIELD_NUMBER
      See Also:
  • Method Details

    • hasType

      public boolean hasType()
      required .wallet.Key.Type type = 1;
      Specified by:
      hasType in interface Protos.KeyOrBuilder
      Returns:
      Whether the type field is set.
    • getType

      public Protos.Key.Type getType()
      required .wallet.Key.Type type = 1;
      Specified by:
      getType in interface Protos.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:
      hasSecretBytes in interface Protos.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:
      getSecretBytes in interface Protos.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:
      hasEncryptedData in interface Protos.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:
      getEncryptedData in interface Protos.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:
      hasPublicKey in interface Protos.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:
      getPublicKey in interface Protos.KeyOrBuilder
      Returns:
      The publicKey.
    • hasLabel

      public boolean hasLabel()
       User-provided label associated with the key.
       
      optional string label = 4;
      Specified by:
      hasLabel in interface Protos.KeyOrBuilder
      Returns:
      Whether the label field is set.
    • getLabel

      public String getLabel()
       User-provided label associated with the key.
       
      optional string label = 4;
      Specified by:
      getLabel in interface Protos.KeyOrBuilder
      Returns:
      The label.
    • getLabelBytes

      public com.google.protobuf.ByteString getLabelBytes()
       User-provided label associated with the key.
       
      optional string label = 4;
      Specified by:
      getLabelBytes in interface Protos.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:
      hasCreationTimestamp in interface Protos.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:
      getCreationTimestamp in interface Protos.KeyOrBuilder
      Returns:
      The creationTimestamp.
    • hasDeterministicKey

      public boolean hasDeterministicKey()
      optional .wallet.DeterministicKey deterministic_key = 7;
      Specified by:
      hasDeterministicKey in interface Protos.KeyOrBuilder
      Returns:
      Whether the deterministicKey field is set.
    • getDeterministicKey

      public Protos.DeterministicKey getDeterministicKey()
      optional .wallet.DeterministicKey deterministic_key = 7;
      Specified by:
      getDeterministicKey in interface Protos.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:
      hasDeterministicSeed in interface Protos.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:
      getDeterministicSeed in interface Protos.KeyOrBuilder
      Returns:
      The deterministicSeed.
    • hasEncryptedDeterministicSeed

      public boolean hasEncryptedDeterministicSeed()
       Encrypted version of the seed
       
      optional .wallet.EncryptedData encrypted_deterministic_seed = 9;
      Specified by:
      hasEncryptedDeterministicSeed in interface Protos.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:
      getEncryptedDeterministicSeed in interface Protos.KeyOrBuilder
      Returns:
      The encryptedDeterministicSeed.
    • getAccountPathList

      public List<Integer> getAccountPathList()
       The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
       
      repeated uint32 account_path = 10 [packed = true];
      Specified by:
      getAccountPathList in interface Protos.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:
      getAccountPathCount in interface Protos.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:
      getAccountPath in interface Protos.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:
      hasOutputScriptType in interface Protos.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:
      getOutputScriptType in interface Protos.KeyOrBuilder
      Returns:
      The outputScriptType.
    • parseFrom

      public static Protos.Key parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Protos.Key parseFrom(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(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Protos.Key parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static Protos.Key parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static Protos.Key parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Protos.Key parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Protos.Key parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilder

      public static Protos.Key.Builder newBuilder()
    • newBuilder

      public static Protos.Key.Builder newBuilder(Protos.Key prototype)
    • dynamicMethod

      protected final Object dynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1)
      Specified by:
      dynamicMethod in class com.google.protobuf.GeneratedMessageLite<Protos.Key,Protos.Key.Builder>
    • getDefaultInstance

      public static Protos.Key getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<Protos.Key> parser()