aquachain.bip44
index
/home/user/.local/lib/python3.6/site-packages/aquachain/bip44.py

Ethereum BIP44 Python
https://github.com/michailbrynard/ethereum-bip44-python
================================
 
*Code adapted from two1 library for bitcoin by 21 Inc. (https://github.com/21dotco/two1-python/tree/master/two1)
 
### Requirements
Python packages:
`pip install two1 pycrypto rlp pycryptodome`
 
Imports:
`from crypto import HDPrivateKeyHDPublicKeyHDKey`
 
### BIP32 Master Keys Creation:
```
master_key, mnemonic = HDPrivateKey.master_key_from_entropy()
print('BIP32 Wallet Generated.')
print('Mnemonic Secret: ' + mnemonic)
```
 
### Get Account XPUB
```
master_key = HDPrivateKey.master_key_from_mnemonic('laundry snap patient survey sleep strategy finger bone real west arch protect')
root_keys = HDKey.from_path(master_key,"m/44'/60'/0'")
acct_priv_key = root_keys[-1]
acct_pub_key = acct_priv_key.public_key
print('Account Master Public Key (Hex): ' + acct_pub_key.to_hex())
print('XPUB format: ' + acct_pub_key.to_b58check())
```
 
### Get Address from XPUB
```
acct_pub_key = HDKey.from_b58check('xpub6DKMR7KpgCJbiN4TdzcqcB1Nk84D9bsYUBhbk43EjRqH4RTjz7UgGLZxcQ4JdHBSHDmTUDLApMwYHRQCbbMCPQEtcbVofZEQjFazpGPT1nW')
keys = HDKey.from_path(acct_pub_key,'{change}/{index}'.format(change=0, index=0))
address = keys[-1].address()
print('Account address: ' + address)
```

 
Modules
       
base58
base64
hashlib
hmac
math
random

 
Classes
       
builtins.object
HDKey
HDPrivateKey(HDKey, PrivateKeyBase)
HDPublicKey(HDKey, PublicKeyBase)
PrivateKeyBase
PrivateKey
PublicKeyBase
PublicKey
Signature

 
class HDKey(builtins.object)
    Base class for HDPrivateKey and HDPublicKey.
 
Args:
    key (PrivateKey or PublicKey): The underlying simple private or
       public key that is used to sign/verify.
    chain_code (bytes): The chain code associated with the HD key.
    depth (int): How many levels below the master node this key is. By
       definition, depth = 0 for the master node.
    index (int): A value between 0 and 0xffffffff indicating the child
       number. Values >= 0x80000000 are considered hardened children.
    parent_fingerprint (bytes): The fingerprint of the parent node. This
       is 0x00000000 for the master node.
 
Returns:
    HDKey: An HDKey object.
 
  Methods defined here:
__bytes__(self)
__init__(self, key, chain_code, index, depth, parent_fingerprint)
Initialize self.  See help(type(self)) for accurate signature.
to_b58check(self, testnet=False)
Generates a Base58Check encoding of this key.
 
Args:
    testnet (bool): True if the key is to be used with
        testnet, False otherwise.
Returns:
    str: A Base58Check encoded string representing the key.

Static methods defined here:
from_b58check(key)
Decodes a Base58Check encoded key.
 
The encoding must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    key (str): A Base58Check encoded key.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_bytes(b)
Generates either a HDPrivateKey or HDPublicKey from the underlying
bytes.
 
The serialization must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    b (bytes): A byte stream conforming to the above.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_hex(h)
Generates either a HDPrivateKey or HDPublicKey from the underlying
hex-encoded string.
 
The serialization must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    h (str): A hex-encoded string conforming to the above.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_path(root_key, path)
parse_path(path)
path_from_indices(l)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
fingerprint
Returns the key's fingerprint, which is the first 4 bytes
of its identifier.
 
A key's identifier and fingerprint are defined as:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#key-identifiers
 
Returns:
    bytes: The first 4 bytes of the RIPEMD-160 hash.
hardened
Whether or not this is a hardened node.
 
Hardened nodes are those with indices >= 0x80000000.
 
Returns:
    bool: True if this is hardened, False otherwise.
identifier
Returns the identifier for the key.
 
A key's identifier and fingerprint are defined as:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#key-identifiers
 
Returns:
    bytes: A 20-byte RIPEMD-160 hash.
master
Whether or not this is a master node.
 
Returns:
    bool: True if this is a master node, False otherwise.
testnet_bytes
Serialization of the key for testnet.
 
Returns:
    bytes:
        A 78-byte serialization of the key, specifically for
        testnet (i.e. the first 2 bytes will be 0x0435).

 
class HDPrivateKey(HDKey, PrivateKeyBase)
    Implements an HD Private Key according to BIP-0032:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
 
For the vast majority of use cases, the 3 static functions
(HDPrivateKey.master_key_from_entropy,
HDPrivateKey.master_key_from_seed and
HDPrivateKey.from_parent) will be used rather than directly
constructing an object.
 
Args:
    key (PrivateKey or PublicKey): The underlying simple private or
       public key that is used to sign/verify.
    chain_code (bytes): The chain code associated with the HD key.
    depth (int): How many levels below the master node this key is. By
       definition, depth = 0 for the master node.
    index (int): A value between 0 and 0xffffffff indicating the child
       number. Values >= 0x80000000 are considered hardened children.
    parent_fingerprint (bytes): The fingerprint of the parent node. This
       is 0x00000000 for the master node.
 
Returns:
    HDKey: An HDKey object.
 
 
Method resolution order:
HDPrivateKey
HDKey
PrivateKeyBase
builtins.object

Methods defined here:
__init__(self, key, chain_code, index, depth, parent_fingerprint=b'\x00\x00\x00\x00')
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)

