bitsharesbase.account module¶
-
class
bitsharesbase.account.
Address
(address, prefix=None)[source]¶ Bases:
graphenebase.account.Address
Address class.
This class serves as an address representation for Public Keys.
Parameters: - address (str) – Base58 encoded address (defaults to
None
) - pubkey (str) – Base58 encoded pubkey (defaults to
None
) - prefix (str) – Network prefix (defaults to
BTS
)
Example:
Address("BTSFN9r6VYzBK8EKtMewfNbfiGCr56pHDBFi")
-
classmethod
from_pubkey
(pubkey, compressed=True, version=56, prefix=None)[source]¶ Load an address provided the public key.
Version: 56 => PTS
-
prefix
= 'BTS'¶
-
set_prefix
(prefix)¶
- address (str) – Base58 encoded address (defaults to
-
class
bitsharesbase.account.
BrainKey
(brainkey=None, sequence=0, prefix=None)[source]¶ Bases:
graphenebase.account.BrainKey
Brainkey implementation similar to the graphene-ui web-wallet.
Parameters: - brainkey (str) – Brain Key
- sequence (int) – Sequence number for consecutive keys
Keys in Graphene are derived from a seed brain key which is a string of 16 words out of a predefined dictionary with 49744 words. It is a simple single-chain key derivation scheme that is not compatible with BIP44 but easy to use.
Given the brain key, a private key is derived as:
privkey = SHA256(SHA512(brainkey + " " + sequence))
Incrementing the sequence number yields a new key that can be regenerated given the brain key.
-
prefix
= 'BTS'¶
-
set_prefix
(prefix)¶
-
class
bitsharesbase.account.
PasswordKey
(account, password, role='active', prefix=None)[source]¶ Bases:
graphenebase.account.PasswordKey
This class derives a private key given the account name, the role and a password.
It leverages the technology of Brainkeys and allows people to have a secure private key by providing a passphrase only.
-
prefix
= 'BTS'¶
-
set_prefix
(prefix)¶
-
-
class
bitsharesbase.account.
PrivateKey
(wif=None, prefix=None)[source]¶ Bases:
graphenebase.account.PrivateKey
Derives the compressed and uncompressed public keys and constructs two instances of
PublicKey
:Parameters: - wif (str) – Base58check-encoded wif key
- prefix (str) – Network prefix (defaults to
BTS
)
Example::
PrivateKey("5HqUkGuo62BfcJU5vNhTXKJRXuUi9QSE6jp8C3uBJ2BVHtB8WSd")
Compressed vs. Uncompressed:
PrivateKey("w-i-f").pubkey
:- Instance of
PublicKey
using compressed key.
PrivateKey("w-i-f").pubkey.address
:- Instance of
Address
using compressed key.
PrivateKey("w-i-f").uncompressed
:- Instance of
PublicKey
using uncompressed key.
PrivateKey("w-i-f").uncompressed.address
:- Instance of
Address
using uncompressed key.
-
address
¶
-
bitcoin
¶
-
compressed
¶
-
derive_from_seed
(offset)[source]¶ Derive private key using “generate_from_seed” method. Here, the key itself serves as a seed, and offset is expected to be a sha256 digest.
-
derive_private_key
(sequence)[source]¶ Derive new private key from this private key and an arbitrary sequence number
-
prefix
= 'BTS'¶
-
pubkey
¶
-
set_prefix
(prefix)¶
-
uncompressed
¶
-
class
bitsharesbase.account.
PublicKey
(pk, prefix=None)[source]¶ Bases:
graphenebase.account.PublicKey
This class deals with Public Keys and inherits
Address
.Parameters: - pk (str) – Base58 encoded public key
- prefix (str) – Network prefix (defaults to
BTS
)
Example::
PublicKey("BTS6UtYWWs3rkZGV8JA86qrgkG6tyFksgECefKE1MiH4HkLD8PFGL")
Note
By default, graphene-based networks deal with compressed public keys. If an uncompressed key is required, the method
unCompressed
can be used:PublicKey("xxxxx").unCompressed()
-
address
¶ Obtain a GrapheneAddress from a public key
-
compressed_key
¶
-
prefix
= 'BTS'¶
-
pubkey
¶
-
set_prefix
(prefix)¶