Language

Choose a language

/build/rpc / contracts / forward

forward.share_offer

forward.share_offer "id" ( "context" "transport" ttl ) Export a forward contract offer and create a cosign session for secure sharing with counterparty. This is a convenience wrapper that combines forward.export_offer with cosign.init. Arguments: 1. id (string, required) Forward contract offer identifier 2. context (string, optional) Human-readable context label (default: "forward-contract") 3. transport (string, optional) Transport: auto|websocket|nostr (default: auto) 4. ttl (numeric, optional) Session TTL in seconds (default: 1800) Result: { (json object) "offer_id" : "hex", (string) Forward contract offer identifier "offer" : { (json object) Forward contract offer payload "offer_id" : "hex", (string) Offer ID "terms" : { (json object) Contract terms "long_party" : { (json object) Alice (long) party terms "deliver_leg" : { (json object) Asset this party must deliver "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_leg" : { (json object) Initial margin asset/amount "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_dest" : "str", (string) Bech32m address to receive IM refund "settlement_receive_dest" : "str" (string) Bech32m address to receive counterparty's delivery }, "short_party" : { (json object) Bob (short) party terms "deliver_leg" : { (json object) Asset this party must deliver "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_leg" : { (json object) Initial margin asset/amount "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_dest" : "str", (string) Bech32m address to receive IM refund "settlement_receive_dest" : "str" (string) Bech32m address to receive counterparty's delivery }, "deadline_short" : n, (numeric) Block height Bob must act by (T) "deadline_long" : n, (numeric) Block height Alice must act by (T+K) "premium_upfront" : { (json object, optional) Upfront premium asset/amount (P0, omitted if zero) "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "premium_dest" : "str", (string, optional) Premium sink address if P0 > 0 "premium" : { (json object, optional) Combined premium object (GUI compatibility) "units" : n, (numeric) Premium amount in base units "is_native" : true|false, (boolean) True if premium is in native currency "asset_id" : "hex", (string, optional) Asset identifier if non-native "decimals" : n, (numeric, optional) Decimal places for display "payee_dest" : "str", (string) Address receiving the premium "payer" : "str" (string, optional) Which party pays (long or short) }, "safety_k" : n, (numeric) Safety window before deadlines "reorg_conf" : n (numeric) Confirmations past deadline before timeout }, "commitment_hex" : "hex" (string) Offer commitment }, "cosign" : { (json object) Cosign session details "session_id" : "str", (string) Cosign session identifier "invite_link" : "str", (string) Invite link for counterparty "sas" : "str" (string) Short Authentication String } } Examples: > bitcoin-cli forward.share_offer aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Signature

forward.share_offer(id: string, context?: string, transport?: string, ttl?: number) → any

Code samples

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

Parameters

NameTypeReq.Description
idstringyesForward contract offer identifier
contextstringHuman-readable context label (default: "forward-contract")
transportstringTransport: auto|websocket|nostr (default: auto)
ttlnumberSession TTL in seconds (default: 1800)

Result

Type:  any

{ (json object) "offer_id" : "hex", (string) Forward contract offer identifier "offer" : { (json object) Forward contract offer payload "offer_id" : "hex", (string) Offer ID "terms" : { (json object) Contract terms "long_party" : { (json object) Alice (long) party terms "deliver_leg" : { (json object) Asset this party must deliver "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_leg" : { (json object) Initial margin asset/amount "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_dest" : "str", (string) Bech32m address to receive IM refund "settlement_receive_dest" : "str" (string) Bech32m address to receive counterparty's delivery }, "short_party" : { (json object) Bob (short) party terms "deliver_leg" : { (json object) Asset this party must deliver "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_leg" : { (json object) Initial margin asset/amount "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "margin_dest" : "str", (string) Bech32m address to receive IM refund "settlement_receive_dest" : "str" (string) Bech32m address to receive counterparty's delivery }, "deadline_short" : n, (numeric) Block height Bob must act by (T) "deadline_long" : n, (numeric) Block height Alice must act by (T+K) "premium_upfront" : { (json object, optional) Upfront premium asset/amount (P0, omitted if zero) "is_native" : true|false, (boolean) True when the leg is denominated in BTC "asset_id" : "hex", (string, optional) 32-byte asset identifier when non-native "units" : n (numeric) Exact units (sats or asset units) delivered }, "premium_dest" : "str", (string, optional) Premium sink address if P0 > 0 "premium" : { (json object, optional) Combined premium object (GUI compatibility) "units" : n, (numeric) Premium amount in base units "is_native" : true|false, (boolean) True if premium is in native currency "asset_id" : "hex", (string, optional) Asset identifier if non-native "decimals" : n, (numeric, optional) Decimal places for display "payee_dest" : "str", (string) Address receiving the premium "payer" : "str" (string, optional) Which party pays (long or short) }, "safety_k" : n, (numeric) Safety window before deadlines "reorg_conf" : n (numeric) Confirmations past deadline before timeout }, "commitment_hex" : "hex" (string) Offer commitment }, "cosign" : { (json object) Cosign session details "session_id" : "str", (string) Cosign session identifier "invite_link" : "str", (string) Invite link for counterparty "sas" : "str" (string) Short Authentication String } }

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

C++ symbol: forward_share_offer