jcnelson/clarity-bitcoin

How to verify flash block btc transactions ?

friedger opened this issue ยท 6 comments

To verify bitcoin txs the burnchain header hash is verified using:
(get-block-info? burnchain-header-hash block-height)

For btc transactions in flash blocks, i.e. btc blocks that don't have corresponding stx blocks there is no way to verify the btc tx in clarity. Correct?

BTC blocks : |1| -- |2| -- |3| -- |4|
STX blocks:  |1| --     -- |2| -- |3|

Txs in BTC block 2 can't be verified.

Would (get-block-info? burnchain-header-hash 2) return the header hash of btc block 3?

(get-block-info? burnchain-header-hash X) takes a Bitcoin block height for X, so it should work. The Stacks node processes all Bitcoin blocks and has all their header hashes, even if some of them don't have Stacks blocks attached to them.

(get-block-info? burnchain-header-hash X) takes a Bitcoin block height for X

@jcnelson Does it?

Calling get-block-info with e.g. stacks block 11319 on
https://explorer.stacks.co/txid/ST2PABAF9FTAJYNFZH93XENAJ8FVY99RRM4DF2YCW.block-info?chain=testnet
returns

(tuple 
  (burnchain-header-hash (some 0x0000000000000020d1f8c2ef300d9590069396ff40611f16fd660ae74f86fc44)) 
  (header-hash (some 0x13588072c8b4eca88a505db5c453123c5c91db98d90ac1cd124402dba596531e)) 
  (id-header-hash (some 0xbb527bf66002e33ed82916c89b989448684040e69b46c8d09eab35c0ec3c440c)) 
  (miner-address (some ST2X2FYCY01Y7YR2TGC2Y6661NFF3SMH0NGXPWTV5)) 
  (time (some u1620494526)) 
  (vrf-seed (some 0xbf945361dbdbcb0a43e8d6984ab8eee14982d0341eab198fc74d2d917c6d95dc)))

The burnchain header hash is the hash of bitcoin block 1974723
https://www.blockchain.com/btc-testnet/block/0000000000000020d1f8c2ef300d9590069396ff40611f16fd660ae74f86fc44

Yes, you're right. I checked the code. Relevant issue: stacks-network/stacks-core#2663

To verify bitcoin txs the burnchain header hash is verified using:
(get-block-info? burnchain-header-hash block-height)

For btc transactions in flash blocks, i.e. btc blocks that don't have corresponding stx blocks there is no way to verify the btc tx in clarity. Correct?

BTC blocks : |1| -- |2| -- |3| -- |4|
STX blocks:  |1| --     -- |2| -- |3|

Txs in BTC block 2 can't be verified.

Would (get-block-info? burnchain-header-hash 2) return the header hash of btc block 3?

But anyway you can get the tx verification

To verify bitcoin txs the burnchain header hash is verified using:
(get-block-info? burnchain-header-hash block-height)

For btc transactions in flash blocks, i.e. btc blocks that don't have corresponding stx blocks there is no way to verify the btc tx in clarity. Correct?

BTC blocks : |1| -- |2| -- |3| -- |4|
STX blocks:  |1| --     -- |2| -- |3|

Txs in BTC block 2 can't be verified.

Would (get-block-info? burnchain-header-hash 2) return the header hash of btc block 3?

But anyway, can you get the tx verification of that flash block in the next Btc transaction?... I mean it's about a delay or you can never verify Bitcoin tx in the missed 2nd block?!... I am asking this bcuz for some Dapp you need to verify if a Btc transaction is done successfully or not!

@cryptopanter No, currently, you can get the bitcoin txs of btc blocks that are not an achor block of the stacks chain.

@cryptopanter No, currently, you can get the bitcoin txs of btc blocks that are not an achor block of the stacks chain.

We can or we can't?... ๐Ÿ‘‰ Anchor block...