Wallet#

class defichain.node.Wallet(node)#
abandontransaction(txid: str) None#

Mark in-wallet transaction as abandoned

This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace “stuck” or evicted transactions.

It only works on transactions which are not included in a block and are not currently in the mempool.

It has no effect on transactions which are already abandoned.

Parameters:

txid (str) – (required) The transaction id

Returns:

None

Example:
>>> node.wallet.abandontransaction("1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d")
abortrescan() None#

Stops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.

Note: Use “getwalletinfo” to query the scanning progress.

Returns:

None

Example:
>>> node.wallet.abortrescan()
addmultisigaddress(nrequired: int, keys: [], label: str = '', address_type: str | None = None) {}#

Add a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.

Each key is a Defi address or hex-encoded public key.

This functionality is only intended for use with non-watchonly addresses.

See importaddress for watchonly p2sh address support.

If ‘label’ is specified, assign address to that label.

Parameters:
  • nrequired (int) – (required) The number of required signatures out of the n keys or addresses

  • keys (array) – (required) A json array of defi addresses or hex-encoded public keys

  • label (str) – (optional) A label to assign the addresses to

  • address_type (str) – (optional) The address type to use. Options are “legacy”, “p2sh-segwit”, and “bech32”

Returns:

{…} (json) – returns the multisigaddress and redeemScript

{
    "address":"multisigaddress",    (string) The value of the new multisig address.
    "redeemScript":"script"         (string) The string value of the hex-encoded redemption script.
}

Example:
>>> node.wallet.addmultisigaddress(2, ["16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5", "171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV"])
addressmap(input: str, type: int)#

Give the equivalent of an address from EVM to DVM and versa

Map Types:

1 - Address format: DFI -> ERC55

2 - Address format: ERC55 -> DFI

Parameters:
  • input (str) – (required) DVM address or EVM address

  • type (int) – (required) Map types

Returns:

json - returns corresponding DVM or EVM address

Example:
>>> node.wallet.addressmap("df1quwxpegclg5pjdxnnept0mdzujc33ufey0tje7c", 1)
backupwallet(destination: str) None#

Safely copies current wallet file to destination, which can be a directory or a path with filename

Parameters:

destination (str) – (required) The destination directory or file

Returns:

None

Example:
>>> node.wallet.backupwallet("backup.dat")
bumpfee(txid: str, confTarget: int | None = None, totalFee: int | None = None, replaceable: bool = True, estimate_mode: str = 'UNSET') {}#

Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.

An opt-in RBF transaction with the given txid must be in the wallet.

The command will pay the additional fee by reducing change outputs or adding inputs when necessary. It may add a new change output if one does not already exist.

If totalFee (DEPRECATED) is given, adding inputs is not supported, so there must be a single change output that is big enough or it will fail.

All inputs in the original transaction will be included in the replacement transaction.

The command will fail if the wallet or mempool contains a transaction that spends one of T’s outputs.

By default, the new fee will be calculated automatically using estimatesmartfee.

The user can specify a confirmation target for estimatesmartfee.

Alternatively, the user can specify totalFee (DEPRECATED), or use RPC settxfee to set a higher fee rate.

At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee returned by getnetworkinfo) to enter the node’s mempool.

Parameters:
  • txid (str) – (required) The txid to be bumped

  • confTarget (int) – (optional) Confirmation target (in blocks)

  • totalFee (int) – (optional) Total fee (NOT feerate) to pay, in satoshis. (DEPRECATED) In rare cases, the actual fee paid might be slightly higher than the specified totalFee if the tx change output has to be removed because it is too close to the dust threshold.

  • replaceable (bool) – (optional) Whether the new transaction should still be marked bip-125 replaceable. If true, the sequence numbers in the transaction will be left unchanged from the original. If false, any input sequence numbers in the original transaction that were less than 0xfffffffe will be increased to 0xfffffffe so the new transaction will not be explicitly bip-125 replaceable (though it may still be replaceable in practice, for example if it has unconfirmed ancestors which are replaceable).

  • estimate_mode (str) – (optional) The fee estimate mode, must be one of: “UNSET”, “ECONOMICAL”, “CONSERVATIVE”

Returns:

{…} (json) – returns txid and information about the bumped fee

{
    "txid":    "value",     (string)  The id of the new transaction
    "origfee":  n,          (numeric) Fee of the replaced transaction
    "fee":      n,          (numeric) Fee of the new transaction
    "errors":  [ str... ]   (json array of strings) Errors encountered during processing (may be empty)
}

Example:
>>> node.wallet.bumpfee("e6ade425016b5c7025bc8a31b41e476f092eaeaeed6b69ac28d7ce988a499d18")
createwallet(wallet_name: str, disable_private_keys: bool = False, blank: bool = False, passphrase: str = '', avoid_reuse: bool = False) {}#

Creates and loads a new wallet.

Parameters:
  • wallet_name (str) – (required) The name for the new wallet. If this is a path, the wallet will be created at the path location

  • disable_private_keys (bool) – (optional) Disable the possibility of private keys

  • blank (bool) – (optional) Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed.

  • passphrase (str) – (optional) Encrypt the wallet with this passphrase

  • avoid_reuse (bool) – (optional) Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind

Returns:

{…} (json) – returns information about the created wallet

{
    "name" :    <wallet_name>,        (string) The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path.
    "warning" : <warning>,            (string) Warning message if wallet was not loaded cleanly.
}

Example:
>>> node.wallet.createwallet("new_wallet")
dumpprivkey(address: str) str#

Reveals the private key corresponding to ‘address’. Then the importprivkey can be used with this output

Parameters:

address (str) – (required) The DFI address for the private key

Returns:

“key” (string) – the private key

Example:
>>> node.wallet.dumpprivkey("myaddress")
dumpwallet(filename: str) {}#

Dumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.

Imported scripts are included in the dumpfile, but corresponding BIP173 addresses, etc. may not be added automatically by importwallet.

Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).

Parameters:

filename (str) – (required) The filename with path (either absolute or relative to defid)

Returns:

{…} (json) – returns filename

{
    "filename": (string) The filename with full absolute path
}

Example:
>>> node.wallet.dumpwallet("test")
encryptwallet(passphrase: str) None#

