Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to verify flash block btc transactions ? #1

Open
friedger opened this issue May 18, 2021 · 6 comments
Open

How to verify flash block btc transactions ? #1

friedger opened this issue May 18, 2021 · 6 comments

Comments

@friedger
Copy link

friedger commented May 18, 2021

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?

@jcnelson
Copy link
Owner

(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.

@friedger
Copy link
Author

(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

@jcnelson
Copy link
Owner

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

@cryptopanter
Copy link

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!

@friedger
Copy link
Author

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

@cryptopanter
Copy link

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants