欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

跨链Cosmos(10) IBC接口

发布时间:2025/3/21 编程问答 40 豆豆
生活随笔 收集整理的这篇文章主要介绍了 跨链Cosmos(10) IBC接口 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

1. 子模块

1.1 IBCRegisterChainTx 注册

在跨链开始用来注册,并发送创世区块,Validator 给对方,这个只能执行一次,多次执行会报错。

type IBCRegisterChainTx struct {BlockchainGenesis } type BlockchainGenesis struct {ChainID stringGenesis string }

1.2 IBCUpdateChainTx 推送链消息

向另外一个链推送当前链上区块最新信息,区块高度,区块头信息。

type IBCUpdateChainTx struct {Header tm.HeaderCommit tm.Commit // TODO: NextValidators }

1.3 IBCPacketCreateTx 创建跨链交易

当链收到这个交易包时会执行跨链交易,并将在egress中放入相关信息。

type IBCPacketCreateTx struct {Packet } type Packet struct {SrcChainID stringDstChainID stringSequence uint64Type string // redundant now that Type() is a method on Payload ?Payload Payload }

1.4 IBCPacketPostTx 发送链证明

这个包中包含跨链交易执行后的Merkle proof,由relayer发送给另外一个链。

type IBCPacketPostTx struct {FromChainID string // The immediate source of the packet, not always Packet.SrcChainIDFromChainHeight uint64 // The block height in which Packet was committed, to check ProofPacketProof *merkle.IAVLProof // Merkle证明 }

总结

以上是生活随笔为你收集整理的跨链Cosmos(10) IBC接口的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。