Skip to content

SPV RPC Calls

Peter John Bushnell edited this page Apr 1, 2021 · 2 revisions

[spv_claimhtlc](#spv_claimhtlc) [spv_createanchor](#spv_createanchor) [spv_createanchortemplate](#spv_createanchortemplate) [spv_createhtlc](#spv_createhtlc) [spv_decodehtlcscript](#spv_decodehtlcscript) [spv_dumpprivkey](#spv_dumpprivkey) [spv_estimateanchorcost](#spv_estimateanchorcost) [spv_getaddresspubkey](#spv_getaddresspubkey) [spv_getbalance](#spv_getbalance) [spv_gethtlcseed](#spv_gethtlcseed) [spv_getnewaddress](#spv_getnewaddress) [spv_getrawtransaction](#spv_getrawtransaction) [spv_gettxconfirmations](#spv_gettxconfirmations) [spv_listanchors](#spv_listanchors) [spv_listanchorauths](#spv_listanchorauths) [spv_listanchorrewardconfirms](#spv_listanchorrewardconfirms) [spv_listanchorrewards](#spv_listanchorrewards) [spv_listanchorsunrewarded](#spv_listanchorsunrewarded) [spv_listanchorspending](#spv_listanchorspending) [spv_listhtlcoutputs](#spv_listhtlcoutputs) [spv_listtransactions](#spv_listtransactions) [spv_refundhtlc](#spv_refundhtlc) [spv_rescan](#spv_rescan) [spv_sendrawtx](#spv_sendrawtx) [spv_sendtoaddress](#spv_sendtoaddress) [spv_syncstatus](#spv_syncstatus)

      1. spv_claimhtlc
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  

}

      1. spv_createanchor
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

      1. spv_createanchortemplate
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)

      1. spv_createhtlc
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 hash string SHA256 hash of the seed timeout string Timeout of the contract (denominated in blocks) relative to its placement in the blockchain

Results {

    address               string    The value of the new Bitcoin address.  
    redeemscript          string    The string value of the hex-encoded redemption script  

}

      1. spv_decodehtlcscript
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  

}

      1. spv_dumpprivkey
Reveals the private key corresponding to 'address'

Argument address string The BTC address for the private key

Result key string The private key