Language

Choose a language

/build/rpc / contracts / forward

forward.build_escrow_refund

forward.build_escrow_refund "id" {"txid":"hex","vout":n} ( {"escrow":"str","refund_address":"str","locktime":n,"fee_rate":n} ) Construct escrow refund PSBT. Either party can reclaim their escrowed asset after the appropriate deadline if the counterparty failed to claim (refund leaf). Arguments: 1. id (string, required) Forward contract identifier 2. escrow_outpoint (json object, required) Escrow outpoint { "txid": "hex", (string, required) Escrow transaction ID "vout": n, (numeric, required) Escrow output index } 3. options (json object, optional) Optional builder settings { "escrow": "str", (string, optional) Which escrow to refund: 'A' (long party) or 'B' (short party). Defaults based on local_side. "refund_address": "str", (string, optional) Destination for refunded asset (defaults to party's settlement address) "locktime": n, (numeric, optional) Override transaction nLockTime (must be >= deadline_long) "fee_rate": n, (numeric, optional) Fee rate in sat/vB (overrides wallet's fee estimation) } Result: { (json object) "psbt" : "str", (string) Base64-encoded PSBT "fee" : n, (numeric) Wallet-computed fee (in BTC) "escrow_input_index" : n, (numeric) Index of the escrow input "refund_output_index" : n, (numeric) Index of the refund output "changepos" : n, (numeric) Index of wallet change output or -1 "complete" : true|false, (boolean) Whether the PSBT contains all signatures "escrow" : "str", (string) Which escrow was refunded: 'A' or 'B' "side" : "str", (string) Which side refunded: 'short' or 'long' "hex" : "hex", (string, optional) Signed transaction hex (present when complete=true) "txid" : "hex" (string, optional) Transaction identifier (present when complete=true) } Examples: > bitcoin-cli forward.build_escrow_refund "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "{\"txid\":\"...\", \"vout\":0}"

Signature

forward.build_escrow_refund(id: string, escrow_outpoint: object, options?: object) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"forward.build_escrow_refund","params":["\"<id>\"",{},{}]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
idstringyesForward contract identifier
escrow_outpointobjectyesEscrow outpoint { "txid": "hex", (string, required) Escrow transaction ID "vout": n, (numeric, required) Escrow output index }
optionsobjectOptional builder settings { "escrow": "str", (string, optional) Which escrow to refund: 'A' (long party) or 'B' (short party). Defaults based on local_side. "refund_address": "str", (string, optional) Destination for refunded asset (defaults to party's settlement address) "locktime": n, (numeric, optional) Override transaction nLockTime (must be >= deadline_long) "fee_rate": n, (numeric, optional) Fee rate in sat/vB (overrides wallet's fee estimation) }

Result

Type:  any

{ (json object) "psbt" : "str", (string) Base64-encoded PSBT "fee" : n, (numeric) Wallet-computed fee (in BTC) "escrow_input_index" : n, (numeric) Index of the escrow input "refund_output_index" : n, (numeric) Index of the refund output "changepos" : n, (numeric) Index of wallet change output or -1 "complete" : true|false, (boolean) Whether the PSBT contains all signatures "escrow" : "str", (string) Which escrow was refunded: 'A' or 'B' "side" : "str", (string) Which side refunded: 'short' or 'long' "hex" : "hex", (string, optional) Signed transaction hex (present when complete=true) "txid" : "hex" (string, optional) Transaction identifier (present when complete=true) }

Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:17754

C++ symbol: forward_build_escrow_refund