<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>gcc2ge</title>
        <link>https://paragraph.com/@gcc2ge</link>
        <description>undefined</description>
        <lastBuildDate>Tue, 09 Jun 2026 17:11:09 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[IBC协议介绍]]></title>
            <link>https://paragraph.com/@gcc2ge/ibc</link>
            <guid>DleokGsoo18CQo4NCwzh</guid>
            <pubDate>Thu, 02 Jun 2022 16:41:24 GMT</pubDate>
            <description><![CDATA[IBC可以认为是连接cosmos生态中各个链之间的高速公路，那么，什么是IBC？IBC是如何实现区块链之间的互操作性的？我将介绍IBC的架构和主要组成部分，包括IBC/TAO和IBC/APP。在IBC协议的基础是可以建立跨链应用例如：跨链转账，链间账户等。最后，我将举例说明如何实现跨链代币转移。什么是IBCIBC是Inter-Blockchain Communication（跨链通信）的缩写。IBC是一个端到端的、面向连接的、有状态的协议，用于可靠、有序和认证的分布式账本上的模块之间的通信。 IBC协议采用分层设计，主要分为2层：IBC/TAO：TAO指的是：transport, authorization, organization，该协议处理分布式账本之间的数据之间的传输，认证，排序。IBC/APP：基于TAO构建的上层应用层，定义了从传输层发送过来的数据的处理方式，如可分割代币转移(ICS-20),NFT代币转移(ICS-721)，interchain accounts（链间账户 ICS-27)实现IBC协议的大多数工作集中在TAO层，一旦TAO层实现，则很容易在TAO层之...]]></description>
            <content:encoded><![CDATA[<p><code>IBC</code>可以认为是连接<code>cosmos</code>生态中各个链之间的高速公路，那么，什么是<code>IBC</code>？<code>IBC</code>是如何实现区块链之间的互操作性的？我将介绍<code>IBC</code>的架构和主要组成部分，包括<code>IBC/TAO</code>和<code>IBC/APP</code>。在<code>IBC</code>协议的基础是可以建立跨链应用例如：跨链转账，链间账户等。最后，我将举例说明如何实现跨链代币转移。</p><h2 id="h-ibc" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">什么是IBC</h2><p><code>IBC</code>是<code>Inter-Blockchain Communication</code>（跨链通信）的缩写。<code>IBC</code>是一个端到端的、面向连接的、有状态的协议，用于可靠、有序和认证的分布式账本上的模块之间的通信。</p><p><code>IBC</code>协议采用分层设计，主要分为2层：</p><ul><li><p><code>IBC/TAO</code>：<code>TAO</code>指的是：<code>transport</code>, <code>authorization</code>, <code>organization</code>，该协议处理分布式账本之间的数据之间的传输，认证，排序。</p></li><li><p><code>IBC/APP</code>：基于<code>TAO</code>构建的上层应用层，定义了从传输层发送过来的数据的处理方式，如可分割代币转移(<code>ICS-20</code>),<code>NFT</code>代币转移(<code>ICS-721</code>)，<code>interchain accounts</code>（链间账户 <code>ICS-27</code>)</p></li></ul><p>实现<code>IBC</code>协议的大多数工作集中在<code>TAO</code>层，一旦<code>TAO</code>层实现，则很容易在<code>TAO</code>层之上实现不同的<code>APP</code>层协议。</p><p>和<code>TCP/IP</code>协议类似，<code>IBC</code>的特殊性在于它可以将应用层（<code>application layer</code>）从传输层和网络层（<code>TAO</code>, <code>transport</code>, <code>authorization</code>, <code>organization</code>）中剥离出来。这意味着<code>IBC</code>定义了数据是如何跨链被发送和接受的。不过它并没有明确具体的数据以及这些数据是如何组织的。这使得<code>IBC</code>从其他一些需要在应用层实现大量标准化的跨链解决方案中脱引而出。</p><p>下图展示了<code>IBC</code>工作流程：</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/8dabef2bff0b46fe69c11562faa58477058813d64f64cd262a59bcaf699c45ce.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>上图中有三个关键点需要注意:</p><ul><li><p>链之间依赖<code>relayer</code>通信，<code>relayer</code>相当于<code>IBC</code>协议中的物理层连接，<code>relayer</code>会扫描运行<code>IBC</code>协议的链，并负责向其他链报告最新的状态。</p></li><li><p>多个<code>relayer</code>可以为多个<code>channel</code>传输数据</p></li><li><p><code>relayer</code>使用每个链上的<code>light client</code>来交易发送过来的消息</p></li></ul><h2 id="h-ibctao" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">IBC/TAO 网络传输层</h2><p><code>IBC/TAO</code>层的主要作用为：在两链之间以<code>reliable</code>，<code>ordered and authenticated</code>方式传递数据包。</p><ul><li><p><code>reliable</code>：是指源链仅发送一个<code>packet</code>，目标链仅接收一次，二者无需信任任何第三方。</p></li><li><p><code>ordered</code>：是指目标链接收<code>packet</code>的顺序与源链发送<code>packet</code>的顺序一致。</p></li><li><p><code>authenticated</code>：每个<code>channel</code>分配给特定这智能合约，只有分配到<code>channel</code>的智能合约可以通过这个<code>channel</code>发送<code>packet</code>，任何其他智能合约无法使用该<code>channel</code>发送packet。</p></li></ul><p><code>IBC/TAO</code>主要包含以下三个模块：</p><ul><li><p>链上轻客户端（<code>on-chain light client</code>）</p></li><li><p>连接（<code>connection</code>）</p></li><li><p>通道（<code>channel</code>）</p></li></ul><h3 id="h-light-client" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Light Client</h3><p>轻客户端是 <code>IBC/TAO</code>的基础，轻客户端有一个为一个<code>client ID</code>作为标识，<code>light client</code>会追踪其他区块链的共识状态，并且会基于共识状态交易对方区块链发送过来数据的合法性。<code>relayer</code>只负责消息的传递，消息的合法性是依赖于轻客户端做验证，所以<code>IBC</code>的安全性并不依赖于第三方服务比如<code>relayer</code>。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/e78b87d9100ceb4b53533988e15ffb2684024302e9f93c469c8b5ad175c8a99d.png" alt="img" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">img</figcaption></figure><h3 id="h-connection" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Connection</h3><p>有了<code>light client</code> 就可以在<code>light client</code>是建立<code>connection</code>，<code>connection</code>算是一个连接两个分布式账本的通道，一个<code>light client</code>可以接受任意数量的<code>connection</code>。</p><p><code>connection</code>通过四次握手完成，所有操作都是由<code>relayer</code>发起交易来触发，<code>A</code>链发起连接到<code>B</code>链过程如下：</p><ul><li><p><code>connOpenInit</code>：在<code>A</code>链上会创建并存储<code>INIT</code>状态。</p></li><li><p><code>connOpenTry</code>：<code>B</code>链若验证<code>A</code>链上该<code>connection</code>状态为<code>INIT</code>，则在<code>B</code>链上创建并存储<code>TRYOPEN</code>状态。</p></li><li><p><code>connOpenAck</code>：<code>A</code>链若验证<code>B</code>链上该<code>connection</code>状态为<code>TRYOPEN</code>，则将<code>A</code>链上该<code>connection</code>的状态由<code>INIT</code>更新为<code>OPEN</code>。</p></li><li><p><code>connOpenConfirm</code>：<code>B</code>链若验证<code>A</code>链上该<code>connection</code>状态已由<code>INIT</code>更新为<code>OPEN</code>，则将B链上该<code>connection</code>状态由<code>TRYOPEN</code>更新为<code>OPEN</code>。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/78dcece19a4936df6bbcd287bfd517117bb7e0d0ec0e853c170099e6b9368327.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h3 id="h-channel" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Channel</h3><p><code>connection</code>和<code>light client</code>构成了<code>IBC</code>中传输层的主要组件。但是，<code>IBC</code>中的应用程序之间的通信是通过<code>channel</code>进行的，<code>channel</code>在应用程序模块与另一条链上的相应应用程序模块之间进行路由。这些应用程序由端口标识符命名，例如 <code>ICS-20 token</code>传输的<code>transfer</code>。</p><p><code>channel</code>通过四次握手完成，所有操作都是由<code>relayer</code>发起交易来触发，<code>A</code>链发起连接到<code>B</code>链过程如下：</p><ul><li><p><code>chanOpenInit</code>：在<code>A</code>链上会创建并存储<code>INIT</code>状态。</p></li><li><p><code>chanOpenTry</code>：<code>B</code>链若验证<code>A</code>链上该<code>channel</code>为<code>INIT</code>状态，则在<code>B</code>链上创建并存储<code>TRYOPEN</code>状态。</p></li><li><p><code>chanOpenAck</code>：<code>A</code>链若验证<code>B</code>链上该<code>channel</code>为<code>TRYOPEN</code>状态，则将<code>A</code>链上该<code>channel</code>的状态由INIT更新为<code>OPEN</code>。</p></li><li><p><code>chanOpenConfirm</code>：<code>B</code>链若验证<code>A</code>链上该<code>channel</code>状态已由<code>INIT</code>更新为<code>OPEN</code>，则将<code>B</code>链上该<code>channel</code>状态由<code>TRYOPEN</code>更新为<code>OPEN</code>。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/832885bb27f0cdab8bed952f4441dfc0345864ba09e892a64f90372ec55b03c6.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h2 id="h-ibcapp" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">IBC/APP 应用层</h2><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">跨链转账</h3><p>在<code>IBC</code>的技术上可以构建跨链<code>token</code>转移的应用，在<code>token</code>进行转移的时候最重要的是确定要转移的<code>token</code>是不是属于当前链，下面流程图展示了如何区分<code>token</code>是是否是属于当前链：</p><ul><li><p>如果<code>token</code>是当前链的<code>native token</code>，那么当前链是<code>token</code>的源链</p></li><li><p>如果<code>token</code>是当前链通过<code>channel</code>从其他链接受的<code>token</code>，那么当前链不是<code>token</code>的源链，否者当前链是<code>token</code>的源链</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/a4ba090bb7cc0e1fb8efd42406facccd40c1cb6d0503a0fe9ecb26bc5886884d.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>区分当前链是否为<code>token</code>的源链就可以进行<code>token</code>转移了，因为<code>token</code>从源链到目标链，和<code>token</code>从目标链到源链的逻辑是不相同的。下图展示了两者的区别：</p><ul><li><p><code>token</code>从目标链转移到目标链</p><ul><li><p>托管<code>token</code></p></li><li><p>目标链mint新的<code>token</code></p></li></ul></li><li><p><code>token</code>从目标链转移回源链</p><ul><li><p>目标链<code>burn token</code></p></li><li><p>源链释放托管的<code>token</code></p></li></ul></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/c09f07107eae2d6b82b31fef285b1d5ecaf3608051ebdf3cb6208deb8373a860.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>当<code>token</code>从一个链转到另一个链后，它的<code>denom</code>（<code>token</code>的标识符类似<code>ethereum</code>中的<code>symbol</code>）会产生变化，比如在<code>Ethereum</code>的跨链桥方案中，<code>eth</code>从<code>Ethereum</code>跨到<code>bsc</code>链上时就会变成<code>eth.e</code>或者其他的名称（和你使用的跨链桥有关，不同的桥跨链后的资产名称是不一样的）。那么在<code>IBC</code>方案中并没有中心化的桥提供服务，那么跨链后的资产名称如何命名？</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/d27c2a3fd521866847927ab947ba29f2ed7bb7c669784e5de96dec8c513f3c00.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>如上图所示，链<code>A</code>（<code>channel-2</code>）与链<code>B</code>（<code>channel-40</code>）之间的已经建好了<code>channel</code>，当<code>token</code>从A链转到B链时，<code>token</code>在<code>B</code>链的<code>denom</code>为<code>{Port}/{Channel}/{denom}</code>，<code>channel</code>建立好后，会绑定<code>port</code>，<code>transfer</code> 模块将绑定到一个名为 <code>transfer</code> 的端口。如果链<code>A</code>发送 <code>100</code> 个<code>ATOM token</code>，则链<code>B</code>将收到 <code>100</code> 个 <code>ATOM token</code> 并附加链B的<code>channel</code>前缀<code>port/channel-id</code>。所以链 <code>B</code> 会将这 <code>100</code> 个 <code>ATOM</code> 代币铸造为<code>transfer/channel-40/atom</code>。</p><h4 id="h-" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">案例</h4><p>接下来演示<code>IRIS</code>的<code>native token uiris</code>经过<code>cosmos hub</code>转移到<code>KAVA</code>链的过程。</p><p><strong>Native Token On</strong> <code>IRIS</code></p><ul><li><p>denom: <code>uiris</code></p></li></ul><p><strong>IBC Token On</strong> <code>COSMOS</code></p><ul><li><p>Denom: <code>ibc/hash(transfer/channel-20/uiris)</code></p></li><li><p>DenomTrace</p><ul><li><p>BaseDenom: <code>uiris</code></p></li><li><p>Path: <code>transfer/channel-20</code></p></li></ul></li></ul><p><strong>IBC Token On</strong> <code>KAVA</code></p><ul><li><p>Denom: <code>ibc/hash(transfer/channel-30/transfer/channel-20/uiris)</code></p></li><li><p>DenomTrace</p><ul><li><p>BaseDenom: <code>uiris</code></p></li><li><p>Path: <code>transfer/channel-30/transfer/channel-20</code></p></li></ul></li></ul><h5 id="h-iris-greatercosmos-kava" class="text-lg font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">IRIS-&gt;COSMOS-KAVA</h5><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/70f99352816636feda419fb57935ebf659efabe24949fbbd2bcd74cbb678607b.png" alt="未命名23" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">未命名23</figcaption></figure><p>上图流程如下：</p><ul><li><p><code>uiris</code>是<code>IRIS</code>的<code>native token</code>所以直接将<code>uiris</code>托管在<code>IRIS</code>链中</p></li><li><p><code>cosmos</code>链在<code>channel-20</code>通道中<code>mint ibc token</code> <code>transfer/channel-20/uiris</code>，并将<code>ibc token</code>从<code>channel-21</code>通道发送给<code>KAVA</code></p></li><li><p><code>cosmos</code>检查<code>transfer/channel-20/uris</code>并不是通过<code>channel-21</code>通道接受的<code>token</code>，所以在<code>channel-21</code>中托管<code>ibc token</code></p></li><li><p><code>Kava</code>收到<code>cosmos</code>的消息，在<code>channel-30</code>中<code>mint ibc token</code></p></li></ul><h5 id="h-kava-greatercosmos-greateriris" class="text-lg font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">KAVA-&gt;COSMOS-&gt;IRIS</h5><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/f7a790d4a93d1e28ec71a47c6329c9a04498581d2f0d907ece940209558722e6.png" alt="未命名24" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">未命名24</figcaption></figure><p>上述过程的逆操作，可看上图中的注释。</p><h3 id="h-interchain-account" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">interchain account</h3><p>跨链账户允许区块链使用<code>IBC</code>安全地控制另一个区块链上的账户。</p><p>跨链账户最重要的两个特点如下：</p><ul><li><p>通过<code>IBC</code>在另一个链上创建一个新的跨链账户</p></li><li><p>通过<code>IBC</code>可以控制远程的跨链账户</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/4a0854db0f71e723637389f1d7836fce52bfb412fa65f5040c9d72e9e28690f3.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><code>Host Chain</code>：跨链账户在<code>Host Chain</code>上注册生成。<code>Host Chain</code>监听来自<code>controller chain</code>的 IBC 数据包（创建<code>interchain account</code>的数据包）。</p><p><code>controller chain</code>：该链可以在<code>Host Chain</code>上注册跨链账户，完成后可以控制跨链账户（通过发送IBC packet给<code>Host Chain</code>来控制）。<code>controller chain</code>必须具有至少一个跨链帐户身份验证模块（<code>Authentication Module</code>）才能充当<code>controller chain</code>。</p><p><code>Authentication Module</code>（身份验证模块）：<code>controller chain</code>上的自定义<code>IBC</code>应用程序模块，使用跨链账户模块 API 构建自定义逻辑，用于创建和管理跨链账户。<code>controller chain</code>需要身份验证模块才能利用链间帐户模块功能。</p><p>跨链账户（<code>ICA</code>）：<code>Host Chain</code>上的账户。跨链账户具有普通账户的所有功能。但是，<code>controller chain</code>的身份验证模块不会使用私钥对交易进行签名，而是将<code>IBC</code>数据包发送到<code>Host Chain</code>，以指示跨链帐户应该执行哪些交易。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">总结</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/077a981146b0433806f37954333a7899b372d72e2d4237f0b7f1827a22d5145b.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><code>IBC</code>协议一共分为四层分别是：应用层，<code>channel</code>，<code>connection</code>，<code>light client</code>。 应用层处理来自<code>channel</code>的数据报，并将处理完成后的数据交给<code>channel</code>发送给对方链。目前用的比较多的应用就是跨链token转移和链间账户。</p><p><code>channel</code>建立在<code>connection</code>上，一个<code>connection</code>上可以拥有多个<code>channel</code>，每个<code>channel</code>的id是自增的，<code>channel</code>和模块进行绑定。</p><p><code>connection</code>建立在<code>light client</code>的基础上，一个 <code>light client</code>上可以有多个<code>connection</code>，<code>connection</code>的id也是自增的。</p><p>每个链都会拥有另一条链的<code>light client</code>，<code>light client</code>跟踪其他链的共识状态，以及根据对方链的<code>light client</code>的共识状态验证对方的数据包的合法性。</p><p><code>relayer</code>不对数据包进行任何验证，因此不需要被信任，但<code>relayer</code>在 <code>IBC</code> 中具有特别重要的作用，除了通过提交数据包以保持<code>IBC</code>网络的活跃性。他们负责提交init消息以创建新<code>light client</code>，并在每个链上保持<code>light client</code>状态的更新，以确保<code>light client</code>可以验证传递过来的数据包的合法性。<code>relayer</code>还负责发送<code>connection</code>和<code>channel</code>握手数据包，在链之间建立<code>connection</code>和<code>channel</code>。此外，如果连接另一端的链尝试分叉或尝试其他类型的恶意行为，<code>relayer</code>可以提交不当行为的证据。</p>]]></content:encoded>
            <author>gcc2ge@newsletter.paragraph.com (gcc2ge)</author>
        </item>
    </channel>
</rss>