walletcreatefundedpsbt

Back to wallet

Wallet

Summary

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

Description

Creates and funds a transaction in the Partially Signed Transaction format. Implements the Creator and Updater roles. All existing inputs must either have their previous output transaction be in the wallet or be in the UTXO set. Solving data must be provided for non-wallet inputs.

Arguments

  • inputs (ARR): Leave empty to add inputs automatically. See add_inputs option.
  • value (OBJ): No description.
    • txid (STR_HEX, required): The transaction id
    • vout (NUM, required): The output number
    • sequence (NUM): The sequence number
    • weight (NUM): The maximum weight for this input, including the weight of the outpoint and sequence number. Note that signature sizes are not guaranteed to be consistent, so the maximum DER signatures size of 73 bytes should be used when considering ECDSA signatures.Remember to convert serialized sizes to weight units when necessary.
  • outputs (ARR, required): The outputs specified as key-value pairs. Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated. At least one output of either type must be specified. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also accepted as second parameter.
  • value (OBJ_USER_KEYS): No description.
    • address (AMOUNT, required): A key-value pair. The key (string) is the qbit address, the value (float or string) is the amount in QBT
  • value (OBJ): No description.
    • data (STR_HEX, required): A key-value pair. The key must be "data", the value is hex-encoded data that becomes a part of an OP_RETURN output
  • locktime (NUM): Raw locktime. Non-0 value also locktime-activates inputs
  • options (OBJ_NAMED_PARAMS): No description.
  • add_inputs (BOOL): Automatically include coins from the wallet to cover the target amount.

  • include_unsafe (BOOL): Include inputs that are not safe to spend (unconfirmed transactions from outside keys and unconfirmed replacement transactions). Warning: the resulting transaction may become invalid if one of the unsafe inputs disappears. If that happens, you will need to fund the transaction with different inputs and republish it.

  • minconf (NUM): If add_inputs is specified, require inputs with at least this many confirmations.
  • maxconf (NUM): If add_inputs is specified, require inputs with at most this many confirmations.
  • changeAddress (STR): The qbit address to receive the change
  • changePosition (NUM): The index of the change output
  • change_type (STR): The output type to use. Only valid if changeAddress is not specified. Options are "p2mr" on launch chains; unrestricted regtest also accepts "legacy", "p2sh-segwit", "bech32", "bech32m", "p2mr".
  • includeWatching (BOOL): (DEPRECATED) No longer used
  • lockUnspents (BOOL): Lock selected unspent outputs
  • fee_rate (AMOUNT): Specify a fee rate in sat/vB.
  • feeRate (AMOUNT): Specify a fee rate in QBT/kvB.
  • subtractFeeFromOutputs (ARR): The outputs to subtract the fee from. The fee will be equally deducted from the amount of each specified output. Those recipients will receive less QBT than you enter in their corresponding amount field. If no outputs are specified here, the sender pays the fee.
    • vout_index (NUM): The zero-based output index, before a change output is added.
  • max_tx_weight (NUM): The maximum acceptable transaction weight. Transaction building will fail if this can not be satisfied.
  • conf_target (NUM): Confirmation target in blocks
  • estimate_mode (STR): The fee estimate mode, must be one of (case insensitive): unset, economical, conservative unset means no mode set (economical mode is used if the transaction is replaceable; otherwise, conservative mode is used). economical estimates use a shorter time horizon, making them more responsive to short-term drops in the prevailing fee market. This mode potentially returns a lower fee rate estimate. conservative estimates use a longer time horizon, making them less responsive to short-term drops in the prevailing fee market. This mode potentially returns a higher fee rate estimate.

  • replaceable (BOOL): Marks this transaction as BIP125-replaceable. Allows this transaction to be replaced by a transaction with higher fees

  • solving_data (OBJ): Keys and scripts needed for producing a final transaction with a dummy signature. Used for fee estimation during coin selection.
    • pubkeys (ARR): Public keys involved in this transaction.
    • pubkey (STR_HEX): A public key
    • scripts (ARR): Scripts involved in this transaction.
    • script (STR_HEX): A script
    • descriptors (ARR): Descriptors that provide solving data for this transaction.
    • descriptor (STR): A descriptor
  • bip32derivs (BOOL): Include BIP 32 derivation paths for public keys if we know them
  • version (NUM): Transaction version

Results

  • value (OBJ): No description.
  • psbt (STR): The resulting raw transaction (base64-encoded string)
  • fee (STR_AMOUNT): Fee in QBT the resulting transaction pays
  • changepos (NUM): The position of the added change output, or -1

Examples

Create a PSBT with automatically picked inputs that sends 0.5 QBT to an address and has a fee rate of 2 sat/vB:
qbit-cli walletcreatefundedpsbt "[]" "[{\"qb1zqqqsyqcyq5rqwzqfpg9scrgwpugpzysnzs23v9ccrydpk8qarc0sjq57mw\":0.5}]" 0 "{\"add_inputs\":true,\"fee_rate\":2}"
Create the same PSBT as the above one instead using named arguments:
qbit-cli -named walletcreatefundedpsbt outputs="[{\"qb1zqqqsyqcyq5rqwzqfpg9scrgwpugpzysnzs23v9ccrydpk8qarc0sjq57mw\":0.5}]" add_inputs=true fee_rate=2