Static methods defined here:
from_parent(parent_key, i)
Derives a child private key from a parent
private key. It is not possible to derive a child
private key from a public parent key.
 
Args:
    parent_private_key (HDPrivateKey):
master_key_from_mnemonic(mnemonic, passphrase='')
Generates a master key from a mnemonic.
 
Args:
    mnemonic (str): The mnemonic sentence representing
       the seed from which to generate the master key.
    passphrase (str): Password if one was used.
 
Returns:
    HDPrivateKey: the master private key.
master_key_from_seed(seed)
Generates a master key from a provided seed.
 
Args:
    seed (bytes or str): a string of bytes or a hex string
 
Returns:
    HDPrivateKey: the master private key.

Data descriptors defined here:
identifier
Returns the identifier for the key.
 
A key's identifier and fingerprint are defined as:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#key-identifiers
 
In this case, it will return the RIPEMD-160 hash of the
corresponding public key.
 
Returns:
    bytes: A 20-byte RIPEMD-160 hash.
public_key
Returns the public key associated with this private key.
 
Returns:
    HDPublicKey:
        The HDPublicKey object that corresponds to this
        private key.

Data and other attributes defined here:
MAINNET_VERSION = 76066276
TESTNET_VERSION = 70615956

Methods inherited from HDKey:
__bytes__(self)
to_b58check(self, testnet=False)
Generates a Base58Check encoding of this key.
 
Args:
    testnet (bool): True if the key is to be used with
        testnet, False otherwise.
Returns:
    str: A Base58Check encoded string representing the key.

Static methods inherited from HDKey:
from_b58check(key)
Decodes a Base58Check encoded key.
 
The encoding must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    key (str): A Base58Check encoded key.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_bytes(b)
Generates either a HDPrivateKey or HDPublicKey from the underlying
bytes.
 
The serialization must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    b (bytes): A byte stream conforming to the above.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_hex(h)
Generates either a HDPrivateKey or HDPublicKey from the underlying
hex-encoded string.
 
The serialization must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    h (str): A hex-encoded string conforming to the above.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_path(root_key, path)
parse_path(path)
path_from_indices(l)

Data descriptors inherited from HDKey:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
fingerprint
Returns the key's fingerprint, which is the first 4 bytes
of its identifier.
 
A key's identifier and fingerprint are defined as:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#key-identifiers
 
Returns:
    bytes: The first 4 bytes of the RIPEMD-160 hash.
hardened
Whether or not this is a hardened node.
 
Hardened nodes are those with indices >= 0x80000000.
 
Returns:
    bool: True if this is hardened, False otherwise.
