当前位置:网站首页>Overview of cross chain protocol IBC

Overview of cross chain protocol IBC

2022-06-13 07:58:00 Boiled soybeans in brine

Cross Chain Protocol IBC summary

One . What is? IBC?

IBC Is the abbreviation of inter chain communication protocol (Inter-Blockchain Communication Protocol). Transfer data and status information between multiple different blockchain networks through packet exchange . The original use is more through IBC The protocol realizes cross chain token transfer .
IBC The goal of is to transfer application information between two independent seven layer networks , So we need something outside the chain relay Put packets in the chain A And chain B Relay between networks . chain B Receive the chain A The data must be able to independently verify the supporting information it contains , This proof represents the chain A A certain state on ( And its corresponding operation ) Authenticity . In order to make IBC The agreement works , Must rely on the underlying trust mechanism , Trust the chain A And chain B In their respective consensus algorithms , Also believe in light client authentication , Through the verification of block header information , Prove what happened on the blockchain .

Two . How to achieve IBC?

1. The life cycle of the connection

1.1 Establishing a connection

Between the two chains, we must first establish “ Connect ”, That is, the initial trust relationship ; At the moment when the connection is established, the two chains need to exchange basic trust data ( Trust root )-- Yes PoS A network is a set of verifiers' public keys in two chains , The trust root must be verifiable by a third party .

1.2 Keep connected

During the whole connection period, it is necessary to continuously obtain the new block of the other party , Based on trust root and continuous block header , The block height of the other party when the connection is established , Continuously verify the correctness of subsequent block heads at any height ; These block headers are validation IBC The basis of trust for packets .

1.3 disconnect

When a bifurcation or security event occurs , Close the connection in time ; This can be triggered by chain governance or automatic cheating detection .

2. Data packets 、 Receipt and timeout processing

2.1 Data packets

Is made up of metadata ( Data header ) And opaque data payload ( Data body ) Composed of messages . The data header contains the type 、 Sequence number 、 Source chain ID、 Target chain ID、 Timeout parameters ; The data body contains data that needs to be understood and processed by the blockchain application layer , That is, the proof of the source chain state change .

2.2 receipt

yes “ reverse ” Data packets ,B The chain receives and processes data from A After the packet of the chain , Will give A Send a corresponding receipt .

2.3 timeout handler

The source chain sends packets , You can specify a timeout parameter represented by the block height or timestamp on the target chain in the data header ; The target chain will not process the received timeout packets , If the source chain does not receive a receipt after the packet sent times out , It will roll back the state on the chain corresponding to the packet .

3. Strictly ordered messaging

To make the whole system work , The delivery of packets must maintain strict global ordering :
· The consensus algorithm ensures that the processing of transactions on the chain follows a single precise sorting .
· IBC The protocol ensures that messages about the processing status of on chain transactions follow a single precise ordering in the process of cross chain transmission .
· IBC Using the channel mechanism to achieve sorting control : Each chain maintains both send and receive channels for each connection , Each channel maintains a counter , The counter of the sending channel generates the sequence number for the outgoing message , The counter of the receiving channel is used to verify the sequence number of the incoming message .
· Strict sequencing guarantee is a prerequisite for deriving global state consistency .

4. Consensus requires

IBC Protocol security requires the finality of consensus algorithm to prevent double blossom , The final performance of different consensus algorithms is different :
· Tendermint and PBFT Class consensus algorithm satisfies the real-time finality ( optimal )
· Ethereal Casper FFG Consensus algorithms provide fast finality
· Bitcoin consensus algorithm (PoW, Tezos) Provide probability finality , The application layer needs to select a security threshold

3、 ... and .Cosmos IBC relayer

relayer The software package contains a basic repeater implementation , You want to enable IBC Relay packets between chain groups / User use of data

The repeater supports the following functions :

  • establish / to update IBC Tendermint light Customer
  • establish IBC Connect
  • establish IBC Transfer channels .
  • Start cross chain transfer
  • Relay cross chain transfer transactions , Its acknowledgement and timeout
  • Relay from status
  • Relay from stream events
  • send out IBC Interrupt the upgrade UpgradePlan Suggest
  • In the trade on the bracelet on IBC Upgrade customer after major change upgrade

The repeater is currently unable to :

  • Use user selected parameters ( for example UpgradePath) Create client
  • Submit IBC Customer unfreezing suggestions
  • Monitor and submit misconduct to customers
  • Use to divide Tendermint In addition to the IBC light client , for example Solo Machine
  • Connect to not implemented / not enabled IBC Chain
  • Use different IBC Implement connection to chain ( Chain not used SDK Of x/ibc modular )

