Optics – 光学元件区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Optics – 光学元件区块链毕设代写 是一篇很好的国外资料

Optics

OPTimistic Interchain Communication

Overview

Optics is a cross-chain communication system. It handles passing raw buffers between blockchains cheaply, and with minimal fuss. Like IBC and other cross-chain communication systems, Optics creates channels between chains, and then passes its messages over the channel. Once a channel is established, any application on the chain can use it to send messages to any other chain.

Compared to IBC and PoS light client based cross-chain communication, Optics has weaker security guarantees, and a longer latency period. However, Optics may be implemented on any smart contract chain, with no bespoke light client engineering. Because it does not run a light client, Optics does not spend extra gas verifying remote chain block headers.

In other words, Optics is designed to prioritize:

  • Cost: No header verification or state management.
  • Speed of implementation: Requires only simple smart contracts, no complex cryptography.
  • Ease of use: Simple interface for maintaining XApp connections.

You can read more about Optics’ architecture at Celo’s main documentation site.

Integrating with Optics

Optics establishes communication channels with other chains, but it’s up to XApp (pronounced “zap”, and short for “cross-chain applications”) developers to use those. This repo provides a standard pattern for integrating Optics channels, and ensuring that communication is safe and secure.

Integrations require a few key components:

  • A Home and any number of Replica contracts deployed on the chain already. These contracts manage Optics communication channels. and will be used by the XApp to send and receive messages.

  • A XAppConnectionManager (in solidity/optics-core/contracts). This contract connects the XApp to Optics by allowing the XApp admin to enroll new Home and Replica contracts. Enrolling and unenrolling channels is the primary way to ensure that your XApp handles messages correctly. XApps may deploy their own connection manager, or share one with other XApps.

  • A Message library. Optics sends raw byte arrays between chains. The XApp must define a message specification that can be serialized for sending, and deserialized for handling on the remote chain

  • A Router contract. The router translates between the Optics cross-chain message format, and the local chain’s call contract. It also implements the business logic of the XApp. It exposes the user-facing interface, handles messages coming in from other chains, and dispatches messages being sent to other chains.

Solidity developers interested in implementing their own Message library and Router contract should check out the optics-xapps package. It contains several example XApps.

You can find current testnet deploy configurations in the rust/config/ directory. These deployments happen frequently and are unstable. Please feel free to try out integrations using the deployed contracts in the LATEST config.

It is Strongly Recommended that XApp admins run a watcher daemon to maintain their XAppConnectionManager and guard from fraud. Please see the documentation in the rust/ directory and the Optics architecture documentation for more details.

Working on Optics

Commit signature verification

Commits (and tags) for this repo require signature verification. If you’d like to contribute to Optics, make sure that your commits are signed locally.

Pre-commit hooks

Set up your pre-commit hook:

echo "./pre-commit.sh" > .git/hooks/pre-commit chmod +x .git/hooks/pre-commit

Note: In the event you need to bypass the pre-commit hooks, pass the --no-verify flag to your git commit command

Solidity

  1. Install dependencies

    cd solidity/optics-core npm i cd ../optics-xapps npm i
  2. Setup your .env files

    cd typescript/optics-deploy touch .env && cat .env.example > .env cd ../../solidity/optics-core touch .env && cat .env.example > .env cd ../optics-xapps touch .env && cat .env.example > .env

    Then, add values to the keys in the newly created .env files.

  3. Install jq

    brew install jq

      OR  

    sudo apt-get install jq
  4. Install solhint

    npm install -g solhint // to check it is installed: solhint --version

Rust

  • install rustup
  • see rust/README.md

Building Agent Images

There exists a docker build for the agent binaries. These docker images are used for deploying the agents in a production environment.

$ cd rust $ ./build.sh <image_tag> $ ./release.sh <image_tag> 

What is Optics?

We present Optics – a system for sending messages between consensus systems without paying header validation costs by creating the illusion of cross-chain communication. Similar to an atomic swap, Optics uses non-global protocol validation to simulate cross-chain communication. Optics can carry arbitrary messages (raw byte vectors), uses a single-producer multi-consumer model, and has protocol overhead sublinear in the number of messages being sent.

