Wallet#

class defichain.Wallet(network: Any, semantic: str | None = None, use_default_path: bool = True)#

Hierarchical Deterministic Wallet

Parameters:
  • network (network) – network instance: DefichainMainnet, DefichainTestnet, DefichainRegtest, defaults to None.

  • semantic (str) – Extended semantic, defaults to P2PKH.

  • use_default_path (bool) – Use default derivation path, defaults to False.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

static decrypt(passphrase: str, data: str | None = None, filename: str | None = None) Wallet#

Decrypt a wallet, witch is stored as a string

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> Wallet.decrypt("password", filename="wallet.hd")
Parameters:
  • passphrase (str) – (required) the passphrase / key to decrypt the data

  • data (str) – (optional) encrypted data

  • filename (str) – (optional) filename, where the encrypted data is stored

Returns:

Wallet

from_entropy(entropy: str, language: str = 'english', passphrase: str | None = None) Wallet#

Master from Entropy hex string.

Parameters:
  • entropy (str) – Entropy hex string.

  • language (str) – Mnemonic language, default to english.

  • passphrase (str) – Mnemonic passphrase or password, default to None.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a", language="english", passphrase=None)
<defichain.hdwallet.wallet.Wallet object at 0x7f6c94b7be50>
from_mnemonic(mnemonic: str, language: str | None = None, passphrase: str | None = None) Wallet#

Master from Mnemonic words.

Parameters:
  • mnemonic (str) – Mnemonic words.

  • language (str) – Mnemonic language, default to None.

  • passphrase (str) – Mnemonic passphrase or password, default to None.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="sceptre capter séquence girafe absolu relatif fleur zoologie muscle sirop saboter parure", passphrase=None)
<defichain.hdwallet.wallet.Wallet object at 0x7f2f5698de50>
from_seed(seed: str) Wallet#

Master from Seed hex string.

Parameters:

seed (str) – Seed hex string.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_seed(seed="8d5f4fe5b81a6a6a18b08603b6b3f59df9f4bbb25d10c55d23e0cbdc5ee385e5fddad9d7e6114f11afdec45928328081f9a598151a7613dc5f5a0c16a4612aa4")
<defichain.hdwallet.wallet.Wallet object at 0x7f61d053fe50>
from_xprivate_key(xprivate_key: str) Wallet#

Master from XPrivate Key.

Parameters:

xprivate_key (str) – Root or Non-Root XPrivate key.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_xprivate_key(xprivate_key="xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF")
<defichain.hdwallet.wallet.Wallet object at 0x7f9c26fe6e50>
from_xpublic_key(xpublic_key: str) Wallet#

Master from XPublic Key.

Parameters:

xpublic_key (str) – Root or Non-Root XPublic key.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_xpublic_key(xpublic_key="xpub661MyMwAqRbcGSTjb2Mp3Sb4STUDhD2x986ubXKjQa2QsFTCVqzdA98qeZjcncHT1AaZcMSjiP1HJ16jH97q72RwyFfiNhmG8zQ6KBB5PaQ")
<defichain.hdwallet.wallet.Wallet object at 0x7fbd211bce50>
from_wif(wif: str) Wallet#

Master from Wallet Important Format (WIF).

Parameters:

wif (str) – Wallet important format.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_wif(wif="KzsHWUJsrTWUUhBGPfMMxLLydiH7NhEn6z7mKHXD5qNkUWaC4TEn")
<defichain.hdwallet.wallet.Wallet object at 0x7f6fd2509e50>
from_private_key(private_key: str) Wallet#

Master from Private Key.

Parameters:

private_key (str) – Private key.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_private_key(private_key="6cd78b0d69eab1a47bfa53a52b9d8c4331e858b5d7a599270a95d9735fdb0b94")
<defichain.hdwallet.wallet.Wallet object at 0x7ff405eebe50>
from_public_key(public_key: str) Wallet#

Master from Public Key.

Parameters:

public_key (str) – Public key.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_public_key(public_key="02f93f58b97c3bb616645c3dda256ec946d87c45baf531984c022dd0fd1503b0a8")
<defichain.hdwallet.wallet.Wallet object at 0x7fb8c47ece50>
from_path(path: str | Derivation) Wallet#

Derivation from Path.

Default path for defichain is: m/1129/0/0/0

You can calculate the next addresses by increasing the last index by 1:

First Address in Wallet: m/1129/0/0/0

Second Address in Wallet: m/1129/0/0/1

Third Address in Wallet: m/1129/0/0/2

Note

Do not forget all derivation paths are start swith ‘m/’ prefix.

Parameters:

path (str, Derivation) – Derivation path.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_xprivate_key(xprivate_key="xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF")
>>> wallet.from_path(path="m/1129/0/0/0")
<defichain.hdwallet.wallet.Wallet object at 0x7ff968489e50>
from_index(index: int, hardened: bool = False) Wallet#

Derivation from Index.

Parameters:
  • index (int) – Derivation index.

  • hardened (bool) – Hardened address, default to False.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_xprivate_key(xprivate_key="xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF")
>>> wallet.from_index(index=1129)
>>> wallet.from_index(index=0)
>>> wallet.from_index(index=0)
>>> wallet.from_index(index=0)
<defichain.hdwallet.wallet.Wallet object at 0x7feb0fbe9e50>
root_xprivate_key(encoded: bool = True) str | None#

Get Root XPrivate Key.

Parameters:

encoded (bool) – Encoded root xprivate key, default to True.

Returns:

str – Root XPrivate Key.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.root_xprivate_key()
"xprv9s21ZrQH143K3wyDj3RFDZ2NyueHmj42SkAhqN62guhz5hr5N2qzPKzLnzrRsYdi4DwoeBeqKyjizqdiSNr3yAn2yMMMwWoJQp2PsC4BPLp"
root_xpublic_key(encoded: bool = True) str | None#

Get Root XPublic Key.

Parameters:

encoded (bool) – Encoded root xpublic key, default to True.

Returns:

str – Root XPublic Key.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.root_xpublic_key()
"xpub661MyMwAqRbcGS3gq4xFagy7XwUnBBmsoy6JdkVeFFExxWBDuaAEw8JpeFVhYKJctV1ZXFdV6SPoN41MVkNMdTcZpxcqJoRWgJvede7ME9n"
clean_derivation() Wallet#

Clean derivation Path or Indexes.

Returns:

