BTC-Relay – BTC继电器区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,BTC-Relay – BTC继电器区块链毕设代写 是一篇很好的国外资料

BTC-Relay

Relevant Repositories

Our libs:

  • https://github.com/interlay/compressed-inclusion-proofs
  • https://github.com/crossclaim/btcrelay-sol

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

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

  • 0x5f01D00210A292aedD74322Acb6704E9731F5d48

BTC中继

相关存储库

我们的LIB:

  • https://github.com/interlay/compressed-inclusion-proofs
  • https://github.com/crossclaim/btcrelay-sol

外部LIB:

  • SummaBTCSPV库:https://github.com/summa-tx/bitcoin-spv/tree/master/solidity
  • SummaBTC中继:https://github.com/summa-tx/relays/tree/master/solidity
  • 原件[已弃用]BTC继电器:https://github.com/ethereum/btcrelay/tree/develop/fetchd

后台

链中继

链中继是部署在区块链blockchaina上的链上程序或智能合约,能够读取和验证另一个区块链blockchainB的状态。其基础技术设计和功能与SPV客户相当。也就是说,链中继存储并维护链a上链B的块头,并允许验证事务包含证明。总之,链中继必须/应该提供的两个主要功能是:一致性验证和事务包含验证。

阅读XCLAIM论文中有关链式继电器的更多信息(第V.B节描述了链式继电器的基本概念,而附录B提供了功率链式继电器所需功能的正式模型)。

架构

本项目是以太坊ethBTC链中继的实现。BTC中继的第一个实现是在Serpent中实现的,可以在这里找到。然而,由于Serpent已经过时(最后一次提交时间:2017年12月),本项目的目标是实现可靠的更新版本。

安装

安装依赖项:

yarn install

构建合同和接口:

yarn build

天然气成本

运行测试:

yarn test

与eth gas reporter一起运行:

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

Summa中继

npx buidler run scripts/metrics.ts
Function Gas Description
1796743 创创世纪 提交的锁头
105299 第一头 第1头
第3头 105275 第四个头
submitBlockHeader 105299 3rd Header
616782 403903 提交
8个区块头 8个区块头 2397012
1520844 32个区块头 30462个
32731个 69510 包括
重型(230个)重型(230个)重型(230个Txs)的包含和德克萨斯州深度1 67326 79540

部署

Summa还开发了一个可靠的BTC中继。然而,这两种方法之间有许多不同之处。正如下表所总结的,他们的区块提交比我们的要便宜得多。这主要是因为它们对存储和功能分离的使用更为严格——块提交、难度调整和分叉选择都是单独的调用。然而,检查事务包含的工作要稍微多一些,因为实现需要在所有祖先中向后递归。

Interlay Summa Purpose Description
包含 Tx深度6 67326 102364
包含 Tx深度32 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

我们提高区块提交成本有两个主要动机:

  1. 继电器应该是自愈式的,需要最少的用户干预。
  2. 恒定时间查找-给定高度,我们应该能够立即验证包含情况。

Ropsten

yarn deploy

Ropsten

  • 0x5F01D0210A292AEDD74322AACB6704E9731F5D4848

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/16612.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » BTC-Relay – BTC继电器区块链毕设代写

提供最优质的资源集合

立即查看 了解详情