Encrypts the wallet with ‘passphrase’. This is for first time encryption.

After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls.

Use the walletpassphrase call for this, and then walletlock call.

If the wallet is already encrypted, use the walletpassphrasechange call.

Parameters:

passphrase (str) – (required) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.

Returns:

None

Example:
>>> node.wallet.encryptwallet("passphrase")
getaddressesbylabel(label: str) {}#

Returns the list of addresses assigned the specified label.

Parameters:

label (str) – (required) the label

Returns:

{…} (json) – returns addresses with a given label

{ (json object with addresses as keys)
    "address": { (json object with information about address)
        "purpose": "string" (string)  Purpose of address ("send" for sending address, "receive" for receiving address)
    },...
}

Example:
>>> node.wallet.getaddressesbylabel("label")
getaddressinfo(address: str) {}#

Return information about the given defi address. Some information requires the address to be in the wallet.

Parameters:

address (str) – (required) The defi address to get the information of

Returns:

{…} (json) – return information about the given defi address

{
    "address" : "address",        (string) The defi address validated
    "scriptPubKey" : "hex",       (string) The hex-encoded scriptPubKey generated by the address
    "ismine" : true|false,        (boolean) If the address is yours or not
    "iswatchonly" : true|false,   (boolean) If the address is watchonly
    "solvable" : true|false,      (boolean) Whether we know how to spend coins sent to this address, ignoring the possible lack of private keys
    "desc" : "desc",            (string, optional) A descriptor for spending coins sent to this address (only when solvable)
    "isscript" : true|false,      (boolean) If the key is a script
    "ischange" : true|false,      (boolean) If the address was used for change output
    "iswitness" : true|false,     (boolean) If the address is a witness address
    "witness_version" : version   (numeric, optional) The version number of the witness program
    "witness_program" : "hex"     (string, optional) The hex value of the witness program
    "script" : "type"             (string, optional) The output script type. Only if "isscript" is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, witness_v0_scripthash, witness_unknown
    "hex" : "hex",                (string, optional) The redeemscript for the p2sh address
    "pubkeys"                     (string, optional) Array of pubkeys associated with the known redeemscript (only if "script" is "multisig")
    [
        "pubkey"
        ,...
    ]
    "sigsrequired" : xxxxx        (numeric, optional) Number of signatures required to spend multisig output (only if "script" is "multisig")
    "pubkey" : "publickeyhex",    (string, optional) The hex value of the raw public key, for single-key addresses (possibly embedded in P2SH or P2WSH)
    "embedded" : {...},           (object, optional) Information about the address embedded in P2SH or P2WSH, if relevant and known. It includes all getaddressinfo output fields for the embedded address, excluding metadata ("timestamp", "hdkeypath", "hdseedid") and relation to the wallet ("ismine", "iswatchonly").
    "iscompressed" : true|false,  (boolean, optional) If the pubkey is compressed
    "label" :  "label"         (string) The label associated with the address, "" is the default label
    "timestamp" : timestamp,      (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)
    "hdkeypath" : "keypath"       (string, optional) The HD keypath if the key is HD and available
    "hdseedid" : "<hash160>"      (string, optional) The Hash160 of the HD seed
    "hdmasterfingerprint" : "<hash160>" (string, optional) The fingperint of the master key.
    "labels"                      (object) Array of labels associated with the address.
    [
        { (json object of label data)
            "name": "labelname" (string) The label
            "purpose": "string" (string) Purpose of address ("send" for sending address, "receive" for receiving address)
        },...
    ]
}

Example:
>>> node.wallet.getaddressinfo("1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc")
getbalance(dummy: str = '*', minconf: int = 0, include_watchonly: bool = True, avoid_reuse: bool | None = None, with_tokens: bool = False) {}#

Returns the total available balance.

The available balance is what the wallet considers currently spendable, and is thus affected by options which limit spendability such as -spendzeroconfchange.

Parameters:
  • dummy (str) – (optional) Remains for backward compatibility. Must be excluded or set to “*”

  • minconf (int) – (optional) Only include transactions confirmed at least this many times

  • include_watchonly (bool) – (optional) Also include balance in watch-only addresses (see ‘importaddress’)

  • avoid_reuse (bool) – (optional) Do not include balance in dirty outputs; addresses are considered dirty if they have previously been used in a transaction

  • with_tokens (bool) – (optional) Include tokens balances; Default is ‘false’ for backward compatibility

Returns:

{…} (json) – amount (int) if with_tokens == false | {tokenId: amount,…} (json) if with_tokens == true

{
    "mine": {                          (object) balances from outputs that the wallet can sign
        "trusted": xxx                 (numeric) trusted balance (outputs created by the wallet or confirmed outputs)
        "untrusted_pending": xxx       (numeric) untrusted pending balance (outputs created by others that are in the mempool)
        "immature": xxx                (numeric) balance from immature coinbase outputs
        "used": xxx                    (numeric) (only present if avoid_reuse is set) balance from coins sent to addresses that were previously spent from (potentially privacy violating)
    },
    "watchonly": {                     (object) watchonly balances (not present if wallet does not watch anything)
        "trusted": xxx                 (numeric) trusted balance (outputs created by the wallet or confirmed outputs)
        "untrusted_pending": xxx       (numeric) untrusted pending balance (outputs created by others that are in the mempool)
        "immature": xxx                (numeric) balance from immature coinbase outputs
    },
}

Example:
>>> node.wallet.getbalance("*")
getbalances(with_tokens: bool | None = None) {}#

Returns an object with all balances in DFI.

Parameters:

with_tokens (bool) – (optional) Include tokens balances; Default is ‘false’ for backward compatibility

Returns:

{…} (json) – returns object with all balances in DFI

Example:
>>> node.wallet.getbalances()
getnewaddress(label: str = '', address_type: str | None = None) str#

Returns a new Defi address for receiving payments.

If ‘label’ is specified, it is added to the address book so payments received with the address will be associated with ‘label’.

Parameters:
  • label (str) – (optional) The label name for the address to be linked to. It can also be set to the empty string “” to represent the default label. The label does not need to exist, it will be created if there is no label by the given name

  • address_type (str) – (optional) The address type to use. Options are “legacy”, “p2sh-segwit”, and “bech32”.