master
Whether or not this is a master node.
 
Returns:
    bool: True if this is a master node, False otherwise.
testnet_bytes
Serialization of the key for testnet.
 
Returns:
    bytes:
        A 78-byte serialization of the key, specifically for
        testnet (i.e. the first 2 bytes will be 0x0435).

Methods inherited from PrivateKeyBase:
to_hex(self)
Generates a hex encoding of the serialized key.
 
Returns:
   str: A hex encoded string representing the key.

 
class HDPublicKey(HDKey, PublicKeyBase)
    Implements an HD Public Key according to BIP-0032:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
 
For the vast majority of use cases, the static function
HDPublicKey.from_parent() will be used rather than directly
constructing an object.
 
Args:
    x (int): x component of the point representing the public key.
    y (int): y component of the point representing the public key.
    chain_code (bytes): The chain code associated with the HD key.
    depth (int): How many levels below the master node this key is. By
       definition, depth = 0 for the master node.
    index (int): A value between 0 and 0xffffffff indicating the child
       number. Values >= 0x80000000 are considered hardened children.
    parent_fingerprint (bytes): The fingerprint of the parent node. This
       is 0x00000000 for the master node.
 
Returns:
    HDPublicKey: An HDPublicKey object.
 
 
Method resolution order:
HDPublicKey
HDKey
PublicKeyBase
builtins.object

Methods defined here:
__init__(self, x, y, chain_code, index, depth, parent_fingerprint=b'\x00\x00\x00\x00')
Initialize self.  See help(type(self)) for accurate signature.
address(self, compressed=True, testnet=False)
Address property that returns the Base58Check
encoded version of the HASH160.
 
Args:
    compressed (bool): Whether or not the compressed key should
       be used.
    testnet (bool): Whether or not the key is intended for testnet
       usage. False indicates mainnet usage.
 
Returns:
    bytes: Base58Check encoded string
hash160(self, compressed=True)
Return the RIPEMD-160 hash of the SHA-256 hash of the
non-extended public key.
 
Note:
    This always returns the hash of the compressed version of
    the public key.
 
Returns:
    bytes: RIPEMD-160 byte string.

Static methods defined here:
from_parent(parent_key, i)

Data descriptors defined here:
compressed_bytes
Byte string corresponding to a compressed representation
of this public key.
 
Returns:
    b (bytes): A 33-byte long byte string.
identifier
Returns the identifier for the key.
 
A key's identifier and fingerprint are defined as:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#key-identifiers
 
In this case, it will return the RIPEMD-160 hash of the
non-extended public key.
 
Returns:
    bytes: A 20-byte RIPEMD-160 hash.

Data and other attributes defined here:
MAINNET_VERSION = 76067358
TESTNET_VERSION = 70617039

Methods inherited from HDKey:
__bytes__(self)
to_b58check(self, testnet=False)
Generates a Base58Check encoding of this key.
 
Args:
    testnet (bool): True if the key is to be used with
        testnet, False otherwise.
Returns:
    str: A Base58Check encoded string representing the key.

Static methods inherited from HDKey:
from_b58check(key)
Decodes a Base58Check encoded key.
 
The encoding must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    key (str): A Base58Check encoded key.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_bytes(b)
Generates either a HDPrivateKey or HDPublicKey from the underlying
bytes.
 
The serialization must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    b (bytes): A byte stream conforming to the above.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_hex(h)
Generates either a HDPrivateKey or HDPublicKey from the underlying
hex-encoded string.
 
The serialization must conform to the description in:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
 
Args:
    h (str): A hex-encoded string conforming to the above.
 
Returns:
    HDPrivateKey or HDPublicKey:
        Either an HD private or
        public key object, depending on what was serialized.
from_path(root_key, path)
parse_path(path)
path_from_indices(l)

Data descriptors inherited from HDKey:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
fingerprint
Returns the key's fingerprint, which is the first 4 bytes
of its identifier.
 
A key's identifier and fingerprint are defined as:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#key-identifiers
 
Returns:
    bytes: The first 4 bytes of the RIPEMD-160 hash.
hardened
Whether or not this is a hardened node.
 
Hardened nodes are those with indices >= 0x80000000.
 
