Our libs:
External libs:
- Summa Bitcoin SPV library: https://github.com/summa-tx/bitcoin-spv/tree/master/solidity
- Summa Bitcoin Relay: https://github.com/summa-tx/relays/tree/master/solidity
- Original [Deprecated] BTC-Relay: https://github.com/ethereum/btcrelay/tree/develop/fetchd
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.).
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.
Install dependencies:
npm install
Build the contracts and interfaces:
npm run build
Run the tests:
npm test
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 |
0x78A389B693e0E3DE1849F34e70bf4Bcb57F0F2bb