Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.

interlay/btc-relay-solidity

Repository files navigation

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

BTCRelay-Sol

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:

npm install

Build the contracts and interfaces:

npm run build

Testing

Run the tests:

npm test

Deployments

Gas Costs

Function Gas Description
constructor 1772513 Genesis
submitBlockHeader 107385 1st Header
submitBlockHeader 107397 2nd Header
submitBlockHeader 107373 3rd Header
submitBlockHeader 107361 4th Header
submitBlockHeader 107385 5th Header
submitBlockHeader 107349 6th Header
submitBlockHeaderBatch 477365 Combined
verifyTx 62949 Inclusion

Ropsten

0x78A389B693e0E3DE1849F34e70bf4Bcb57F0F2bb