Code Monkey home page Code Monkey logo

btc-parachain's Introduction

BTC-Parachain

A trust-minimized bridge from Bitcoin to Polkadot.
Explore the specification »

Report Bug · Request Feature

This repository is hosted on GitLab: https://gitlab.com/interlay/btc-parachain with a mirror on GitHub.

This project is currently under active development.

Table of Contents

About the Project

This is a proof of concept implementation of a BTC Parachain to bring Bitcoin into the Polkadot universe. It allows the creation of PolkaBTC, a fungible token that represents Bitcoin in the Polkadot ecosystem. PolkaBTC is backed by Bitcoin 1:1 and allows redeeming of the equivalent amount of Bitcoins by relying on a collateralized third-party.

The project uses the concept of Cryptocurrency-backed Assets to lock Bitcoin on the Bitcoin blockchain and issue BTC-backed tokens on the BTC Parachain. The implementation is based on the BTC Parachain specification.

Built with

The BTC-Parachain is built with:

Roadmap

The Substrate runtime makes use of various custom pallets that are found in the crates folder.

Development status: Alpha

Development Progess

  • bitcoin: [Alpha] Library for Bitcoin type, parsing and verification functions.
  • btc-relay: [Alpha] Stateful SPV client for Bitcoin. Stores Bitcoin main chain, tracks forks, verifies Merkle proofs and validates specific transaction formats.
  • collateral [Alpha] Handles locking, releasing and slashing of collateral (e.g. DOT).
  • exchange-rate-oracle: [Alpha] Exchange rate oracle. Integration with external provider pending.
  • issue: [Alpha] Handles issuing of PolkaBTC.
  • redeem [Alpha] Handles redeeming of PolkaBTC for BTC on Bitcoin.
  • replace [Alpha] Handles replacing vaults.
  • security: [Alpha] Security module, handling BTC Parachain status changes (error handling).
  • staked-relayers: [Alpha] Handles registration and stake of Staked Relayers, as well as voting on Parachain status changes.
  • treasury: [Alpha] Exposes functions related to handling of the PolkaBTC currency (mint, lock, burn)
  • vault-registry: [Alpha] Handles registration, collateral and liquidation of Vaults.

Getting started

Prerequisites

curl https://sh.rustup.rs -sSf | sh

Installation

Building requires nightly. Run the following commands to set it up:

rustup toolchain install nightly-2021-01-25
rustup default nightly-2021-01-25
rustup component add rustfmt
rustup component add rls
rustup toolchain install nightly
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-01-25

To build, run:

cargo build

For more detailed development instructions see here.

Testing

cargo test

To run with coverage, using cargo-cov:

cargo install cargo-cov

# clean up previous coverage result
cargo cov clean

# test the code
cargo cov test

# open the coverage report
cargo cov report --open

Running

To run a local development node, use the dev chain spec.

cargo run --release -- --dev

Clear the database using the purge-chain command.

cargo run --release -- purge-chain --dev

To disable all btc-relay block inclusion checks, use the special dev-no-btc chain spec. This is useful for testing without the overhead of running a block relayer.

cargo run --release -- --alice --chain dev-no-btc --rpc-cors all --validator --force-authoring --tmp

Additional CLI usage options are available and may be shown by running cargo run -- --help.

Test Coverage

Test coverage reports available under docs/testcoverage.html

Substrate Chain Configuration

The Substrate runtime configuration is in the parachain folder.

Javascript / Typescript

When interacting via polkadot{.js} you will need to use our custom types. Please also checkout polkabtc-js for a more complete (strongly-typed) library with bitcoinjs-lib integration.

Contributing

If you would like to contribute, please file an issue on GitLab or reach out to us.

We are hiring!

License

(C) Copyright 2020 Interlay Ltd

BTC-Parachain is currently licensed under the terms of the Apache License (Version 2.0). See LICENSE

Contact

Website: Interlay.io

Twitter: @interlayHQ

Email: [email protected]

Acknowledgements

This project is supported by a Web3 Foundation grant.

We would also like to thank the following teams for their continuous support:

btc-parachain's People

Contributors

alexeizamyatin avatar danhper avatar daniel-savu avatar gregdhill avatar jaupe avatar lederstrumpf avatar ns212 avatar nud3l avatar sander2 avatar thecodingrobot avatar

Watchers

 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.