Key Points

System sketch:

  1. A “home” chain commits messages in a merkle tree
  2. A bonded “updater” attests to the commitment
  3. The home chain ensures the attestation is accurate, and slashes if not
  4. Attested updates are replayed on any number of “replica” chains, after a time delay

As a result, one of the following is always true:

  1. All replicas have a valid commitment to messages from the home chain
  2. Failure was published before processing, and the updater can be slashed on the home chain

This guarantee, although weaker than header-chain validation, is still likely acceptable for most applications.

Summary

Optics is a new strategy for simulating cross-chain communication without validating headers. The goal is to create a single short piece of state (a 32-byte hash) that can be updated regularly. This hash represents a merkle tree containing a set of cross-chain messages being sent by a single chain (the “home” chain for the Optics system). Contracts on the home chain can submit messages, which are put into a merkle tree (the “message tree”). The message tree’s root may be transferred to any number of “replica” chains.

Rather than proving validity of the commitment, we put a delay on message receipt, and ensure that failures are publicly visible. This ensures that participants in the protocol have a chance to react to failures before the failure can harm them. Which is to say, rather than preventing the inclusion of bad messages, Optics guarantees that message recipients are aware of the inclusion, and have a chance to refuse to process them.

To produce this effect, the home chain designates a single “updater.” The updater places a bond ensuring her good behavior. She is responsible for producing signed attestations of the new message tree root. The home chain accepts and validates these attestations. It ensures that they extend a previous attestation, and contain a valid new root of the message set. These attestations are then sent to each replica.

The replica accepts an update attestation signed by the updater, and puts it in a pending state. After a timeout, it accepts the update from that attestation and stores a new local root. Because this root contains a commitment of all messages sent by the home chain, these messages can be proven (using the replica’s root) and then dispatched to contracts on the replica chain.

The timeout on new updates to the replica serves two purposes:

  1. It ensures that any misbehavior by the updater is published in advance of message processing. This guarantees that data necessary for home chain slashing is available for all faults.
  2. It gives message recipients a chance to opt-out of message processing for the update. If an incorrect update is published, recipients always have the information necessary to take defensive measures before any messages can be processed.

