Language

Choose a language

/build/rpc / contracts / spot

spot.share_offer

spot.share_offer "id" ( "context" "transport" ttl ) Export a spot swap offer and create a cosign session for secure sharing with counterparty. This is a convenience wrapper that combines spot.export_offer with cosign.init. Arguments: 1. id (string, required) Spot offer identifier 2. context (string, optional) Human-readable context label (default: "spot-swap") 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) Spot offer identifier "offer" : { (json object) Exported spot offer payload "version" : n, (numeric) Offer payload version "contract_type" : "str", (string) Contract type (spot) "id" : "hex", (string) Offer identifier "terms" : { (json object) Spot swap legs "alice_leg" : { (json object) Assets Alice delivers to Bob "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 }, "bob_leg" : { (json object) Assets Bob delivers to Alice "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 } }, "sinks" : { (json object) Receiving scripts "alice_recv_spk" : "hex", (string) Hex-encoded script where Alice receives Bob's leg "bob_recv_spk" : "hex" (string, optional) Hex-encoded script where Bob receives Alice's leg }, "fs_policy" : { (json object) Fair-Sign policy "require_adaptor" : true|false, (boolean) Require adaptor signatures (Fair-Sign) "reveal_lockstep" : true|false (boolean) Enforce lock-step final signature reveal }, "fs_tx_adaptor_point" : "hex", (string) Global adaptor point (x-only, hex) "salt" : "hex", (string) Salt used for the commitment "commitment" : "hex", (string) Offer commitment "created_height" : n, (numeric) Wallet chain height when the offer was recorded "created_time" : xxx, (numeric) Wall-clock creation timestamp "alice_address" : "str", (string) Bech32m address Alice receives on "bob_address_hint" : "str", (string, optional) Bob's receive address if provided "acceptance" : { (json object, optional) Counterparty acceptance payload ... } }, "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 spot.share_offer aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Signature

spot.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":"spot.share_offer","params":["\"<id>\"","\"<context>\"","\"<transport>\"",0]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

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

Result

Type:  any

{ (json object) "offer_id" : "hex", (string) Spot offer identifier "offer" : { (json object) Exported spot offer payload "version" : n, (numeric) Offer payload version "contract_type" : "str", (string) Contract type (spot) "id" : "hex", (string) Offer identifier "terms" : { (json object) Spot swap legs "alice_leg" : { (json object) Assets Alice delivers to Bob "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 }, "bob_leg" : { (json object) Assets Bob delivers to Alice "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 } }, "sinks" : { (json object) Receiving scripts "alice_recv_spk" : "hex", (string) Hex-encoded script where Alice receives Bob's leg "bob_recv_spk" : "hex" (string, optional) Hex-encoded script where Bob receives Alice's leg }, "fs_policy" : { (json object) Fair-Sign policy "require_adaptor" : true|false, (boolean) Require adaptor signatures (Fair-Sign) "reveal_lockstep" : true|false (boolean) Enforce lock-step final signature reveal }, "fs_tx_adaptor_point" : "hex", (string) Global adaptor point (x-only, hex) "salt" : "hex", (string) Salt used for the commitment "commitment" : "hex", (string) Offer commitment "created_height" : n, (numeric) Wallet chain height when the offer was recorded "created_time" : xxx, (numeric) Wall-clock creation timestamp "alice_address" : "str", (string) Bech32m address Alice receives on "bob_address_hint" : "str", (string, optional) Bob's receive address if provided "acceptance" : { (json object, optional) Counterparty acceptance payload ... } }, "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:8112

C++ symbol: spot_share_offer