Wallet – Hierarchical Deterministic Wallet instance.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_xprivate_key(xprivate_key="xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.path()
"m/1129/0/0/0"
>>> wallet.clean_derivation()
>>> wallet.path()
None
uncompressed(compressed: str | None = None) str#

Get Uncommpresed Public Key.

Parameters:

compressed (str) – Compressed public key, default to None.

Returns:

str – Uncommpresed public key.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.uncompressed()
"5af8506eb2b42f63842402cf4a462c0c4200797ab707acc5c215aee8a276a2c1b52749070d113497b118fa5aa1f5f1260475e1b6b766c4e0b84108c5322f1a7a"
compressed(uncompressed: str | None = None) str#

Get Compresed Public Key.

Parameters:

uncompressed (str) – Uncompressed public key, default to None.

Returns:

str – Commpresed public key.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.compressed()
"025af8506eb2b42f63842402cf4a462c0c4200797ab707acc5c215aee8a276a2c1"
private_key() str#

Get Private Key.

Returns:

str – Private key.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.private_key()
"56605e027fdb039e86fabdf3057b117fcd2c82ceaaa997a4a47afdf03ce9b155"
public_key(compressed: bool = True, private_key: str | None = None) str#

Get Public Key.

Parameters:
  • compressed (bool) – Compressed public key, default to True.

  • private_key (str) – Private key hex string, default to None.

Returns:

str – Public key.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.public_key()
"025af8506eb2b42f63842402cf4a462c0c4200797ab707acc5c215aee8a276a2c1"
strength() int | None#

Get Entropy strength.

Returns:

int – Entropy strength.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.strength()
160
entropy() str | None#

Get Entropy hex string.

Returns:

str – Entropy hex string.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.entropy()
"f24afe7fc1418815ee7fd256beb55518e7c34ecd"
mnemonic() str | None#

Get Mnemonic words.

Returns:

str – Mnemonic words.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash")
>>> wallet.mnemonic()
"venture fitness paper little blush april rigid where find volcano fetch crack label polar dash"
passphrase() str | None#

Get Mnemonic passphrase.

Returns:

str – Mnemonic passphrase.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.passphrase()
"password"
language() str | None#

Get Mnemonic language.

Returns:

str – Mnemonic language.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.language()
"english"
cryptocurrency() str | None#

Get Network name.

Returns:

str – Network name.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.cryptocurrency()
"Defichain"
symbol() str | None#

Get Network symbol.

Returns:

str – Network symbol.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.symbol()
"DFI"
semantic() str | None#

Get Extended semantic.

Returns:

str – Extended semantic.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.semantic()
"p2pkh"
network() str | None#

Get Network network type.

Returns:

str – Network network type.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.network()
"mainnet"
seed() str | None#

Get Seed hex string.

Returns:

str – Seed hex string.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.seed()
"06ea9f5dd74699c50626ea80c6cf29ebc0d7d7536a489924928d9a1bba0a01ff37339d82f80f863fc0a326d86b7258a2ebd9e05b76e94a9afc87a260e30cf02b"
path() str | None#

Get Derivation path.

Returns:

str – Drivation path.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.path()
"m/1129/0/0/0"
chain_code() str | None#

Get Chain code.

Returns:

str – Chain code.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.chain_code()
"6a6fe745530a2a5a2834293fb7aeda2f8d9253cd3241a28139da74acdff25ee2"
hash(private_key: str | None = None)#

Get Public Key Hash.

Returns:

str – Identifier.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.hash()
"ead6524e1ee52c7750e5cb2fe3dc3ab30a49b0c3"
finger_print() str#

Get Finger print.

Returns:

str – Finger print.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.finger_print()
"ead6524e"
default_address() str#

Get P2WPKH nested in P2SH address.

Returns:

str – P2WPKH nested in P2SH address.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.default_address()
"dKYzYQDmN9TFEdZy46mFtStbqYLnougqzY"
legacy_address() str#

Get Pay to Public Key Hash (P2PKH) address.

Returns:

str – P2PKH address.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.legacy_address()
"8cVZbAQGU11dYPoSPHYYjakHCFQ3NSiyS6"
bech32_address() str#

Get Pay to Witness Public Key Hash (P2WPKH) address.

Returns:

str – P2WPKH address.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.bech32_address()
"df1qatt9yns7u5k8w589evh78hp6kv9ynvxr2xlvpn"
p2pkh_address() str#

Get Pay to Public Key Hash (P2PKH) address.

Returns:

str – P2PKH address.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.p2pkh_address()
"8cVZbAQGU11dYPoSPHYYjakHCFQ3NSiyS6"
p2wpkh_address() str | None#

Get Pay to Witness Public Key Hash (P2WPKH) address.

Returns:

str – P2WPKH address.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.p2wpkh_address()
"df1qatt9yns7u5k8w589evh78hp6kv9ynvxr2xlvpn"
p2sh_address() str | None#

Get P2WPKH nested in P2SH address.

Returns:

str – P2WPKH nested in P2SH address.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.p2sh_address()
"dKYzYQDmN9TFEdZy46mFtStbqYLnougqzY"
wif() str | None#

Get Wallet Important Format.

Returns:

str – Wallet Important Format.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.wif()
"KxGKLeymbFrSY7t3X31FMaDgQDUQGYvhUACLe4o1LXokvWtMs1WU"
get_account(index: int = 0, prefix: str = 'm/1129/0/0/')#

Returns the account of the specified prefix and index

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.get_account(0)
Parameters:
  • index (int) – (optional) number of account

  • prefix (str) – (optional) prefix from which the account is to be derived

Returns:

Account

encrypt(passphrase: str, filename: str | None = None) str#

Encrypts the wallet into a string

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.encrypt("password")
Parameters:
  • passphrase (str) – (required) the passphrase / key to encrypt the data

  • filename (str) – (required) filename, where the encrypted data should be stored

Returns:

str – encrypted string

dumps() dict#

Get All Wallet imformations.

Returns:

dict – All Wallet imformations.

>>> from defichain import Wallet
>>> from defichain.networks import DefichainMainnet
>>> wallet = Wallet(network=DefichainMainnet)
>>> wallet.from_mnemonic(mnemonic="venture fitness paper little blush april rigid where find volcano fetch crack label polar dash", passphrase="password")
>>> wallet.from_path(path="m/1129/0/0/0")
>>> wallet.dumps()
{'cryptocurrency': 'Defichain', 'symbol': 'DFI', 'network': 'mainnet', 'strength': 160, 'entropy': 'f24afe7fc1418815ee7fd256beb55518e7c34ecd', 'mnemonic': 'venture fitness paper little blush april rigid where find volcano fetch crack label polar dash', 'language': 'english', 'passphrase': 'password', 'seed': '06ea9f5dd74699c50626ea80c6cf29ebc0d7d7536a489924928d9a1bba0a01ff37339d82f80f863fc0a326d86b7258a2ebd9e05b76e94a9afc87a260e30cf02b', 'root_xprivate_key': 'xprv9s21ZrQH143K3eriRHBmTz27FBxHSsjdPJy3c7G7RxLV7JKgYEwZo8iNW7tCnC1p7754tnpgW3WBwNSy5kEU2uQLywxpKfxZSbsDJWXriKf', 'root_xpublic_key': 'xpub661MyMwAqRbcG8wBXJimq7xqoDnmrLTUkXteQVfizHsTz6eq5nFpLw2rMQ96dg7MHGTWD3U6UUFMY2XiJtQh7rWKNg7x1nb8QHyu4CFQ3GR', 'xprivate_key': 'xprv9zihFAyvszfdonyejxCCch1JTGVrfqd3VLxKrmSdAht1XmYzVw8YCH4965HYfEXNnnZAHVnga2JFBSpLYhNrmrYEgVpmN33gHXEzy5CJ5Ff', 'xpublic_key': 'xpub6Di3egWpiNDw2H47qyjCypx31JLM5JLtrZsvf9rEj3QzQZt93USnk5NcwMqHKNs6s1VGqLzZ7gJNRpa55gSgyycC27wLorzFHasi8A8Fg4S', 'uncompressed': 'e6ec494e1eb0b254e0d0a8fe783ec89d0ba33a4ddf33bf9f521912c34dd84115eeb3b6a4c7fb78fbdc81ad05ff216f0e8445bcfa46b9a3975f3aa65b00bf8202', 'compressed': '02e6ec494e1eb0b254e0d0a8fe783ec89d0ba33a4ddf33bf9f521912c34dd84115', 'chain_code': '6a6fe745530a2a5a2834293fb7aeda2f8d9253cd3241a28139da74acdff25ee2', 'private_key': '1f2d96f945df65d442c86b08fd4355cd7d1894beab060f47437f7d2721080900', 'public_key': '02e6ec494e1eb0b254e0d0a8fe783ec89d0ba33a4ddf33bf9f521912c34dd84115', 'wif': 'KxGKLeymbFrSY7t3X31FMaDgQDUQGYvhUACLe4o1LXokvWtMs1WU', 'finger_print': 'ead6524e', 'semantic': 'p2pkh', 'path': 'm/1129/0/0/0', 'hash': 'ead6524e1ee52c7750e5cb2fe3dc3ab30a49b0c3', 'addresses': {'legacy': '8cVZbAQGU11dYPoSPHYYjakHCFQ3NSiyS6', 'bech32': 'df1qatt9yns7u5k8w589evh78hp6kv9ynvxr2xlvpn', 'default': 'dKYzYQDmN9TFEdZy46mFtStbqYLnougqzY'}}