Returns:

“address” (string) – The new defi address

Example:
>>> node.wallet.getnewaddress()
getrawchangeaddress(address_type: str | None = None) str#

Returns a new Defi address, for receiving change.

This is for use with raw transactions, NOT normal use.

Parameters:

address_type (str) – (optional) The address type to use. Options are “legacy”, “p2sh-segwit”, and “bech32”.

Returns:

“address” (string) – The address

Example:
>>> node.wallet.getrawchangeaddress()
getreceivedbyaddress(address: str, minconf: int = 1) float#

Returns the total amount received by the given address in transactions with at least minconf confirmations.

Parameters:
  • address (str) – (required) The defi address for transactions

  • minconf (int) – (optional) Only include transactions confirmed at least this many times

Returns:

amount (float) – returns the total amount in DFI received at this address

Example:
>>> node.wallet.getreceivedbyaddress("1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX")
getreceivedbylabel(label: str, minconf: int = 1) float#

Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.

Parameters:
  • label (str) – (required) The selected label, may be the default label using “”

  • minconf (int) – (optional) Only include transactions confirmed at least this many times

Returns:

amount (float) – returns the total amount in DFI received at this label

Example:
>>> node.wallet.getreceivedbylabel("")
gettransaction(txid: str, include_watchonly: bool = True) {}#

Get detailed information about in-wallet transaction

Parameters:
  • txid (str) – (required) The transaction id

  • include_watchonly (bool) – (optional) Whether to include watch-only addresses in balance calculation and details[]

Returns:

{…} (json) – returns information about transaction

