Coder Social home page Coder Social logo

georgeyou666 / bitcoin-spv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from summa-tx/bitcoin-spv

0.0 0.0 0.0 4.79 MB

utilities for Bitcoin SPV proof verification on (many!) other chains

License: Other

Shell 0.13% JavaScript 35.50% Python 2.53% C 22.67% Go 13.16% Rust 16.51% Makefile 0.20% Solidity 9.31%

bitcoin-spv's Introduction

bitcoin-spv

bitcoin-spv is a low-level toolkit for working with Bitcoin from other blockchains. It supplies a set of pure functions that can be used to validate almost all Bitcoin transactions and headers, as well as higher-level functions that can evaluate header chains and transaction inclusion proofs.

It also supplies a standardized JSON format for proofs. Currently off-chain proof (de)serialization is supported in Golang, Python, and JS.

Supported by

Binance X Fellowship, Interchain Foundation, Summa, Cross Chain Group


What smart contract chains are supported?

We have well-tested implementations in Solidty, ES6+ (JS), and golang. These support any EVM-based chain (Ethereum, Celo, and others), as well as projects based on Lotion and the Cosmos SDK. Our ES6+ work will also work on Agoric's SES-based smart contract system at launch.

Quickstart guide:

There really isn't one. Using these tools requires in-depth knowledge of the Bitcoin transaction format. The implementations include setup and development instructions. If you have a project in mind, feel free to reach out and ask questions.

IMPORTANT WARNING

It is extremely easy to write insecure code using these libraries. We do not recommend a specific security model. Any SPV verification involves complex security assumptions. Please seek external review for your design before building with these libraries.

A note about versioning

Implementations are versioned separately. I.e. there is no consistent feature set for a given version number. Wherever possible we use SemVer. Because go's versioning system is ridiculous, all releases are minor bumps, even when they should be major bumps.

This may change in future releases.

At time of writing the following versions are roughly equivalent:

  • Go v1.4.0
  • JS v4.0.0
  • rust v3.0.0
  • py v3.0.0

Versions older than these have incompatible JSON Proof and Header formats.

Bitcoin Endianness Gotchas

Block explorers tend to show txids and merkle roots in big-endian (BE) format. Most human-facing apps do this as well. However, due to Satoshi's inscrutable wisdom, almost all in-protocol data structures use little-endian (LE) byte order.

When pulling txids and merkle nodes, make sure the endianness is correct

  1. They should be in LE for the proof construction
  2. They need to be in LE for hashing
  3. They are in LE in the merkle tree

bitcoin-spv's People

Contributors

prestwich avatar erinhales avatar dominiquejane avatar barbaraliau avatar dependabot[bot] avatar nkuba avatar dylanlott avatar sr-gi avatar tynes avatar k06a avatar ewilz avatar rrybarczyk avatar ctebbe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.