PrivateKeyGenerator (Class)¶
Generator for deriving private keys from an extended private key.
Used for creating wallets that can sign transactions.
__new__
¶
__new__(xprv: str | XPrv, is_multisig: bool, account_index: int, cosigner_index: Optional[int] = None) -> PrivateKeyGenerator
Create a new private key generator.
| PARAMETER | DESCRIPTION |
|---|---|
xprv
|
The master extended private key, as a string or XPrv instance.
TYPE:
|
is_multisig
|
Whether this is for a multisig wallet.
TYPE:
|
account_index
|
The account index to use.
TYPE:
|
cosigner_index
|
Optional cosigner index for multisig.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PrivateKeyGenerator
|
A new generator instance.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
Exception
|
If derivation fails. |
change_key
¶
change_key(index: int) -> PrivateKey
Get a change (internal) private key at the given index.
| PARAMETER | DESCRIPTION |
|---|---|
index
|
The address index.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PrivateKey
|
The private key at that index.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
Exception
|
If derivation fails. |
receive_key
¶
receive_key(index: int) -> PrivateKey
Get a receive (external) private key at the given index.
| PARAMETER | DESCRIPTION |
|---|---|
index
|
The address index.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PrivateKey
|
The private key at that index.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
Exception
|
If derivation fails. |