test: BridgeMessage library (


光学

乐观链间通信是一种跨链通信系统。它处理区块链blockchain之间的原始缓冲区传递,成本低廉,而且不费吹灰之力。与IBC和其他跨链通信系统一样,光学系统在链之间创建通道,然后通过通道传递信息。一旦建立了通道,链上的任何应用程序都可以使用它向任何其他链发送消息

概述

与基于IBC和PoS light客户端的跨链通信相比,光纤的安全保障较弱,延迟时间更长。然而,光学可以在任何智能合同链上实施,而无需定制的轻型客户工程。因为它不运行轻型客户端,所以Optics不会花费额外的gas来验证远程链块头

换句话说,光学系统的设计是为了优先考虑:

您可以在Celo的主要文档站点上阅读更多关于光学系统架构的信息

  • 成本:无头验证或状态管理
  • 实现速度:只需要简单的智能合约,不需要复杂的密码
  • 易用性:用于维护XApp连接的简单界面

Optics建立了与其他链的通信渠道,但使用这些渠道取决于XApp(发音为“zap”,是“跨链应用程序”的缩写)开发人员。该回购协议提供了集成光学通道的标准模式,并确保通信安全可靠

与光学集成

集成需要几个关键组件:

一个主目录和已部署在链上的任意数量的副本契约。这些合同管理光纤通信信道。和将被XApp用于发送和接收消息

  • 链上已经部署了一个主目录和任意数量的副本契约。这些合同管理光纤通信信道。和将被XApp用于发送和接收消息
  • XAppConnectionManager(在实体/光学核心/合同中)。该合同允许XApp管理员注册新的主合同和副本合同,从而将XApp连接到光学设备。注册和取消注册通道是确保XApp正确处理消息的主要方法。XAPP可以部署自己的连接管理器,或者与其他XAPP共享一个连接管理器
  • 安装依赖项cd solidity/optics core npm i cd../optics xapps npm i
  • 安装jq brew安装jq或sudo apt get Install jq

强烈建议XApp管理员运行一个监视程序守护程序,以维护其XAppConnectionManager并防止欺诈。有关更多详细信息,请参阅rust/目录中的文档和光学体系结构文档

此回购的提交(和标记)需要签名验证。如果您想为Optics做出贡献,请确保您的提交是在本地签名的

设置预提交挂钩:

在光学上工作

提交签名验证

注意:如果需要绕过预提交挂钩,请将–no-verify标志传递给git-commit命令

预提交挂钩

安装依赖项

echo "./pre-commit.sh" > .git/hooks/pre-commit chmod +x .git/hooks/pre-commit

设置.env文件

建筑代理图像

  1. 安装solhint npm Install-g solhint//检查是否已安装:solhint–version
  2. 安装rustup
  3. 一个“主”链在merkle树中提交消息
  4. 一个绑定的“更新程序”证明了这一承诺

什么是光学

  • 主链确保认证准确,如果没有,斜杠将在任何数量的“副本”链上重播认证更新,经过一段时间延迟后
  • 所有副本对来自主链的消息具有有效承诺

关键点

因此,以下情况之一始终是正确的:

$ cd rust $ ./build.sh <image_tag> $ ./release.sh <image_tag> 

摘要

此保证虽然弱于收割台链验证,但对于大多数应用程序来说仍然可以接受

Key Points

光学是一种模拟跨链通信而不验证报头的新策略。目标是创建一个可以定期更新的单条短状态(32字节哈希)。该散列表示一个merkle树,其中包含一组由单链(光学系统的“主”链)发送的跨链消息。主链上的合同可以提交消息,这些消息被放入merkle树(“消息树”)。消息树的根可以传输到任意数量的“副本”链

  1. 在处理之前发布失败,并且可以在主链上删除更新程序
  2. 它确保在消息处理之前发布更新程序的任何错误行为。这保证了主链删除所需的数据可用于所有故障
  3. 它使邮件收件人有机会选择退出更新的邮件处理。如果发布了不正确的更新,收件人在处理任何邮件之前,始终拥有采取防御措施所需的信息
  4. Attested updates are replayed on any number of “replica” chains, after a time delay

我们并没有证明承诺的有效性,而是延迟了消息接收,并确保失败是公开可见的。这确保了协议的参与者有机会在故障对他们造成伤害之前对故障作出反应。也就是说,Optics并没有阻止包含坏消息,而是保证消息接收者知道包含坏消息,并有机会拒绝处理它们

  1. All replicas have a valid commitment to messages from the home chain
  2. Failure was published before processing, and the updater can be slashed on the home chain

为了产生这种效果,主链指定一个“更新者”。更新者放置一个保证其良好行为的契约。她负责生成新消息树根的签名证明。home chain接受并验证这些证明。它确保它们扩展以前的证明,并包含消息集的有效新根。然后将这些证明发送到每个副本

Summary

副本接受更新程序签署的更新证明,并将其置于挂起状态。超时后,它接受来自该证明的更新并存储新的本地根。由于此根目录包含主链发送的所有消息的承诺,因此可以验证这些消息(使用副本的根目录),然后将其发送到副本链上的合同

副本新更新的超时有两个目的:

To produce this effect, the home chain designates a single “updater.” The updater places a bond ensuring her good behavior. She is responsible for producing signed attestations of the new message tree root. The home chain accepts and validates these attestations. It ensures that they extend a previous attestation, and contain a valid new root of the message set. These attestations are then sent to each replica.

The replica accepts an update attestation signed by the updater, and puts it in a pending state. After a timeout, it accepts the update from that attestation and stores a new local root. Because this root contains a commitment of all messages sent by the home chain, these messages can be proven (using the replica’s root) and then dispatched to contracts on the replica chain.

The timeout on new updates to the replica serves two purposes:

  1. It ensures that any misbehavior by the updater is published in advance of message processing. This guarantees that data necessary for home chain slashing is available for all faults.
  2. It gives message recipients a chance to opt-out of message processing for the update. If an incorrect update is published, recipients always have the information necessary to take defensive measures before any messages can be processed.

test: BridgeMessage library (

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情