/build/rpc / contracts / forward
forward.build_self_delivery
- workflowforward-lifecycle·step 8 of 10Workflow: forward-lifecycle · step 8 of 10
forward.build_self_delivery "id" ( {"short_vault_txid":"hex","short_vault_vout":n,"manual_inputs":bool,"inputs":[{"txid":"hex","vout":n},...],"locktime":n} ) Construct Bob's self-delivery PSBT. Bob (short party) spends his IM vault via the SELF-DELIVER leaf before deadline T, pays asset B to Alice, and creates the B_ESCROW output. Arguments: 1. id (string, required) Forward contract identifier 2. options (json object, optional) Optional builder settings { "short_vault_txid": "hex", (string, optional) Override short vault outpoint txid "short_vault_vout": n, (numeric, optional) Override short vault outpoint index "manual_inputs": bool, (boolean, optional) Disable automatic asset input selection "inputs": [ (json array, optional) Manual additional inputs for asset B { (json object, required) "txid": "hex", (string, required) Input txid "vout": n, (numeric, required) Input vout }, ... ], "locktime": n, (numeric, optional) Override transaction nLockTime } Result: { (json object) "side" : "str", (string) Self-delivery side ('short' or 'long') "psbt" : "str", (string) Base64-encoded PSBT "fee" : n, (numeric) Wallet-computed fee (in BTC) "vault_input_index" : n, (numeric) Index of the IM vault input being spent "short_vault_input_index" : n, (numeric, optional) Index of Bob's vault input (present when side='short') "long_vault_input_index" : n, (numeric, optional) Index of Alice's vault input (present when side='long') "delivery_output_index" : n, (numeric, optional) Index of the direct delivery output (only present when side='short' and such output exists) "escrow_output_index" : n, (numeric) Index of the escrow output that is created "margin_output_index" : n, (numeric) Index of the IM refund output "changepos" : n, (numeric) Index of wallet change output or -1 "locked_inputs" : [ (json array, optional) Wallet inputs reserved for this build { (json object) "txid" : "hex", (string) Locked input transaction id "vout" : n (numeric) Locked input output index }, ... ], "complete" : true|false, (boolean) Whether the PSBT contains all signatures "hex" : "hex", (string, optional) Signed transaction hex (present when complete=true) "txid" : "hex" (string, optional) Transaction id (present when complete=true) } Examples: > bitcoin-cli forward.build_self_delivery "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Signature
forward.build_self_delivery(id: string, options?: object) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"forward.build_self_delivery","params":["\"<id>\"",{}]}' \
-H 'content-type: text/plain;' \
http://127.0.0.1:8332/ Parameters
| Name | Type | Req. | Description |
|---|---|---|---|
| id | string | yes | Forward contract identifier |
| options | object | — | Optional builder settings { "short_vault_txid": "hex", (string, optional) Override short vault outpoint txid "short_vault_vout": n, (numeric, optional) Override short vault outpoint index "manual_inputs": bool, (boolean, optional) Disable automatic asset input selection "inputs": [ (json array, optional) Manual additional inputs for asset B { (json object, required) "txid": "hex", (string, required) Input txid "vout": n, (numeric, required) Input vout }, ... ], "locktime": n, (numeric, optional) Override transaction nLockTime } |
Result
Type: any
{ (json object) "side" : "str", (string) Self-delivery side ('short' or 'long') "psbt" : "str", (string) Base64-encoded PSBT "fee" : n, (numeric) Wallet-computed fee (in BTC) "vault_input_index" : n, (numeric) Index of the IM vault input being spent "short_vault_input_index" : n, (numeric, optional) Index of Bob's vault input (present when side='short') "long_vault_input_index" : n, (numeric, optional) Index of Alice's vault input (present when side='long') "delivery_output_index" : n, (numeric, optional) Index of the direct delivery output (only present when side='short' and such output exists) "escrow_output_index" : n, (numeric) Index of the escrow output that is created "margin_output_index" : n, (numeric) Index of the IM refund output "changepos" : n, (numeric) Index of wallet change output or -1 "locked_inputs" : [ (json array, optional) Wallet inputs reserved for this build { (json object) "txid" : "hex", (string) Locked input transaction id "vout" : n (numeric) Locked input output index }, ... ], "complete" : true|false, (boolean) Whether the PSBT contains all signatures "hex" : "hex", (string, optional) Signed transaction hex (present when complete=true) "txid" : "hex" (string, optional) Transaction id (present when complete=true) }
Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:17416
C++ symbol: forward_build_self_delivery