Returns:
    bool: True if this is hardened, False otherwise.
master
Whether or not this is a master node.
 
Returns:
    bool: True if this is a master node, False otherwise.
testnet_bytes
Serialization of the key for testnet.
 
Returns:
    bytes:
        A 78-byte serialization of the key, specifically for
        testnet (i.e. the first 2 bytes will be 0x0435).

Methods inherited from PublicKeyBase:
__int__(self)
to_hex(self)
Hex representation of the serialized byte stream.
 
Returns:
    h (str): A hex-encoded string.
verify(self, message, signature, do_hash=True)
Verifies that message was appropriately signed.
 
Args:
    message (bytes): The message to be verified.
    signature (Signature): A signature object.
    do_hash (bool): True if the message should be hashed prior
      to signing, False if not. This should always be left as
      True except in special situations which require doing
      the hash outside (e.g. handling Bitcoin bugs).
 
Returns:
    verified (bool): True if the signature is verified, False
    otherwise.

Static methods inherited from PublicKeyBase:
from_private_key(private_key)
Generates a public key object from a PrivateKey object.
 
Args:
    private_key (PrivateKey): The private key object from
       which to derive this object.
 
Returns:
    PublicKey: A PublicKey object.

 
class PrivateKey(PrivateKeyBase)
    Encapsulation of a Bitcoin ECDSA private key.
 
This class provides capability to generate private keys,
obtain the corresponding public key, sign messages and
serialize/deserialize into a variety of formats.
 
Args:
    k (int): The private key.
 
Returns:
    PrivateKey: The object representing the private key.
 
 
Method resolution order:
PrivateKey
PrivateKeyBase
builtins.object

Methods defined here:
__bytes__(self)
__init__(self, k)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
to_b58check(self, testnet=False)
Generates a Base58Check encoding of this private key.
 
Returns:
    str: A Base58Check encoded string representing the key.

Static methods defined here:
from_b58check(private_key)
Decodes a Base58Check encoded private-key.
 
Args:
    private_key (str): A Base58Check encoded private key.
 
Returns:
    PrivateKey: A PrivateKey object
from_bytes(b)
Generates PrivateKey from the underlying bytes.
 
Args:
    b (bytes): A byte stream containing a 256-bit (32-byte) integer.
 
Returns:
    tuple(PrivateKey, bytes): A PrivateKey object and the remainder
    of the bytes.
from_hex(h)
Generates PrivateKey from a hex-encoded string.
 
Args:
    h (str): A hex-encoded string containing a 256-bit
         (32-byte) integer.
 
Returns:
    PrivateKey: A PrivateKey object.
from_int(i)
Initializes a private key from an integer.
 
Args:
    i (int): Integer that is the private key.
 
Returns:
    PrivateKey: The object representing the private key.
from_random()
Initializes a private key from a random integer.
 
Returns:
    PrivateKey: The object representing the private key.

Data descriptors defined here:
public_key
Returns the public key associated with this private key.
 
Returns:
    PublicKey:
        The PublicKey object that corresponds to this
        private key.

Data and other attributes defined here:
MAINNET_VERSION = 128
TESTNET_VERSION = 239

Methods inherited from PrivateKeyBase:
to_hex(self)
Generates a hex encoding of the serialized key.
 
Returns:
   str: A hex encoded string representing the key.

Data descriptors inherited from PrivateKeyBase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class PrivateKeyBase(builtins.object)
    Base class for both PrivateKey and HDPrivateKey.
 
As this class is a base class it should not be used directly.
 
Args:
    k (int): The private key.
 
Returns:
    PrivateKey: The object representing the private key.
 
  Methods defined here:
__bytes__(self)
__init__(self, k)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
to_b58check(self, testnet=False)
Generates a Base58Check encoding of this private key.
 
Returns:
    str: A Base58Check encoded string representing the key.
to_hex(self)
Generates a hex encoding of the serialized key.
 
Returns:
   str: A hex encoded string representing the key.

Static methods defined here:
from_b58check(private_key)
Decodes a Base58Check encoded private-key.
 
Args:
    private_key (str): A Base58Check encoded private key.
 
Returns:
    PrivateKey: A PrivateKey object

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
public_key
Returns the public key associated with this private key.
 
