fundrawtransaction

Back to rawtransactions

Wallet

Summary

If the transaction has no inputs, they will be automatically selected to meet its out value.

Description

If the transaction has no inputs, they will be automatically selected to meet its out value. It will add at most one change output to the outputs. No existing outputs will be modified unless "subtractFeeFromOutputs" is specified. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransactionwithkey or signrawtransactionwithwallet for that. 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. Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importdescriptors (to calculate fees). You can see whether this is the case by checking the "solvable" field in the listunspent output. Note that if specifying an exact fee rate, the resulting transaction may have a higher fee rate if the transaction has unconfirmed inputs. This is because the wallet will attempt to make the entire package have the given fee rate, not the resulting transaction.

Arguments

  • hexstring (STR_HEX, required): The hex string of the raw transaction
  • options (OBJ_NAMED_PARAMS): No description.
  • add_inputs (BOOL): For a transaction with existing inputs, automatically include more if they are not enough.
  • 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 integers. 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.
  • input_weights (ARR): Inputs and their corresponding weights
    • value (OBJ): No description.
    • txid (STR_HEX, required): The transaction id
    • vout (NUM, required): The output index
    • weight (NUM, required): The maximum weight for this input, including the weight of the outpoint and sequence number. Note that serialized 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.
  • 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
  • iswitness (BOOL): Whether the transaction hex is a serialized witness transaction. If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserialization will be tried. If false, only non-witness deserialization will be tried. This boolean should reflect whether the transaction has inputs (e.g. fully valid, or on-chain transactions), if known by the caller.

Results

  • value (OBJ): No description.
  • hex (STR_HEX): The resulting raw transaction (hex-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 transaction with no inputs
qbit-cli createrawtransaction "[]" "{\"myaddress\":0.01}"
Add sufficient unsigned inputs to meet the output value
qbit-cli fundrawtransaction "rawtransactionhex"
Sign the transaction
qbit-cli signrawtransactionwithwallet "fundedtransactionhex"
Send the transaction
qbit-cli sendrawtransaction "signedtransactionhex"