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

[BREAKING] fix: prevent spv attack by checking coinbase proof #1112

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

sander2
Copy link
Member

@sander2 sander2 commented Jun 28, 2023

  • To-do: decide what we want to do with the bitcoin data. It's now only 2700 or so blocks, and already 60+ megabytes..
    • Decided to do only 2 txs per blocks. Now the dataset is about 11 mb for > 2*2016 blocks

Closes #1073

@sander2 sander2 force-pushed the fix/spv2 branch 2 times, most recently from 80b109c to 13a9767 Compare July 6, 2023 07:54
Copy link
Member

@gregdhill gregdhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of my comments are non-blocking but requesting changes specifically only for adding documentation and cleaning up the unused code. All other comments are mostly nitpicks, but in general the solution looks good.

scripts/fetch_bitcoin_data.py Show resolved Hide resolved
crates/issue/src/lib.rs Outdated Show resolved Hide resolved
crates/bitcoin/src/types.rs Show resolved Hide resolved
crates/bitcoin/src/types.rs Show resolved Hide resolved
crates/replace/src/lib.rs Outdated Show resolved Hide resolved
crates/btc-relay/src/lib.rs Outdated Show resolved Hide resolved
crates/btc-relay/src/tests.rs Outdated Show resolved Hide resolved
crates/bitcoin/src/parser.rs Show resolved Hide resolved
crates/bitcoin/src/types.rs Show resolved Hide resolved
crates/bitcoin/src/parser.rs Show resolved Hide resolved
@gregdhill
Copy link
Member

I also verified that we can indeed use the first txid returned by esplora to get the coinbase transaction.

Here's a quick one-liner to check that via curl (docs):

curl -s https://blockstream.info/api/tx/$(curl -s https://blockstream.info/api/block/$(curl -s https://blockstream.info/api/block-height/799160)/txids | jq -r '.[0]') | jq '.vin'

@gregdhill gregdhill merged commit 23eac03 into interlay:master Jul 19, 2023
2 checks passed
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

Successfully merging this pull request may close these issues.

Leaf-Node weakness in Bitcoin Merkle Tree Design
2 participants