bitcoin-canister icon indicating copy to clipboard operation
bitcoin-canister copied to clipboard

Add a dedicated function to get the tip height and header?

Open 4c656554 opened this issue 8 months ago • 4 comments

A suggestion to add a function to get the current best tip (both height and header):

Whilst I think this can be done using the forthcoming get_block_headers_request, it requires processing by the receiver; this would be simpler to use.

Candid:

type bitcoin_block_header = Blob;

type get_tip_result = {
  tip_height: Nat32;
  tip_block_header: bitcoin_block_header;
};

func bitcoin_get_tip(): (get_tip_result);

Alternatively, perhaps changing get_block_headers_request so that, with start_height at 2^{32} - 1 for example, it could yield just the tip.

Finally, perhaps it should also return any competing tips, or some kind of confidence indicator.

Thank you


Related: https://github.com/dfinity/bitcoin-canister/pull/297#issue-2297252023 https://github.com/dfinity/bitcoin-canister/pull/298 https://github.com/dfinity/bitcoin-canister/issues/292 https://github.com/dfinity/bitcoin-canister/issues/269

4c656554 avatar Jun 07 '24 09:06 4c656554