-
Notifications
You must be signed in to change notification settings - Fork 122
SPV RPC Calls
spv_claimhtlc
spv_createanchor
spv_createanchortemplate
spv_createhtlc
spv_decodehtlcscript
spv_dumpprivkey
spv_estimateanchorcost
spv_getaddresspubkey
spv_getbalance
spv_gethtlcseed
spv_getnewaddress
spv_getrawtransaction
spv_gettxconfirmations
spv_listanchors
spv_listanchorauths
spv_listanchorrewardconfirms
spv_listanchorrewards
spv_listanchorsunrewarded
spv_listanchorspending
spv_listhtlcoutputs
spv_listtransactions
spv_refundhtlc
spv_rescan
spv_sendrawtx
spv_sendtoaddress
spv_syncstatus
Claims all coins in HTLC address
Arguments scriptaddress string HTLC address destinationaddress string Destination for funds in the HTLC seed string Seed that was used to generate the hash in the HTLC feerate number Feerate (satoshis) per KB (Default: 10000) Results { txid string The transaction id sendmessage string Send message result }
Creates (and optional submits to bitcoin blockchain) an anchor
tx with latest possible (every 15th) authorized blockhash. The
first argument is the specific UTXOs to spend.
Arguments inputs JSON array of objects containing txid string The transaction id of the bitcoin UTXO to spend vout number The output index to spend in UTXO amount number Amount of output in satoshis privkey string WIF private key of bitcoin for signing this output rewardAddress string User's P2PKH address (in DeFi chain) for reward send bool Send it to btc network (Default = true) feerate number Feerate (satoshis) per 1000 bytes (Default = 1000) Results txHex string The hex-encoded raw transaction with signature(s) txHash string The hex-encoded transaction hash
Creates an anchor tx template with latest possible (every 15th) authorized blockhash.
Argument rewardAddress string User's P2PKH address (in DeFi chain) for reward Result txHex string The hex-encoded raw transaction with signature(s)
Creates a Bitcoin address whose funds can be unlocked with a seed or as a refund.
It returns a json object with the address and redeemScript.
Arguments seller_key string The public key of the possessor of the seed refund_key string The public key of the recipient of the refund timeout string Timeout of the contract (denominated in blocks) relative to its placement in the blockchain hash string SHA256 hash of the seed. If none provided one will be generated Results { address string The value of the new Bitcoin address. redeemscript string Hex-encoded redemption script seed string Hex-encoded seed if no seed provided seedhash string Hex-encoded seed hash if no seed provided }
Decode and return value in a HTLC redeemscript
Argument redeemscript string The HTLC redeemscript Results { sellerkey string Seller public key buyerkey string Buyer public key blocks number Locktime in number of blocks hash string Hash of the seed }
Reveals the private key corresponding to 'address'
Argument address string The BTC address for the private key Result key string The private key
Estimates current anchor cost with default fee, one input and one change output.
Argument feerate number Feerate (satoshis) per 1000 bytes (Default = 1000) Result cost number Estimated anchor cost (satoshis)
Return raw pubkey for Bitcoin address if in SPV wallet
Argument address string Bitcoin address Result pubkey string Raw pubkey hex
Returns the Bitcoin balance of the SPV wallet
Result amount number The total amount in BTC received in the SPV wallet
Returns the HTLC secret if available
Argument address string HTLC address Result secret string Returns HTLC seed
Creates and adds a Bitcoin address to the SPV wallet
Result address string Returns a new Bitcoin address
Return the raw transaction data
Argument txid string The transaction id Result data string The serialized, hex-encoded data for 'txid'
Reports tx confirmations (if any)...
Argument txhash string Hash of tx to look for Result count number Tx confirmations. Zero if not confirmed yet (mempooled?) and -1 if not found
List anchors (if any)
Arguments minBtcHeight number min btc height, optional (default = -1) maxBtcHeight number max btc height, optional (default = -1)" minConfs number min anchor confirmations, optional (default = -1) maxConfs number mimaxn anchor confirmations, optional (default = -1) Result array Returns array of anchors
List anchor auths (if any)
Result array Returns array of anchor auths
List anchor reward confirms (if any)
Result array Returns array of anchor confirms
List anchor rewards (if any)
Result array Returns array of anchor rewards
List anchors that have yet to be paid
Result array Returns array of unrewarded anchors
List pending anchors (if any). Pending anchors are waiting on
chain context to be fully validated, for example, anchors read
from SPV while the blockchain is still syncing.
Result array Returns array of pending anchors
List all outputs related to HTLC addresses in the wallet
Argument address string HTLC address to filter results Result array JSON array of transaction details txid string The transaction id vout number Output relating to the HTLC address\ address string HTLC address confirms number Number of confirmations spent JSON object containing spent info txid string Transaction id spending this output confirms number Number of spent confirmations
Returns an array of all Bitcoin transaction hashes
Result array array of string txid string The transaction id
Refunds all coins in HTLC address
Arguments scriptaddress string HTLC address destinationaddress string Destination for funds in the HTLC feerate number Feerate (satoshis) per KB (Default: 10000) Results { txid string The transaction id sendmessage string Send message result }
Rescan from block height.
Argument height number Block height or ('tip' minus 'height') if negative)
Sending raw tx to Bitcoin blockchain
Argument rawtx string The hex-encoded raw transaction with signature
Send a Bitcoin amount to a given address.
Arguments address string The Bitcoin address to send to amount number The amount in BTC to send. eg 0.1 feerate number Feerate (satoshis) per KB (Default: 10000) Results { txid string The transaction id sendmessage string Send message result }
Returns spv sync status
Results { connected bool Connection status current number Last synced block estimated number Estimated chain height (as reported by peers) }