/build/rpc / contracts / forward
forward.build_open
- workflowforward-lifecycle·step 6 of 10Workflow: forward-lifecycle · step 6 of 10
forward.build_open "id" ( {"locktime":n,"auto_fund_long":bool,"auto_fund_short":bool,"auto_fund_premium":bool,"psbt":"str","fee_rate":n} ) Construct the opening PSBT for a forward contract, creating both IM vaults atomically. CRITICAL: This creates Bob's IM vault (locks IM_B) and Alice's IM vault (locks IM_A) with their respective taptrees as specified in FINANCING_PRIMITIVES §3.2. Each vault can lock native BTC or any issued asset as initial margin. Two-party workflow: Long party calls with auto_fund_long=true (and optionally auto_fund_premium=true), short party receives PSBT and calls with psbt= and auto_fund_short=true to add short IM funding. Arguments: 1. id (string, required) Forward offer identifier 2. options (json object, optional) Optional funding overrides { "locktime": n, (numeric, optional) Override transaction nLockTime "auto_fund_long": bool, (boolean, optional) Long party mode: automatically attach wallet-controlled inputs for long IM "auto_fund_short": bool, (boolean, optional) Short party mode: automatically attach wallet-controlled inputs for short IM "auto_fund_premium": bool, (boolean, optional) Include premium in long party funding (requires auto_fund_long) "psbt": "str", (string, optional) Existing PSBT to add funding to (used with auto_fund_short) "fee_rate": n, (numeric, optional) Override fee rate in sat/vB (wallet estimate if omitted) } Result: { (json object) "psbt" : "str", (string) Base64-encoded PSBT containing the funded covenant transaction "fee" : n, (numeric) Fee (in BTC) paid by the wallet "premium_output_index" : n, (numeric) Index of the premium output (P0) "bob_vault_index" : n, (numeric) Index of Bob's IM vault output "alice_vault_index" : n, (numeric) Index of Alice's IM vault output "bob_vault_taproot" : { (json object) Bob IM vault Taproot construction "output_key" : "hex", (string) Tweaked Taproot output key "internal_key" : "hex", (string) Internal Taproot key "script_pubkey" : "hex", (string) Hex-encoded covenant scriptPubKey "tree" : [ (json array) Taproot script tree { (json object) "depth" : n, (numeric) Depth of the leaf "leaf_version" : n, (numeric) Taproot leaf version "script" : "hex" (string) Hex-encoded leaf script }, ... ] }, "alice_vault_taproot" : { (json object) Alice IM vault Taproot construction "output_key" : "hex", (string) Tweaked Taproot output key "internal_key" : "hex", (string) Internal Taproot key "script_pubkey" : "hex", (string) Hex-encoded covenant scriptPubKey "tree" : [ (json array) Taproot script tree { (json object) "depth" : n, (numeric) Depth of the leaf "leaf_version" : n, (numeric) Taproot leaf version "script" : "hex" (string) Hex-encoded leaf script }, ... ] }, "complete" : true|false (boolean) Whether the PSBT already contains all signatures } Examples: > bitcoin-cli forward.build_open "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Signature
forward.build_open(id: string, options?: object) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"forward.build_open","params":["\"<id>\"",{}]}' \
-H 'content-type: text/plain;' \
http://127.0.0.1:8332/ Parameters
| Name | Type | Req. | Description |
|---|---|---|---|
| id | string | yes | Forward offer identifier |
| options | object | — | Optional funding overrides { "locktime": n, (numeric, optional) Override transaction nLockTime "auto_fund_long": bool, (boolean, optional) Long party mode: automatically attach wallet-controlled inputs for long IM "auto_fund_short": bool, (boolean, optional) Short party mode: automatically attach wallet-controlled inputs for short IM "auto_fund_premium": bool, (boolean, optional) Include premium in long party funding (requires auto_fund_long) "psbt": "str", (string, optional) Existing PSBT to add funding to (used with auto_fund_short) "fee_rate": n, (numeric, optional) Override fee rate in sat/vB (wallet estimate if omitted) } |
Result
Type: any
{ (json object) "psbt" : "str", (string) Base64-encoded PSBT containing the funded covenant transaction "fee" : n, (numeric) Fee (in BTC) paid by the wallet "premium_output_index" : n, (numeric) Index of the premium output (P0) "bob_vault_index" : n, (numeric) Index of Bob's IM vault output "alice_vault_index" : n, (numeric) Index of Alice's IM vault output "bob_vault_taproot" : { (json object) Bob IM vault Taproot construction "output_key" : "hex", (string) Tweaked Taproot output key "internal_key" : "hex", (string) Internal Taproot key "script_pubkey" : "hex", (string) Hex-encoded covenant scriptPubKey "tree" : [ (json array) Taproot script tree { (json object) "depth" : n, (numeric) Depth of the leaf "leaf_version" : n, (numeric) Taproot leaf version "script" : "hex" (string) Hex-encoded leaf script }, ... ] }, "alice_vault_taproot" : { (json object) Alice IM vault Taproot construction "output_key" : "hex", (string) Tweaked Taproot output key "internal_key" : "hex", (string) Internal Taproot key "script_pubkey" : "hex", (string) Hex-encoded covenant scriptPubKey "tree" : [ (json array) Taproot script tree { (json object) "depth" : n, (numeric) Depth of the leaf "leaf_version" : n, (numeric) Taproot leaf version "script" : "hex" (string) Hex-encoded leaf script }, ... ] }, "complete" : true|false (boolean) Whether the PSBT already contains all signatures }
Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:14880
C++ symbol: forward_build_open