All Projects → interlay → btc-relay-solidity

interlay / btc-relay-solidity

Licence: MIT license
Bitcoin Light Client on Ethereum

Programming Languages

typescript
32286 projects
solidity
1140 projects
javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to btc-relay-solidity

Relay Rails Blog
A graphql, relay and standard rails application powered demo weblog. We are using Graphql server and relay for our react component data needs.
Stars: ✭ 140 (+366.67%)
Mutual labels:  relay
Relay Visual Learners
An interactive diagram of Relay Classic.
Stars: ✭ 164 (+446.67%)
Mutual labels:  relay
Django Graphql Auth
Django registration and authentication with GraphQL.
Stars: ✭ 200 (+566.67%)
Mutual labels:  relay
Absinthe relay
Absinthe support for the Relay framework
Stars: ✭ 143 (+376.67%)
Mutual labels:  relay
Sonoff wifi switch
Прошивка для ESP8266 (Умный дом)-Firmware for ESP8266 (Smart Home)
Stars: ✭ 156 (+420%)
Mutual labels:  relay
Reactnavigationrelaymodern
React Navigation integration with Relay
Stars: ✭ 170 (+466.67%)
Mutual labels:  relay
Relayer
SMB Relay Attack Script
Stars: ✭ 136 (+353.33%)
Mutual labels:  relay
Awesome Relay
Awesome resources for Relay
Stars: ✭ 246 (+720%)
Mutual labels:  relay
Protostar Relay
Open-source iteration of the official Relay devtool.
Stars: ✭ 161 (+436.67%)
Mutual labels:  relay
Relay Workshop
Material for my Relay Workshop
Stars: ✭ 197 (+556.67%)
Mutual labels:  relay
Laravel Graphql
Facebook GraphQL for Laravel 5. It supports Relay, eloquent models, validation and GraphiQL.
Stars: ✭ 1,793 (+5876.67%)
Mutual labels:  relay
Reactconfbr
Public infos and issues about React Conf Brasil organization
Stars: ✭ 156 (+420%)
Mutual labels:  relay
Ws Tcp Relay
A simple relay between WebSocket clients and TCP servers
Stars: ✭ 186 (+520%)
Mutual labels:  relay
Isomorphic Relay Router
Adds server side rendering support to react-router-relay
Stars: ✭ 141 (+370%)
Mutual labels:  relay
Relay Compiler Language Typescript
A language plugin for Relay that adds TypeScript support, including emitting type definitions.
Stars: ✭ 201 (+570%)
Mutual labels:  relay
Wora
Write Once, Render Anywhere. typescript libraries: cache-persist, apollo-offline, relay-offline, offline-first, apollo-cache, relay-store, netinfo, detect-network
Stars: ✭ 138 (+360%)
Mutual labels:  relay
React Relay Offline
TypeScript library files for Relay Modern Offline
Stars: ✭ 169 (+463.33%)
Mutual labels:  relay
Isomorphic Relay
Adds server side rendering support to React Relay
Stars: ✭ 247 (+723.33%)
Mutual labels:  relay
Rescript Relay
Use Relay with ReasonML.
Stars: ✭ 214 (+613.33%)
Mutual labels:  relay
Graphql.js
A Simple and Isomorphic GraphQL Client for JavaScript
Stars: ✭ 2,206 (+7253.33%)
Mutual labels:  relay

BTC-Relay

Relevant Repositories

Our libs:

External libs:

Background

Chain Relays

Chain relays are on-chain programs or smart contracts deployed on a blockchain A capable of reading and verifying the state of another blockchain B. The underlying technical design and functionality is comparable to that of SPV-Clients. That is, a chain relay stores and maintains block headers of chain B on chain A and allows to verify transaction inclusion proofs. Summarizing, the two main functionalities a chain relay must/should provide are: consensus verification and transaction inclusion verification.

Read more about chain relays in the XCLAIM paper (Section V.B descibes the basic concept of chain relays, while Appendix B provides a formal model of the required functionality for PoW chain relays.).

Architecture

This project is an implementation of a chain relay for Bitcoin on Ethereum. The first implementation of a BTC relay was implemented in Serpent and can be found here. However, as Serpent is outdated (last commit: December 2017), this project aims to implement an updated version in Solidity.

Installation

Install dependencies:

yarn install

Build the contracts and interfaces:

yarn build

Testing

Run the tests:

yarn test

Run with eth-gas-reporter:

export COINMARKETCAP_API_KEY=*****
npx buidler node 
yarn test --network localhost

Gas Costs

npx buidler run scripts/metrics.ts
Function Gas Description
constructor 1796743 Genesis
submitBlockHeader 105299 1st Header
submitBlockHeader 105311 2nd Header
submitBlockHeader 105287 3rd Header
submitBlockHeader 105275 4th Header
submitBlockHeader 105299 5th Header
submitBlockHeader 105263 6th Header
submitBlockHeaderBatch 464777 Combined
verifyTx 62884 Inclusion

Summa Relay

Summa have also developed a Bitcoin relay in Solidity. There are a number of differences between the two approaches however. As summarized in the table below, their block submission is significantly cheaper compared to ours. This is primarily due to their more restrictive use of storage and separation of functionality - block submission, difficulty adjustment and fork selection are all separate calls. However, checking transaction inclusion is slightly more involved as the implementation needs to recurse backwards through all ancestors.

Interlay Summa Purpose Description
616782 403903 Submit 8 Block Headers
2397012 1520844 Submit 32 Block Headers
30462 32731 Inclusion Coinbase - Tx Depth 1
67240 69510 Inclusion Heavy (230 Txs) - Tx Depth 1
67326 79540 Inclusion Tx Depth 6
67326 102364 Inclusion Tx Depth 32

There are two primary motivations for our higher cost in block submission:

  1. The relay should be self-healing, requiring minimal user intervention.
  2. Constant time lookup - given a height we should be able to instantly verify inclusion.

Deployments

yarn deploy

Ropsten

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].