Language

Choose a language

/build/rpc / contracts / forward

forward.close_over_channel

forward.close_over_channel "session_id" "id" ( {"to_long":[{"asset_id":"hex","amount":n,"address":"str"},...],"to_short":[{"asset_id":"hex","amount":n,"address":"str"},...]} is_initiator ) Build cooperative close PSBT and coordinate Fair-Sign ceremony over an active cosign session. This is a convenience wrapper that combines forward.build_coop_close with cosign-based ceremony coordination. Arguments: 1. session_id (string, required) Active cosign session identifier 2. id (string, required) Forward contract identifier 3. settlement (json object, optional) Settlement distribution (defaults to cooperative leaf layout) { "to_long": [ (json array, required) Outputs to long party { (json object, required) "asset_id": "hex", (string, optional) Asset ID (omit for native BTC) "amount": n, (numeric, required) Amount in sats or asset units "address": "str", (string, optional) Destination (defaults to long party's settlement address) }, ... ], "to_short": [ (json array, required) Outputs to short party { (json object, required) "asset_id": "hex", (string, optional) Asset ID (omit for native BTC) "amount": n, (numeric, required) Amount in sats or asset units "address": "str", (string, optional) Destination (defaults to short party's settlement address) }, ... ], } 4. is_initiator (boolean, optional) Whether this party initiates the ceremony (default: true) Result: { (json object) "psbt" : "str", (string) Completed cooperative close PSBT with all signatures (base64) "fee" : n, (numeric) Estimated fee (in BTC) "ceremony_stats" : { (json object) Ceremony statistics "messages_sent" : n, (numeric) Number of messages sent "messages_received" : n, (numeric) Number of messages received "duration_ms" : n (numeric) Ceremony duration in milliseconds } } Examples: > bitcoin-cli forward.close_over_channel "69d967c0e415c9a3" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "{\"to_long\":[...], \"to_short\":[...]}" true

Signature

forward.close_over_channel(session_id: string, id: string, settlement?: object, is_initiator?: boolean) → any

Code samples

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

Parameters

NameTypeReq.Description
session_idstringyesActive cosign session identifier
idstringyesForward contract identifier
settlementobjectSettlement distribution (defaults to cooperative leaf layout) { "to_long": [ (json array, required) Outputs to long party { (json object, required) "asset_id": "hex", (string, optional) Asset ID (omit for native BTC) "amount": n, (numeric, required) Amount in sats or asset units "address": "str", (string, optional) Destination (defaults to long party's settlement address) }, ... ], "to_short": [ (json array, required) Outputs to short party { (json object, required) "asset_id": "hex", (string, optional) Asset ID (omit for native BTC) "amount": n, (numeric, required) Amount in sats or asset units "address": "str", (string, optional) Destination (defaults to short party's settlement address) }, ... ], }
is_initiatorbooleanWhether this party initiates the ceremony (default: true)

Result

Type:  any

{ (json object) "psbt" : "str", (string) Completed cooperative close PSBT with all signatures (base64) "fee" : n, (numeric) Estimated fee (in BTC) "ceremony_stats" : { (json object) Ceremony statistics "messages_sent" : n, (numeric) Number of messages sent "messages_received" : n, (numeric) Number of messages received "duration_ms" : n (numeric) Ceremony duration in milliseconds } }

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

C++ symbol: forward_close_over_channel