Language

Choose a language

/build/rpc / contracts / crosschain

crosschain.set_htlc_params

crosschain.set_htlc_params "swap_id" "htlc_contract_address" "htlc_swap_id" "external_signer_ref" ( "claim_secret" "expected_secret_hash" "expected_recipient" "expected_amount" "expected_token_address" ) Set HTLC execution parameters on a cross-chain record. Used by the session layer after negotiation, or manually for testnet. All fields are persisted via write-before-mutate. The expected_* fields are used by v1 trusted-RPC verification to validate on-chain HTLC facts against negotiated terms before advancing. Arguments: 1. swap_id (string, required) Swap identifier 2. htlc_contract_address (string, required) Deployed HTLC contract address (0x...) 3. htlc_swap_id (string, required) 32-byte hex swap ID used on the HTLC contract 4. external_signer_ref (string, required) Signer ref (raw hex key for testnet, or derived:auto) 5. claim_secret (string, optional) 32-byte hex secret preimage (set when we are the claimer) 6. expected_secret_hash (string, optional) Expected sha256(secret) on the HTLC (for direct verification) 7. expected_recipient (string, optional) Expected recipient address on the HTLC 8. expected_amount (string, optional) Expected amount locked (hex wei) 9. expected_token_address (string, optional) Expected ERC-20 token address (0x0...0 for native ETH) Result: true|false (boolean) Whether the params were persisted Examples: > bitcoin-cli crosschain.set_htlc_params "swap-uuid" "0xHTLC_ADDR" "0xSWAP_ID_32" "signing_key_hex" "secret_hex"

Signature

crosschain.set_htlc_params(swap_id: string, htlc_contract_address: string, htlc_swap_id: string, external_signer_ref: string, claim_secret?: string, expected_secret_hash?: string, expected_recipient?: string, expected_amount?: string, expected_token_address?: string) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"crosschain.set_htlc_params","params":["\"<swap_id>\"","\"<htlc_contract_address>\"","\"<htlc_swap_id>\"","\"<external_signer_ref>\"","\"<claim_secret>\"","\"<expected_secret_hash>\"","\"<expected_recipient>\"","\"<expected_amount>\"","\"<expected_token_address>\""]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
swap_idstringyesSwap identifier
htlc_contract_addressstringyesDeployed HTLC contract address (0x...)
htlc_swap_idstringyes32-byte hex swap ID used on the HTLC contract
external_signer_refstringyesSigner ref (raw hex key for testnet, or derived:auto)
claim_secretstring32-byte hex secret preimage (set when we are the claimer)
expected_secret_hashstringExpected sha256(secret) on the HTLC (for direct verification)
expected_recipientstringExpected recipient address on the HTLC
expected_amountstringExpected amount locked (hex wei)
expected_token_addressstringExpected ERC-20 token address (0x0...0 for native ETH)

Result

Type:  any

true|false (boolean) Whether the params were persisted

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

C++ symbol: crosschain_set_htlc_params