Returns:
    PublicKey:
        The PublicKey object that corresponds to this
        private key.

 
class PublicKey(PublicKeyBase)
    Encapsulation of a Bitcoin ECDSA public key.
 
This class provides a high-level API to using an ECDSA public
key, specifically for Bitcoin (secp256k1) purposes.
 
Args:
    x (int): The x component of the public key point.
    y (int): The y component of the public key point.
 
Returns:
    PublicKey: The object representing the public key.
 
 
Method resolution order:
PublicKey
PublicKeyBase
builtins.object

Methods defined here:
__bytes__(self)
__init__(self, x, y)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
address(self, compressed=True, testnet=False)
Address property that returns the Base58Check
encoded version of the HASH160.
 
Args:
    compressed (bool): Whether or not the compressed key should
       be used.
    testnet (bool): Whether or not the key is intended for testnet
       usage. False indicates mainnet usage.
 
Returns:
    bytes: Base58Check encoded string
hash160(self, compressed=True)
Return the RIPEMD-160 hash of the SHA-256 hash of the
public key.
 
Args:
    compressed (bool): Whether or not the compressed key should
       be used.
Returns:
    bytes: RIPEMD-160 byte string.
to_base64(self)
Hex representation of the serialized byte stream.
 
Returns:
    b (str): A Base64-encoded string.
verify(self, message, signature, do_hash=True)
Verifies that message was appropriately signed.
 
Args:
    message (bytes): The message to be verified.
    signature (Signature): A signature object.
    do_hash (bool): True if the message should be hashed prior
      to signing, False if not. This should always be left as
      True except in special situations which require doing
      the hash outside (e.g. handling Bitcoin bugs).
 
Returns:
    verified (bool): True if the signature is verified, False
    otherwise.

Static methods defined here:
from_base64(b64str, testnet=False)
Generates a public key object from a Base64 encoded string.
 
Args:
    b64str (str): A Base64-encoded string.
    testnet (bool) (Optional): If True, changes the version that
       is prepended to the key.
 
Returns:
    PublicKey: A PublicKey object.
from_bytes(key_bytes)
Generates a public key object from a byte (or hex) string.
 
