SatoshiPortal / cyphernode

Modular Bitcoin full-node microservices API server architecture and utilities toolkit to build scalable, secure and featureful apps and services without trusted third parties
MIT License
363 stars 68 forks source link

Add "gettxoutproof" endpoint #168

Closed FrancisPouliot closed 2 years ago

FrancisPouliot commented 4 years ago

This is useful for claiming pegins with elements

gettxoutproof ["txid",...] ( "blockhash" )

Returns a hex-encoded proof that "txid" was included in a block.

NOTE: By default this function only works sometimes. This is when there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option or specify the block in which the transaction is included manually (by blockhash).

Arguments:

  1. txids (json array, required) A json array of txids to filter [ "txid", (string) A transaction hash ... ]
  2. blockhash (string, optional) If specified, looks for txid in the block with this hash

Result: "data" (string) A string that is a serialized, hex-encoded data for the proof.

phillamy commented 2 years ago

Is there more to this issue than adding the endpoint and calling the watcher node with https://bitcoincore.org/en/doc/0.16.0/rpc/blockchain/gettxoutproof/ ?

Kexkey commented 2 years ago

Indeed, I think it's a pretty straightforward feature that will simply delegate the request to Bitcoin Core. I guess for Cyphernode v0 API, it's ok to just respond as is Bitcoin Core's response.

Kexkey commented 2 years ago

https://github.com/SatoshiPortal/cyphernode/pull/234