Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@interlay/btc-relay-sol
Advanced tools
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
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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.