Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@interlay/btc-relay-sol
Advanced tools
Readme
Our libs:
External libs:
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:
yarn install
Build the contracts and interfaces:
yarn build
Run the tests:
yarn test
Run with eth-gas-reporter:
export COINMARKETCAP_API_KEY=*****
npx buidler node
yarn test --network localhost
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 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:
yarn deploy
FAQs
BTC Relay in Solidity
The npm package @interlay/btc-relay-sol receives a total of 17 weekly downloads. As such, @interlay/btc-relay-sol popularity was classified as not popular.
We found that @interlay/btc-relay-sol demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.