The byte stream must be of the SEC variety
(http://www.secg.org/): beginning with a single byte telling
what key representation follows. A full, uncompressed key
is represented by: 0x04 followed by 64 bytes containing
the x and y components of the point. For compressed keys
with an even y component, 0x02 is followed by 32 bytes
containing the x component. For compressed keys with an
odd y component, 0x03 is followed by 32 bytes containing
the x component.
 
Args:
    key_bytes (bytes or str): A byte stream that conforms to the above.
 
Returns:
    PublicKey: A PublicKey object.
from_hex(h)
Generates a public key object from a hex-encoded string.
 
See from_bytes() for requirements of the hex string.
 
Args:
    h (str): A hex-encoded string.
 
Returns:
    PublicKey: A PublicKey object.
from_point(p)
Generates a public key object from any object
containing x, y coordinates.
 
Args:
    p (Point): An object containing a two-dimensional, affine
       representation of a point on the secp256k1 curve.
 
Returns:
    PublicKey: A PublicKey object.

Data descriptors defined here:
compressed_bytes
Byte string corresponding to a compressed representation
of this public key.
 
Returns:
    b (bytes): A 33-byte long byte string.

Data and other attributes defined here:
MAINNET_VERSION = 0
TESTNET_VERSION = 111

Methods inherited from PublicKeyBase:
to_hex(self)
Hex representation of the serialized byte stream.
 
Returns:
    h (str): A hex-encoded string.

Static methods inherited from PublicKeyBase:
from_private_key(private_key)
Generates a public key object from a PrivateKey object.
 
Args:
    private_key (PrivateKey): The private key object from
       which to derive this object.
 
Returns:
    PublicKey: A PublicKey object.

Data descriptors inherited from PublicKeyBase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class PublicKeyBase(builtins.object)
    Base class for both PublicKey and HDPublicKey.
 
As this class is a base class it should not be used directly.
 
Args:
    x (int): The x component of the public key point.
    y (int): The y component of the public key point.
 
Returns:
    PublicKey: The object representing the public key.
 
  Methods defined here:
__bytes__(self)
__init__(self)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
address(self, compressed=True, testnet=False)
Address property that returns the Base58Check
encoded version of the HASH160.
 
Args:
    compressed (bool): Whether or not the compressed key should
       be used.
    testnet (bool): Whether or not the key is intended for testnet
       usage. False indicates mainnet usage.
 
Returns:
    bytes: Base58Check encoded string
hash160(self, compressed=True)
Return the RIPEMD-160 hash of the SHA-256 hash of the
public key.
 
Args:
    compressed (bool): Whether or not the compressed key should
       be used.
Returns:
    bytes: RIPEMD-160 byte string.
to_hex(self)
Hex representation of the serialized byte stream.
 
Returns:
    h (str): A hex-encoded string.
verify(self, message, signature, do_hash=True)
Verifies that message was appropriately signed.
 
Args:
    message (bytes): The message to be verified.
    signature (Signature): A signature object.
    do_hash (bool): True if the message should be hashed prior
      to signing, False if not. This should always be left as
      True except in special situations which require doing
      the hash outside (e.g. handling Bitcoin bugs).
 
Returns:
    verified (bool): True if the signature is verified, False
    otherwise.

Static methods defined here:
from_bytes(key_bytes)
Generates a public key object from a byte (or hex) string.
 
Args:
    key_bytes (bytes or str): A byte stream.
 
Returns:
    PublicKey: A PublicKey object.
from_private_key(private_key)
Generates a public key object from a PrivateKey object.
 
Args:
    private_key (PrivateKey): The private key object from
       which to derive this object.
 
Returns:
    PublicKey: A PublicKey object.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
compressed_bytes
Byte string corresponding to a compressed representation
of this public key.
 
Returns:
    b (bytes): A 33-byte long byte string.

 
class Signature(builtins.object)
    Encapsulation of a ECDSA signature for Bitcoin purposes.
 
Args:
    r (Bignum): r component of the signature.
    s (Bignum): s component of the signature.
    recovery_id (int) (Optional): Must be between 0 and 3 specifying
       which of the public keys generated by the algorithm specified
       in http://www.secg.org/sec1-v2.pdf Section 4.1.6 (Public Key
       Recovery Operation) is the correct one for this signature.
 
Returns:
    sig (Signature): A Signature object.
 
  Methods defined here:
__bytes__(self)
__init__(self, r, s, recovery_id=None)
Initialize self.  See help(type(self)) for accurate signature.
to_base64(self)
Hex representation of the serialized byte stream.
 
Returns:
    str: A Base64-encoded string.
to_der(self)
Encodes this signature using DER
 
Returns:
    bytes: The DER encoding of (self.r, self.s).
to_hex(self)
Hex representation of the serialized byte stream.
 
Returns:
    str: A hex-encoded string.

Static methods defined here:
from_base64(b64str)
Generates a signature object from a Base64 encoded string.
 
Args:
    b64str (str): A Base64-encoded string.
 
Returns:
    Signature: A Signature object.
from_bytes(b)
Extracts the r and s components from a byte string.
 
Args:
    b (bytes): A 64-byte long string. The first 32 bytes are
       extracted as the r component and the second 32 bytes
       are extracted as the s component.
 
Returns:
    Signature: A Signature object.
 
Raises:
    ValueError: If signature is incorrect length
from_der(der)
Decodes a Signature that was DER-encoded.
 
Args:
    der (bytes or str): The DER encoding to be decoded.
 
Returns:
    Signature: The deserialized signature.
from_hex(h)
Extracts the r and s components from a hex-encoded string.
 
Args:
    h (str): A 64-byte (128 character) long string. The first
       32 bytes are extracted as the r component and the
       second 32 bytes are extracted as the s component.
 
Returns:
    Signature: A Signature object.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
x
Convenience property for any method that requires
this object to provide a Point interface.
y
Convenience property for any method that requires
this object to provide a Point interface.

 
Functions
       
get_bytes(s)
Returns the byte representation of a hex- or byte-string.

 
Data
        bitcoin_curve = <aquachain.crypto.ecdsa_python.secp256k1 object>