multiversx_sdk.wallet package

Subpackages

Submodules

multiversx_sdk.wallet.core module

multiversx_sdk.wallet.core.bip39seed_to_master_key(seed: bytes)[source]
multiversx_sdk.wallet.core.bip39seed_to_secret_key(seed: bytes, address_index: int = 0)[source]
multiversx_sdk.wallet.core.derive_keys(mnemonic: str, address_index: int = 0)[source]
multiversx_sdk.wallet.core.mnemonic_to_bip39seed(mnemonic: str, passphrase: str = '')[source]

multiversx_sdk.wallet.errors module

exception multiversx_sdk.wallet.errors.CannotSignError[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.InvalidKeystoreFilePasswordError[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.InvalidMnemonicError[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.InvalidPublicKeyLengthError[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.InvalidSecretKeyLengthError[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.LibraryNotFoundError(path: Path)[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.UnknownCipherError(name: str)[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.UnknownDerivationFunctionError[source]

Bases: Exception

exception multiversx_sdk.wallet.errors.UnsupportedOSError(os_name: str)[source]

Bases: Exception

multiversx_sdk.wallet.interfaces module

class multiversx_sdk.wallet.interfaces.IRandomness(*args, **kwargs)[source]

Bases: Protocol

id: str
iv: bytes
salt: bytes

multiversx_sdk.wallet.keypair module

class multiversx_sdk.wallet.keypair.KeyPair(secret_key: UserSecretKey)[source]

Bases: object

static generate() KeyPair[source]
get_public_key() UserPublicKey[source]
get_secret_key() UserSecretKey[source]
static new_from_bytes(data: bytes) KeyPair[source]
sign(data: bytes) bytes[source]

Signs using the secret key of the keypair.

verify(data: bytes, signature: bytes) bool[source]

Verifies using the public key of the keypair.

multiversx_sdk.wallet.mnemonic module

class multiversx_sdk.wallet.mnemonic.Mnemonic(text: str)[source]

Bases: object

classmethod assert_text_is_valid(text: str) None[source]
derive_key(address_index: int = 0) UserSecretKey[source]
classmethod from_entropy(entropy: bytes) Mnemonic[source]
classmethod generate() Mnemonic[source]
get_entropy() bytes[source]
get_text() str[source]
get_words() list[str][source]
classmethod is_text_valid(text: str) bool[source]

multiversx_sdk.wallet.pem_entry module

class multiversx_sdk.wallet.pem_entry.PemEntry(label: str, message: bytes)[source]

Bases: object

classmethod from_text_all(pem_text: str) list[PemEntry][source]
to_text() str[source]

multiversx_sdk.wallet.user_keys module

class multiversx_sdk.wallet.user_keys.UserPublicKey(buffer: bytes)[source]

Bases: object

get_bytes() bytes[source]
hex() str[source]
to_address(hrp: str | None = None) Address[source]
verify(data: bytes, signature: bytes) bool[source]
class multiversx_sdk.wallet.user_keys.UserSecretKey(buffer: bytes)[source]

Bases: object

classmethod generate() UserSecretKey[source]
generate_public_key() UserPublicKey[source]
get_bytes() bytes[source]
hex() str[source]
classmethod new_from_string(buffer_hex: str) UserSecretKey[source]
sign(data: bytes) bytes[source]

multiversx_sdk.wallet.user_pem module

class multiversx_sdk.wallet.user_pem.UserPEM(label: str, secret_key: UserSecretKey)[source]

Bases: object

classmethod from_file(path: Path, index: int = 0) UserPEM[source]
classmethod from_file_all(path: Path) list[UserPEM][source]
classmethod from_text(text: str, index: int = 0) UserPEM[source]
classmethod from_text_all(text: str) list[UserPEM][source]
save(path: Path)[source]
to_text() str[source]

multiversx_sdk.wallet.user_signer module

class multiversx_sdk.wallet.user_signer.UserSigner(secret_key: UserSecretKey)[source]

Bases: object

ed25519 signer

classmethod from_pem_file(path: Path, index: int = 0) UserSigner[source]
classmethod from_pem_file_all(path: Path) list[UserSigner][source]
classmethod from_wallet(path: Path, password: str) UserSigner[source]
get_pubkey() UserPublicKey[source]
sign(data: bytes) bytes[source]

multiversx_sdk.wallet.user_verifer module

class multiversx_sdk.wallet.user_verifer.UserVerifier(public_key: UserPublicKey)[source]

Bases: object

classmethod from_address(address: Address) UserVerifier[source]
verify(data: bytes, signature: bytes) bool[source]

multiversx_sdk.wallet.user_wallet module

class multiversx_sdk.wallet.user_wallet.UserWallet(kind: str, encrypted_data: EncryptedData, public_key_when_kind_is_secret_key: UserPublicKey | None = None)[source]

Bases: object

Do not use this constructor directly. Use the static methods from_secret_key() and from_mnemonic() instead.

classmethod decrypt_mnemonic(keyfile_object: dict[str, Any], password: str) Mnemonic[source]
classmethod decrypt_secret_key(keyfile_object: dict[str, Any], password: str) UserSecretKey[source]
classmethod from_mnemonic(mnemonic: str, password: str, randomness: IRandomness | None = None) UserWallet[source]
classmethod from_secret_key(secret_key: UserSecretKey, password: str, randomness: IRandomness | None = None) UserWallet[source]
classmethod load_secret_key(path: Path, password: str, address_index: int | None = None) UserSecretKey[source]

Loads a secret key from a keystore file.

Parameters:
  • path – The path to the keystore file.

  • password – The password to decrypt the keystore file.

  • address_index – The index of the address to load. This is only used when the keystore file contains a mnemonic, and the secret key has to be derived from this mnemonic.

save(path: Path, address_hrp: str | None = None)[source]
to_dict(address_hrp: str | None = None) dict[str, Any][source]
to_json(address_hrp: str | None = None) str[source]
class multiversx_sdk.wallet.user_wallet.UserWalletKind(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

MNEMONIC = 'mnemonic'
SECRET_KEY = 'secretKey'

multiversx_sdk.wallet.validator_keys module

class multiversx_sdk.wallet.validator_keys.ValidatorPublicKey(buffer: bytes)[source]

Bases: object

classmethod from_string(buffer_hex: str) ValidatorPublicKey[source]
hex() str[source]
verify(data: bytes, signature: bytes) bool[source]
class multiversx_sdk.wallet.validator_keys.ValidatorSecretKey(buffer: bytes)[source]

Bases: object

classmethod from_string(buffer_hex: str) ValidatorSecretKey[source]
classmethod generate() ValidatorSecretKey[source]
generate_public_key() ValidatorPublicKey[source]
hex() str[source]
sign(data: bytes) bytes[source]

multiversx_sdk.wallet.validator_pem module

class multiversx_sdk.wallet.validator_pem.ValidatorPEM(label: str, secret_key: ValidatorSecretKey)[source]

Bases: object

classmethod from_file(path: Path, index: int = 0) ValidatorPEM[source]
classmethod from_file_all(path: Path) list[ValidatorPEM][source]
classmethod from_text(text: str, index: int = 0) ValidatorPEM[source]
classmethod from_text_all(text: str) list[ValidatorPEM][source]
save(path: Path)[source]
to_text()[source]

multiversx_sdk.wallet.validator_signer module

class multiversx_sdk.wallet.validator_signer.ValidatorSigner(secret_key: ValidatorSecretKey)[source]

Bases: object

Validator signer (BLS signer)

classmethod from_pem_file(path: Path, index: int = 0) ValidatorSigner[source]
get_pubkey() ValidatorPublicKey[source]
sign(data: bytes) bytes[source]

multiversx_sdk.wallet.validator_verifier module

class multiversx_sdk.wallet.validator_verifier.ValidatorVerifier(public_key: ValidatorPublicKey)[source]

Bases: object

classmethod from_string(buffer_hex: str) ValidatorVerifier[source]
verify(data: bytes, signature: bytes) bool[source]

Module contents

class multiversx_sdk.wallet.KeyPair(secret_key: UserSecretKey)[source]

Bases: object

static generate() KeyPair[source]
get_public_key() UserPublicKey[source]
get_secret_key() UserSecretKey[source]
static new_from_bytes(data: bytes) KeyPair[source]
sign(data: bytes) bytes[source]

Signs using the secret key of the keypair.

verify(data: bytes, signature: bytes) bool[source]

Verifies using the public key of the keypair.

class multiversx_sdk.wallet.Mnemonic(text: str)[source]

Bases: object

classmethod assert_text_is_valid(text: str) None[source]
derive_key(address_index: int = 0) UserSecretKey[source]
classmethod from_entropy(entropy: bytes) Mnemonic[source]
classmethod generate() Mnemonic[source]
get_entropy() bytes[source]
get_text() str[source]
get_words() list[str][source]
classmethod is_text_valid(text: str) bool[source]
class multiversx_sdk.wallet.UserPEM(label: str, secret_key: UserSecretKey)[source]

Bases: object

classmethod from_file(path: Path, index: int = 0) UserPEM[source]
classmethod from_file_all(path: Path) list[UserPEM][source]
classmethod from_text(text: str, index: int = 0) UserPEM[source]
classmethod from_text_all(text: str) list[UserPEM][source]
save(path: Path)[source]
to_text() str[source]
class multiversx_sdk.wallet.UserPublicKey(buffer: bytes)[source]

Bases: object

get_bytes() bytes[source]
hex() str[source]
to_address(hrp: str | None = None) Address[source]
verify(data: bytes, signature: bytes) bool[source]
class multiversx_sdk.wallet.UserSecretKey(buffer: bytes)[source]

Bases: object

classmethod generate() UserSecretKey[source]
generate_public_key() UserPublicKey[source]
get_bytes() bytes[source]
hex() str[source]
classmethod new_from_string(buffer_hex: str) UserSecretKey[source]
sign(data: bytes) bytes[source]
class multiversx_sdk.wallet.UserSigner(secret_key: UserSecretKey)[source]

Bases: object

ed25519 signer

classmethod from_pem_file(path: Path, index: int = 0) UserSigner[source]
classmethod from_pem_file_all(path: Path) list[UserSigner][source]
classmethod from_wallet(path: Path, password: str) UserSigner[source]
get_pubkey() UserPublicKey[source]
sign(data: bytes) bytes[source]
class multiversx_sdk.wallet.UserVerifier(public_key: UserPublicKey)[source]

Bases: object

classmethod from_address(address: Address) UserVerifier[source]
verify(data: bytes, signature: bytes) bool[source]
class multiversx_sdk.wallet.UserWallet(kind: str, encrypted_data: EncryptedData, public_key_when_kind_is_secret_key: UserPublicKey | None = None)[source]

Bases: object

Do not use this constructor directly. Use the static methods from_secret_key() and from_mnemonic() instead.

classmethod decrypt_mnemonic(keyfile_object: dict[str, Any], password: str) Mnemonic[source]
classmethod decrypt_secret_key(keyfile_object: dict[str, Any], password: str) UserSecretKey[source]
classmethod from_mnemonic(mnemonic: str, password: str, randomness: IRandomness | None = None) UserWallet[source]
classmethod from_secret_key(secret_key: UserSecretKey, password: str, randomness: IRandomness | None = None) UserWallet[source]
classmethod load_secret_key(path: Path, password: str, address_index: int | None = None) UserSecretKey[source]

Loads a secret key from a keystore file.

Parameters:
  • path – The path to the keystore file.

  • password – The password to decrypt the keystore file.

  • address_index – The index of the address to load. This is only used when the keystore file contains a mnemonic, and the secret key has to be derived from this mnemonic.

save(path: Path, address_hrp: str | None = None)[source]
to_dict(address_hrp: str | None = None) dict[str, Any][source]
to_json(address_hrp: str | None = None) str[source]
class multiversx_sdk.wallet.ValidatorPEM(label: str, secret_key: ValidatorSecretKey)[source]

Bases: object

classmethod from_file(path: Path, index: int = 0) ValidatorPEM[source]
classmethod from_file_all(path: Path) list[ValidatorPEM][source]
classmethod from_text(text: str, index: int = 0) ValidatorPEM[source]
classmethod from_text_all(text: str) list[ValidatorPEM][source]
save(path: Path)[source]
to_text()[source]
class multiversx_sdk.wallet.ValidatorPublicKey(buffer: bytes)[source]

Bases: object

classmethod from_string(buffer_hex: str) ValidatorPublicKey[source]
hex() str[source]
verify(data: bytes, signature: bytes) bool[source]
class multiversx_sdk.wallet.ValidatorSecretKey(buffer: bytes)[source]

Bases: object

classmethod from_string(buffer_hex: str) ValidatorSecretKey[source]
classmethod generate() ValidatorSecretKey[source]
generate_public_key() ValidatorPublicKey[source]
hex() str[source]
sign(data: bytes) bytes[source]
class multiversx_sdk.wallet.ValidatorSigner(secret_key: ValidatorSecretKey)[source]

Bases: object

Validator signer (BLS signer)

classmethod from_pem_file(path: Path, index: int = 0) ValidatorSigner[source]
get_pubkey() ValidatorPublicKey[source]
sign(data: bytes) bytes[source]
class multiversx_sdk.wallet.ValidatorVerifier(public_key: ValidatorPublicKey)[source]

Bases: object

classmethod from_string(buffer_hex: str) ValidatorVerifier[source]
verify(data: bytes, signature: bytes) bool[source]