{
    "amount" : x.xxx,                           (numeric) The transaction amount in DFI
    "fee": x.xxx,                               (numeric) The amount of the fee in DFI. This is negative and only available for the
                                                'send' category of transactions.
"confirmations" : n,                            (numeric) The number of confirmations
    "blockhash" : "hash",                       (string) The block hash
    "blockindex" : xx,                          (numeric) The index of the transaction in the block that includes it
    "blocktime" : ttt,                          (numeric) The time in seconds since epoch (1 Jan 1970 GMT)
    "txid" : "transactionid",                   (string) The transaction id.
"time" : ttt,                                   (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)
    "timereceived" : ttt,                       (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)
    "bip125-replaceable": "yes|no|unknown",     (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
                                                may be unknown for unconfirmed transactions not in the mempool
    "details" : [
        {
        "address" : "address",                  (string) The defi address involved in the transaction
        "category" :                            (string) The transaction category.
            "send"                              Transactions sent.
            "receive"                           Non-coinbase transactions received.
            "generate"                          Coinbase transactions received with more than 100 confirmations.
            "immature"                          Coinbase transactions received with 100 or fewer confirmations.
            "orphan"                            Orphaned coinbase transactions received.
        "amount" : x.xxx,                       (numeric) The amount in DFI
        "label" : "label",                      (string) A comment for the address/transaction, if any
        "vout" : n,                             (numeric) the vout value
        "fee": x.xxx,                           (numeric) The amount of the fee in DFI. This is negative and only available for the
        'send' category of transactions.
        "abandoned": xxx                        (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
        'send' category of transactions.
        }
        ,...
    ],
    "hex" : "data"                              (string) Raw data for transaction
}

Example:
>>> node.wallet.gettransaction("1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d")
getunconfirmedbalance(with_tokens: bool = False) float#

DEPRECATED Identical to getbalances().mine.untrusted_pending

Parameters:

with_tokens (bool) – (optional)

Returns:

amount (float) – returns the unconfirmed amount of UTXO or token

Example:
>>> node.wallet.getunconfirmedbalance()
getwalletinfo(with_tokens: bool = False) {}#

Returns an object containing various wallet state info.

Parameters:

with_tokens (bool) – (optional) Include tokens balances; Default is ‘false’ for backward compatibility

Returns:

{…} (json) – returns information about the wallet state

{
    "walletname": xxxxx,               (string) the wallet name
    "walletversion": xxxxx,            (numeric) the wallet version
    "balance": xxxxxxx,                (numeric) DEPRECATED. Identical to getbalances().mine.trusted
    "unconfirmed_balance": xxx,        (numeric) DEPRECATED. Identical to getbalances().mine.untrusted_pending
    "immature_balance": xxxxxx,        (numeric) DEPRECATED. Identical to getbalances().mine.immature
    "txcount": xxxxxxx,                (numeric) the total number of transactions in the wallet
    "keypoololdest": xxxxxx,           (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool
    "keypoolsize": xxxx,               (numeric) how many new keys are pre-generated (only counts external keys)
    "keypoolsize_hd_internal": xxxx,   (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)
    "unlocked_until": ttt,             (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked
    "paytxfee": x.xxxx,                (numeric) the transaction fee configuration, set in DFI/kB
    "hdseedid": "<hash160>"            (string, optional) the Hash160 of the HD seed (only present when HD is enabled)
    "private_keys_enabled": true|false (boolean) false if privatekeys are disabled for this wallet (enforced watch-only wallet)
    "avoid_reuse": true|false          (boolean) whether this wallet tracks clean/dirty coins in terms of reuse
    "scanning":                        (json object) current scanning details, or false if no scan is in progress
    {
        "duration" : xxxx              (numeric) elapsed seconds since scan start
        "progress" : x.xxxx,           (numeric) scanning progress percentage [0.0, 1.0]
    }
}

Example:
>>> node.wallet.getwalletinfo()
importaddress(address: str, label: str = '', rescan: bool = True, p2sh: bool = False) None#

Adds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.

If you have the full public key, you should call importpubkey instead of this.

Hint: use importmulti to import more than one address.

Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated as change, and not show up in many RPCs.

Note: Use “getwalletinfo” to query the scanning progress.

Parameters:
  • address (str) – (required) The DFI address

  • label (str) – (optional) An optional label

  • rescan (bool) – (optional) Rescan the wallet for transactions

  • p2sh (bool) – (optional) Add the P2SH version of the script as well

Returns:

None

Example:
>>> node.wallet.importaddress("address")
importmulti(requests: {}, rescan: bool = True) [{}]#

Import addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.

If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The ‘watchonly’ option must be set to true in this case or a warning will be returned.

Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls may report that the imported keys, addresses or scripts exist but related transactions are still missing.

Note: Use “getwalletinfo” to query the scanning progress.

Parameters:
  • requests (json array) –

    (required) Data to be imported

    [
        {                                                           (json object)
            "desc": "str",                                              (string) Descriptor to import. If using descriptor, do not also provide address/scriptPubKey, scripts, or pubkeys
            "scriptPubKey": "<script>" | { "address":"<address>" },     (string / json, required) Type of scriptPubKey (string for script, json for address). Should not be provided if using a descriptor
            "timestamp": timestamp | "now",                             (integer / string, required) Creation time of the key in seconds since epoch (Jan 1 1970 GMT),
                                                                        or the string "now" to substitute the current synced blockchain time. The timestamp of the oldest
                                                                        key will determine how far back blockchain rescans need to begin for missing wallet transactions.
                                                                        "now" can be specified to bypass scanning, for keys which are known to never have been used, and
                                                                        0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest key
                                                                        creation time of all keys being imported by the importmulti call will be scanned.
            "redeemscript": "str",                                      (string) Allowed only if the scriptPubKey is a P2SH or P2SH-P2WSH address/scriptPubKey
            "witnessscript": "str",                                     (string) Allowed only if the scriptPubKey is a P2SH-P2WSH or P2WSH address/scriptPubKey
            "pubkeys": [                                                (json array, optional, default=empty array) Array of strings giving pubkeys to import. They must occur in P2PKH or P2WPKH scripts. They are not required when the private key is also provided (see the "keys" argument).
                "pubKey",                                               (string)
                ...
            ],
            "keys": [                                                   (json array, optional, default=empty array) Array of strings giving private keys to import. The corresponding public keys must occur in the output or redeemscript.
                "key",                                                  (string)
                ...
            ],
            "range": n or [n,n],                                       (numeric or array) If a ranged descriptor is used, this specifies the end or the range (in the form [begin,end]) to import
            "internal": bool,                                          (boolean, optional, default=false) Stating whether matching outputs should be treated as not incoming payments (also known as change)
            "watchonly": bool,                                         (boolean, optional, default=false) Stating whether matching outputs should be considered watchonly.
            "label": "str",                                            (string, optional, default='') Label to assign to the address, only allowed with internal=false
            "keypool": bool,                                           (boolean, optional, default=false) Stating whether imported public keys should be added to the keypool for when users request new addresses. Only allowed when wallet private keys are disabled
        },
        ...
    ]
    

  • rescan (bool) – (optional) Stating if should rescan the blockchain after all imports

Returns:

[{…}] (json array) – Response is an array with the same size as the input that has the execution result

[{"success": true}, {"success": true, "warnings": ["Ignoring irrelevant private key"]},
{"success": false, "error": {"code": -1, "message": "Internal Server Error"}}, ...]

Example:
>>> node.wallet.importmulti([{ "scriptPubKey": { "address": "<my address>" }, "timestamp":1455191478 }, { "scriptPubKey": { "address": "<my 2nd address>" }, "label": "example 2", "timestamp": 1455191480 }])
importprivkey(privkey: str, label: str = '', rescan: bool = True) None#
Parameters:
  • privkey (str) – (required) The private key (see dumpprivkey)

  • label (str) – (optional) An optional label

  • rescan (bool) – (optional) Rescan the wallet for transactions

Returns:

None

Example:
>>> node.wallet.importprivkey("mykey")
importprunedfunds(rawtransaction: str, txoutproof: str) None#

Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.

Parameters:
  • rawtransaction (str) – (required) A raw transaction in hex funding an already-existing address in wallet

  • txoutproof (str) – (required) The hex output from gettxoutproof that contains the transaction

Returns:

None

Example:
>>> node.wallet.importprunedfunds("rawtransaction", "txoutproof")
importpubkey(pubkey: str, label: str = '', rescan: bool = True) None#

Adds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.

Hint: use importmulti to import more than one public key.

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.

Note: Use “getwalletinfo” to query the scanning progress.

Parameters:
  • pubkey (str) – (required) The hex-encoded public key

  • label (str) – (optional) An optional label

  • rescan (bool) – (optional) Rescan the wallet for transactions

Returns:

None

Example:
>>> node.wallet.importpubkey("mypubkey")
importwallet(filename: str) None#

Imports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.

Note: Use “getwalletinfo” to query the scanning progress.

Parameters:

filename (str) – (required) the wallet file

Returns:

None

Example:
>>> node.wallet.importwallet("new_wallet")
keypoolrefill(newsize: int = 100) None#

Fills the keypool.

Requires wallet passphrase to be set with walletpassphrase call.

Parameters:

newsize (int) – (optional) The new keypool size

Returns:

None

Example:
>>> node.wallet.keypoolrefill()
listaddressgroupings() [{}]#

Lists groups of addresses which have had their common ownership made public by common use as inputs or as the resulting change in past transactions

Returns:

[{…}] (json array) – returns a list of used addresses in a wallet

[
    [
        [
            "address",            (string) The defi address
            amount,                 (numeric) The amount in DFI
            "label"               (string, optional) The label
        ]
        ,...
    ]
    ,...
]

Example:
>>> node.wallet.listaddressgroupings()
listlabels(purpose: str | None = None) []#

Returns the list of all labels, or labels that are assigned to addresses with a specific purpose.

Parameters:

purpose (str) – (optional) Address purpose to list labels for (‘send’,’receive’). An empty string is the same as not providing this argument.

Returns:

[…] (array) – returns a list of labels

[                   (json array of string)
    "label",        (string) Label name
    ...
]

Example:
>>> node.wallet.listlabels()
listlockunspent() [{}]#

Returns list of temporarily unspendable outputs.

See the lockunspent call to lock and unlock transactions for spending.

Returns:

[{…}] (json array) – returns list of temporarily unspendable outputs

[
    {
        "txid" : "transactionid",       (string) The transaction id locked
        "vout" : n                      (numeric) The vout value
    }
    ,...
]

Example:
>>> node.wallet.listlockunspent()
listreceivedbyaddress(minconf: int = 1, include_empty: bool = False, include_watchonly: bool = True, address_filter: str | None = None) [{}]#

List balances by receiving address

Parameters:
  • minconf (int) – (optional) The minimum number of confirmations before payments are included

  • include_empty (bool) – (optional) Whether to include addresses that haven’t received any payments

  • include_watchonly (bool) – (optional) Whether to include watch-only addresses (see ‘importaddress’)

  • address_filter (str) – (optional) If present, only return information on this address

Returns:

[{…}] (json array) – returns balances of receiving addresses

[
    {
        "involvesWatchonly" : true,         (bool) Only returned if imported addresses were involved in transaction
        "address" : "receivingaddress",     (string) The receiving address
        "amount" : x.xxx,                   (numeric) The total amount in DFI received by the address
        "confirmations" : n,                (numeric) The number of confirmations of the most recent transaction included
        "label" : "label",                  (string) The label of the receiving address. The default label is "".
        "txids": [
            "txid",                         (string) The ids of transactions received with the address
            ...
        ]
    }
    ,...
]

Example:
>>> node.wallet.listreceivedbyaddress()
listreceivedbylabel(minconf: int = 1, include_empty: bool = False, include_watchonly: bool = True) [{}]#

List received transactions by label

Parameters:
  • minconf (int) – (optional) The minimum number of confirmations before payments are included

  • include_empty (bool) – (optional) Whether to include labels that haven’t received any payments

  • include_watchonly (bool) – (optional) Whether to include watch-only addresses (see ‘importaddress’)

Returns:

[{…}] (json array) – returns a list of receiving addresses by label

[
    {
        "involvesWatchonly" : true,   (bool) Only returned if imported addresses were involved in transaction
        "amount" : x.xxx,             (numeric) The total amount received by addresses with this label
        "confirmations" : n,          (numeric) The number of confirmations of the most recent transaction included
        "label" : "label"           (string) The label of the receiving address. The default label is "".
    }
    ,...
]

Example:
>>> node.wallet.listreceivedbylabel()
listsinceblock(blockhash: str = '', target_confirmations: int = 1, include_watchonly: bool = True, include_removed: bool = True) {}#

Get all transactions in blocks since block [blockhash], or all transactions if omitted.

If “blockhash” is no longer a part of the main chain, transactions from the fork point onward are included.

Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the “removed” array.

Parameters:
  • blockhash (str) – (optional) If set, the block hash to list transactions since, otherwise list all transactions

  • target_confirmations (int) – (optional) Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects [lastblock] in the return value

  • include_watchonly (bool) – (optional) Include transactions to watch-only addresses (see ‘importaddress’)

  • include_removed (bool) – (optional) Show transactions that were removed due to a reorg in the “removed” array (not guaranteed to work on pruned nodes)

Returns:

{…} (json) – returns all transactions in blocks since a specific block

{
    "transactions": [
        "address":"address",        (string) The defi address of the transaction.
        "category":                 (string) The transaction category.
            "send"                  Transactions sent.
            "receive"               Non-coinbase transactions received.
            "generate"              Coinbase transactions received with more than 100 confirmations.
            "immature"              Coinbase transactions received with 100 or fewer confirmations.
            "orphan"                Orphaned coinbase transactions received.
        "amount": x.xxx,            (numeric) The amount in DFI. This is negative for the 'send' category, and is positive
                                    for all other categories
        "vout" : n,                 (numeric) the vout value
        "fee": x.xxx,               (numeric) The amount of the fee in DFI. This is negative and only available for the 'send' category of transactions.
        "confirmations": n,         (numeric) The number of confirmations for the transaction.
                                    When it's < 0, it means the transaction conflicted that many blocks ago.
        "blockhash": "hashvalue",   (string) The block hash containing the transaction.
        "blockindex": n,            (numeric) The index of the transaction in the block that includes it.
        "blocktime": xxx,           (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
        "txid": "transactionid",    (string) The transaction id.
        "time": xxx,                (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).
        "timereceived": xxx,        (numeric) The time received in seconds since epoch (Jan 1 1970 GMT).
        "bip125-replaceable":       "yes|no|unknown",  (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
                                           may be unknown for unconfirmed transactions not in the mempool
        "abandoned": xxx,           (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions.
        "comment": "...",           (string) If a comment is associated with the transaction.
        "label" : "label"           (string) A comment for the address/transaction, if any
        "to": "...",                (string) If a comment to is associated with the transaction.
    ],
    "removed": [
        <structure is the same as "transactions" above, only present if include_removed=true>
        Note: transactions that were re-added in the active chain will appear as-is in this array, and may thus have a positive confirmation count.
    ],
    "lastblock": "lastblockhash"    (string) The hash of the block (target_confirmations-1) from the best block on the main chain. This is typically used to feed back into listsinceblock the next time you call it. So you would generally use a target_confirmations of say 6, so you will be continually re-notified of transactions until they've reached 6 confirmations plus any new ones
}

Example:
>>> node.wallet.listsinceblock()
listtransactions(label: str = '*', count: int = 10, skip: int = 0, include_watchonly: bool = True, exclude_custom_tx: bool = False) [{}]#

If a label name is provided, this will return only incoming transactions paying to addresses with the specified label.

Returns up to ‘count’ most recent transactions skipping the first ‘from’ transactions.

Parameters:
  • label (str) – (optional) If set, should be a valid label name to return only incoming transactions with the specified label, or “*” to disable filtering and return all transactions.

  • count (int) – (optional) The number of transactions to return

  • skip (int) – (optional) The number of transactions to skip

  • include_watchonly (bool) – (optional) Include transactions to watch-only addresses (see ‘importaddress’)

  • exclude_custom_tx (bool) – (optional) Exclude custom transactions

Returns:

[{…}] (json array) – returns transactions of the wallet

[
    {
        "address":"address",        (string) The defi address of the transaction.
        "category":                 (string) The transaction category.
            "send"                  Transactions sent.
            "receive"               Non-coinbase transactions received.
            "generate"              Coinbase transactions received with more than 100 confirmations.
            "immature"              Coinbase transactions received with 100 or fewer confirmations.
            "orphan"                Orphaned coinbase transactions received.
        "amount": x.xxx,            (numeric) The amount in DFI. This is negative for the 'send' category, and is positive
                                    for all other categories
        "label": "label",           (string) A comment for the address/transaction, if any
        "vout": n,                  (numeric) the vout value
        "fee": x.xxx,               (numeric) The amount of the fee in DFI. This is negative and only available for the
                                    'send' category of transactions.
        "confirmations": n,         (numeric) The number of confirmations for the transaction. Negative confirmations indicate the
                                    transaction conflicts with the block chain
        "trusted": xxx,             (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.
        "blockhash": "hashvalue",   (string) The block hash containing the transaction.
        "blockindex": n,            (numeric) The index of the transaction in the block that includes it.
        "blocktime": xxx,           (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
        "txid": "transactionid",    (string) The transaction id.
        "time": xxx,                (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
        "timereceived": xxx,        (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).
        "comment": "...",           (string) If a comment is associated with the transaction.
        "bip125-replaceable":       "yes|no|unknown",  (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
                                     may be unknown for unconfirmed transactions not in the mempool
        "abandoned": xxx            (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
                                    'send' category of transactions.
    }
]

Example:
>>> node.wallet.listtransactions()
listunspent(mincof: int = 1, maxcof: int = 9999999, addresses: [] = [], include_unsafe: bool = True, minimumAmount: float = 0, maximumAmount: float | None = None, maximumCount: float | None = None, minimumSumAmount: float | None = None, tokenId: str | None = None) [{}]#

Returns array of unspent transaction outputs

with between minconf and maxconf (inclusive) confirmations.

Optionally filter to only include txouts paid to specified addresses.

Parameters:
  • mincof (int) – (optional) The minimum confirmations to filter

  • maxcof (int) – (optional) The maximum confirmations to filter

  • addresses (json array) – (optional) A json array of defi addresses to filter

  • include_unsafe (bool) – (optional) Include outputs that are not safe to spend. See description of “safe” attribute below.

  • minimumAmount (float) – (optional) Minimum value of each UTXO in DFI

  • maximumAmount (float) – (optional) Maximum value of each UTXO in DFI

  • maximumCount (float) – (optional) Maximum number of UTXOs

  • minimumSumAmount (float) – (optional) Minimum sum value of all UTXOs in DFI

  • tokenId (str) – (optional) Filter by token (id/symbol/creationTx)

Returns:

[{…}] (json array) – returns array of unspent transaction outputs

[                                   (array of json object)
    {
        "txid" : "txid",            (string) the transaction id
        "vout" : n,                 (numeric) the vout value
        "address" : "address",      (string) the defi address
        "label" : "label",          (string) The associated label, or "" for the default label
        "scriptPubKey" : "key",     (string) the script key
        "amount" : x.xxx,           (numeric) the transaction output amount in DFI
        "tokenId" : n,              (numeric) the transaction output token Id
        "confirmations" : n,        (numeric) The number of confirmations
        "redeemScript" : "script"   (string) The redeemScript if scriptPubKey is P2SH
        "witnessScript" : "script"  (string) witnessScript if the scriptPubKey is P2WSH or P2SH-P2WSH
        "spendable" : xxx,          (bool) Whether we have the private keys to spend this output
        "solvable" : xxx,           (bool) Whether we know how to spend this output, ignoring the lack of keys
        "reused" : xxx,             (bool) (only present if avoid_reuse is set) Whether this output is reused/dirty (sent to an address that was previously spent from)
        "desc" : xxx,               (string, only when solvable) A descriptor for spending this output
        "safe" : xxx                (bool) Whether this output is considered safe to spend. Unconfirmed transactions
                                    from outside keys and unconfirmed replacement transactions are considered unsafe
                                    and are not eligible for spending by fundrawtransaction and sendtoaddress.
    }
    ,...
]

Example:
>>> node.wallet.listunspent()
listwalletdir() {}#

Returns a list of wallets in the wallet directory

Returns:

{…} (json) – returns list of wallets and their directory’s

Example:
>>> node.wallet.listwalletdir()
listwallets() []#

Returns a list of currently loaded wallets.

For full information on the wallet, use “getwalletinfo”

Returns:

[…] (array) – returns a list of currently loaded wallets

[                   (json array of strings)
    "walletname"    (string) the wallet name
    ...
]

Example:
>>> node.wallet.listwallets()
loadwallet(filename: str) {}#

Loads a wallet from a wallet file or directory.

Note that all wallet command-line options used when starting defid will be applied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).

Parameters:

filename (str) – (required) The wallet directory or .dat file

Returns:

{…} (json) – returns information about the loaded wallet

{
    "name" :    <wallet_name>,        (string) The wallet name if loaded successfully.
    "warning" : <warning>,            (string) Warning message if wallet was not loaded cleanly.
}

Example:
>>> node.wallet.loadwallet("test.dat")
lockunspent(unlock: bool, transactions: [{}] = None) bool#

Updates list of temporarily unspendable outputs.

Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.

If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.

A locked transaction output will not be chosen by automatic coin selection, when spending defis.

Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list is always cleared (by virtue of process exit) when a node stops or fails.

Also see the listunspent call

Parameters:
  • unlock (bool) – (required) Whether to unlock (true) or lock (false) the specified transactions

  • transactions (json array) –

    (optional) A json array of objects. Each object the txid (string) vout (numeric)

    [
        {                       (json object)
            "txid": "hex",      (string, required) The transaction id
            "vout": n,          (numeric, required) The output number
        },
        ...
    ]
    

Returns:

true|false (bool) – Whether the command was successful or not

Example:
>>> node.wallet.lockunspent(True)
removeprunedfunds(txid: str) None#

Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.

Parameters:

txid (str) – (required) The hex-encoded id of the transaction you are deleting

Returns:

None

Example:
>>> node.wallet.removeprunedfunds("a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5")
rescanblockchain(start_height: int = 0, stop_height: int | None = None) {}#

Rescan the local blockchain for wallet related transactions.

Note: Use “getwalletinfo” to query the scanning progress.

Parameters:
  • start_height (int) – (optional) block height where the rescan should start

  • stop_height (int) – (optional) the last block height that should be scanned. If none is provided it will rescan up to the tip at return time of this call

Returns:

{…} (json) – returns start and stop height

{
    "start_height"     (numeric) The block height where the rescan started (the requested height or 0)
    "stop_height"      (numeric) The height of the last rescanned block. May be null in rare cases if there was a reorg and the call didn't scan any blocks because they were already scanned in the background.
}

Example:
>>> node.wallet.rescanblockchain(1000000, 2000000)
sendmany(dummy: str, amounts: {}, minconf: int = 1, comment: str = '', subtractfeefrom: [] = [], replaceable: bool = False, conf_target: int = 1, estimate_mode: str = 'UNSET') str#

Send multiple times. Amounts are double-precision floating point numbers.

Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • dummy (str) – (required) Must be set to “” for backwards compatibility

  • amounts (json) – (required) Address Amount

  • minconf (int) – (optional) Ignored dummy value

  • comment (str) – (optional) A comment

  • subtractfeefrom (array) –

    (optional) A json array with addresses. The fee will be equally deducted from the amount of each selected address. Those recipients will receive less defis than you enter in their corresponding amount field. If no addresses are specified here, the sender pays the fee.

    [
        "address",            (string) Subtract fee from this address
        ...
    ]
    

  • replaceable (bool) – (optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125

  • conf_target (int) – (optional) Confirmation target (in blocks)

  • estimate_mode (str) – (optional) The fee estimate mode, must be one of: “UNSET”, “ECONOMICAL”, “CONSERVATIVE”

Returns:

“txid” (string) – The transaction id for the send. Only 1 transaction is created regardless of the number of addresses.

Example:
>>> node.wallet.sendmany("", {"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX":0.01,"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz":0.02})
sendtoaddress(address: str, amount: float, comment: str = '', comment_to: str = '', subtractfeefromamount: bool = False, replaceable: bool = False, conf_target: int = 1, estimate_mode: str = 'UNSET', avoid_reuse: bool | None = None) str#

Send an amount to a given address.

Parameters:
  • address (str) – (required) The defi address to send to

  • amount (float) – (required) The amount in DFI to send. eg 0.1

  • comment (str) – (optional) A comment used to store what the transaction is for. This is not part of the transaction, just kept in your wallet.

  • comment_to (str) – (optional) A comment to store the name of the person or organization to which you’re sending the transaction. This is not part of the transaction, just kept in your wallet.

  • subtractfeefromamount (bool) – (optional) The fee will be deducted from the amount being sent. The recipient will receive less defis than you enter in the amount field.

  • replaceable (bool) – (optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125

  • conf_target (int) – (optional) Confirmation target (in blocks)

  • estimate_mode (str) – (optional) The fee estimate mode, must be one of: “UNSET”, “ECONOMICAL”, “CONSERVATIVE”

  • avoid_reuse (bool) – (optional) Avoid spending from dirty addresses; addresses are considered dirty if they have previously been used in a transaction.

Returns:

“hash” (string) – The hex-encoded hash of broadcasted transaction

Example:
>>> node.wallet.sendtoaddress("1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd", 0.1)
sethdseed(newkeypool: bool = True, seed: str | None = None) None#

Set or generate a new HD wallet seed. Non-HD wallets will not be upgraded to being a HD wallet. Wallets that are already HD will have a new HD seed set so that new keys added to the keypool will be derived from this new seed.

Note that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed. Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • newkeypool (bool) – (optional)Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it. If true, the next address from getnewaddress and change address from getrawchangeaddress will be from this new seed. If false, addresses (including change addresses if the wallet already had HD Chain Split enabled) from the existing keypool will be used until it has been depleted.

  • seed (str) – (optional) The WIF private key to use as the new HD seed. The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1

Returns:

None

Example:
>>> node.wallet.sethdseed()
setlabel(address: str, label: str) None#

Sets the label associated with the given address

Parameters:
  • address (str) – (required) The defi address to be associated with a label

  • label (str) – (required) The label to assign to the address

Returns:

None

Example:
>>> node.wallet.setlabel("1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX", "teddy")
settxfee(amount: float) bool#

Set the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter

Parameters:

amount (float) – (required) The transaction fee in DFI/kB

Returns:

true|false (bool) – returns true if successful

Example:
>>> node.wallet.settxfee(0.00001)
setwalletflag(flag: str, value: bool = True) {}#

Change the state of the given wallet flag for a wallet

Parameters:
  • flag (str) – (required) The name of the flag to change. Current available flags: avoid_reuse

  • value (bool) – (optional) The new state

Returns:

{…} (json) – returns information about the wallet flags

Example:
>>> node.wallet.setwalletflag("avoid_reuse")
signmessage(address: str, message: str) str#

Sign a message with the private key of an address

Parameters:
  • address (str) – (required) The defi address to use for the private key

  • message (str) – (required) The message to create a signature of

Returns:

“signature” (string) – The signature of the message encoded in base 64

Example:
>>> node.wallet.signmessage("1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX", "my message")
signrawtransactionwithwallet(hexstring: str, prevtxs: [] = [], sighashtype: str = 'ALL') {}#

Sign inputs for raw transaction (serialized, hex-encoded).

The second optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain.

Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • hexstring (str) – (required) The transaction hex string

  • prevtxs (json array) –

    (optional) A json array of previous dependent transaction outputs

    [
        {                            (json object)
            "txid": "hex",             (string, required) The transaction id
            "vout": n,                 (numeric, required) The output number
            "scriptPubKey": "hex",     (string, required) script key
            "redeemScript": "hex",     (string) (required for P2SH) redeem script
            "witnessScript": "hex",    (string) (required for P2WSH or P2SH-P2WSH) witness script
            "amount": amount,          (numeric or string) (required for Segwit inputs) the amount spent
        },
        ...
    ]
    

  • sighashtype (str) – (optional) The signature hash type. Must be one of: “ALL”, “NONE”, “SINGLE”, “ALL|ANYONECANPAY”, “NONE|ANYONECANPAY”, “SINGLE|ANYONECANPAY”

Returns:

{…} (json) – returns a json with the signed hexstring

{
    "hex" : "value",                (string) The hex-encoded raw transaction with signature(s)
    "complete" : true|false,        (boolean) If the transaction has a complete set of signatures
    "errors" : [                    (json array of objects) Script verification errors (if there are any)
        {
            "txid" : "hash",        (string) The hash of the referenced, previous transaction
            "vout" : n,             (numeric) The index of the output to spent and used as input
            "scriptSig" : "hex",    (string) The hex-encoded signature script
            "sequence" : n,         (numeric) Script sequence number
            "error" : "text"        (string) Verification or signing error related to the input
        }
        ,...
    ]
}

Example:
>>> node.wallet.signrawtransactionwithwallet("hex")
unloadwallet(wallet_name: str | None = None) None#

Unloads the wallet referenced by the request endpoint otherwise unloads the wallet specified in the argument.

Specifying the wallet name on a wallet endpoint is invalid.

Parameters:

wallet_name (str) – (optional) The name of the wallet to unload

Returns:

None

Example:
>>> node.wallet.unloadwallet()
walletcreatefundedpsbt(inputs: [{}], outputs: [{}], locktime: int = 0, changeAddress: str = None, changePosition: int = None, change_type: str = None, includeWatching: bool = True, lockUnspents: bool = False, feeRate: float = None, subtractFeeFromOutputs: [] = None, replaceable: bool = None, conf_target: int = None, estimate_mode: str = None, bip32derivs: bool = False) {}#

Creates and funds a transaction in the Partially Signed Transaction format.

Inputs will be added if supplied inputs are not enough Implements the Creator and Updater roles.

Parameters:
  • inputs (json array) –

    (required) A json array of json objects

    [
        {                         (json object)
            "txid": "hex",        (string, required) The transaction id
            "vout": n,            (numeric, required) The output number
            "sequence": n,        (numeric, required) The sequence number
        },
        ...
    ]
    

  • outputs (json array) –

    (required) a json array with outputs (key-value pairs), where none of the keys are duplicated. That is, each address can only appear once and there can only be one ‘data’ object. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also accepted as second parameter.

    [
        {                             (json object)
            "address": amount,        (numeric or string, required) A key-value pair. The key (string) is the defi address, the value (float or string) is the amount in DFI
        },
        {                             (json object)
            "data": "hex",            (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
        },
        ...
    ]
    

  • locktime (int) – (optional) Raw locktime. Non-0 value also locktime-activates inputs

  • changeAddress (str) – (optional) The defi address to receive the change

  • changePosition (int) – (optional) The index of the change output

  • change_type (str) – (optional) The output type to use. Only valid if changeAddress is not specified. Options are “legacy”, “p2sh-segwit”, and “bech32”.

  • includeWatching (bool) – (optional) Also select inputs which are watch only

  • lockUnspents (bool) – (optional) Lock selected unspent outputs

  • feeRate (float) – (optional) Set a specific fee rate in DFI/kB

  • subtractFeeFromOutputs (json array) –

    (optional) A json array of integers. The fee will be equally deducted from the amount of each specified output. Those recipients will receive less defis than you enter in their corresponding amount field. If no outputs are specified here, the sender pays the fee.

    [
        vout_index,     (numeric) The zero-based output index, before a change output is added.
        ...
    ]
    

  • replaceable (bool) – (optional) Marks this transaction as BIP125 replaceable Allows this transaction to be replaced by a transaction with higher fees

  • conf_target (int) – (optional) Confirmation target (in blocks)

  • estimate_mode (str) – (optional) The fee estimate mode, must be one of: “UNSET”, “ECONOMICAL”, “CONSERVATIVE”

  • bip32derivs (bool) – (optional) If true, includes the BIP 32 derivation paths for public keys if we know them

Returns:

{…} (json) – returns an json with the partially signed transaction

{
    "psbt": "value",        (string)  The resulting raw transaction (base64-encoded string)
    "fee":       n,         (numeric) Fee in DFI the resulting transaction pays
    "changepos": n          (numeric) The position of the added change output, or -1
}

Example:
>>> node.wallet.walletcreatefundedpsbt([{"txid":"myid","vout":0}]" "[{"data":"00010203"}])
walletlock() None#

Removes the wallet encryption key from memory, locking the wallet.

After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked.

Returns:

None

Example:
>>> node.wallet.walletlock()
walletpassphrase(passphrase: str, timeout: int) None#

Stores the wallet decryption key in memory for ‘timeout’ seconds. This is needed prior to performing transactions related to private keys such as sending defis

Note: Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock time that overrides the old one.

Parameters:
  • passphrase (str) – (required) The wallet passphrase

  • timeout (int) – (required) The time to keep the decryption key in seconds; capped at 100000000 (~3 years)

Returns:

None

Example:
>>> node.wallet.walletpassphrase("passphrase", 60)
walletpassphrasechange(oldpassphrase: str, newpassphrase: str) None#

Changes the wallet passphrase from ‘oldpassphrase’ to ‘newpassphrase’

Parameters:
  • oldpassphrase (str) – (required) The current passphrase

  • newpassphrase (str) – (required) The new passphrase

Returns:

None

Example:
>>> node.wallet.walletpassphrasechange("old", "new")
walletprocesspsbt(psbt: str, sign: bool = True, sighashtype: str = 'ALL', bip32derivs: bool = False) {}#

Update a PSBT with input information from our wallet and then sign inputs that we can sign for.

Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • psbt (str) – (required) The transaction base64 string

  • sign (bool) – (optional) Also sign the transaction when updating

  • sighashtype (str) – (optional) The signature hash type to sign with if not specified by the PSBT. Must be one of “ALL”, “NONE”, “SINGLE”, “ALL|ANYONECANPAY”, “NONE|ANYONECANPAY”, “SINGLE|ANYONECANPAY”

  • bip32derivs (bool) – (optional) If true, includes the BIP 32 derivation paths for public keys if we know them

Returns:

{…} (json) – returns information about PSBT from the wallet

{
    "psbt" : "value",          (string) The base64-encoded partially signed transaction
    "complete" : true|false,   (boolean) If the transaction has a complete set of signatures
}

Example:
>>> node.wallet.walletprocesspsbt("psbt")