Four .IBC Cross chain transfer process

IBC It belongs to Cosmos-SDK A special module in . It's special , Mainly reflected in IBC It provides cross chain capabilities between blockchains

If A On the chain Alice Need to send 10 individual ATOM Token to B On the chain Bob On , It will go through the following four steps

  • Tracking

A On the chain IBC The modules will be synchronized continuously B Block header information on the chain ,B On the chain IBC Empathy . In this way , Both parties can track the changes of the verifier set on each other's blockchain , In essence , Namely A chain 、B Chains maintain each other's light nodes

  • Bonding

When using IBC After initializing a cross chain transfer ,A On the chain 10 individual ATOM In fact, it is locked
 Insert picture description here

  • Proof relay

A certificate A The chain is locked 10ATOM Of “ evidence ” Will be routed to B On the chain IBC modular
 Insert picture description here

  • Verify

B Chain combination A Light node information of the chain , Yes, this one “ evidence ” After passing the verification ,B Chain meeting “ Casting ”10 Share ATOM Voucher( Coupons ), these Voucher It can be used for subsequent circulation . Of course these Voucher You can also return to by the same cross chain method A chain ,A On the chain ATOM The token performs the unlocking operation accordingly

5、 ... and .IBC handshake protocol

IBC Agreement is Cosmos The core interface protocol in , It can realize the trust of cross chain messages between blockchains 、 Reliable forwarding , And effectively control the flow 、 Multiplexing and other functions .

stay Cosmos in , Each function is highly modular , Each function is realized by loading different modules ,IBC So it is with . stay IBC When the design , Reference to the transport layer TCP agreement , It also hopes to become a blockchain “TCP agreement ”. More Than This , stay IBC Can also be seen in all aspects of TCP The figure of , First let's look at IBC Some basic concepts in .Cosmos IBC A connected 、 Reliable cross chain message transmission

IBC The protocol and TCP Comparison of related concepts
 Insert picture description here

cosmos A complete explanation in the community IBC Handshake and communication flow of the protocol , As shown in the figure below :
 Insert picture description here

The connection process of a cross chain transaction is shown in the figure above , and TCP The agreement is similar to ,IBC The establishment of requires the establishment of multiple handshake processes , A step of initializing the client is added , This is a key link for cross chain

Establish handshake connection on the basis of light client , Handshake connection is basically divided into three parts .

  • Start cross chain user to chain A launch OpenInit request , wait for Relayer Received the request .
  • Relayer Work on routing cross chain message packets , If you receive OpenInit Request ,Relayer Will construct a OpenTry The request is sent to the chain B On .
  • chain B received OpenTry After the request , If you agree , The message will be acknowledged ( Generate OpenACK Data packets , And as before by Relayer Forward to chain A.
  • chain A adopt OpenACK The packet determines whether the handshake is successful , If it works , Send the last... For this handshake OpenConfirm Packet return chain B. If the handshake fails , The connection failed

Although in Cosmos It is mentioned in the design that disordered Channel, But the default implementation uses an ordered pattern . If according to TCP By analogy with the protocol cluster , Orderly Channel and TCP similar , disorder Channel Be similar to UDP, disorder Channel according to UDP In a word , It is also applicable in some scenarios that do not pay much attention to the sequence of message packets across the chain . meanwhile Cosmos The design also takes into account Channel Ability to send messages , Allow one Connection Build more than one Channel, In different cross chain application scenarios , You can use different Channel Send a message , So as to isolate different businesses .

After the above series of handshakes , The application layer can be used in Channel Send your own data on .Cosmos It specifies some necessary fields for sending cross chain transactions , Here's the picture :
 Insert picture description here

among Sequence and SourcePort Fields are functions that assume their literal meaning , It is also a field that must be specified , and TimeoutHeight and TimeoutTimestamp yes Cosmos Provides a timeout mechanism . If the cross chain transaction has not been completed at a certain block height or at a certain time , The user can specify that the transaction be rolled back ( For example, cross chain transfer , It can prevent funds from freezing for a long time ). and Data Fields are reserved for users to customize , To cope with possible complex cross chain scenarios

IBC The method of establishing connection is adopted for cross chain , differ Polkadot Of XCMP agreement ,XCMP The parallel chain in the protocol can directly forward cross chain messages

原网站

版权声明
本文为[Boiled soybeans in brine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270545188369.html