跨链Cosmos(5)ABCI 接口
生活随笔
收集整理的這篇文章主要介紹了
跨链Cosmos(5)ABCI 接口
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一個(gè)協(xié)議,支持任何語(yǔ)言的交易處理實(shí)現(xiàn)
1. 應(yīng)用層實(shí)現(xiàn)交互的接口
// Application is an interface that enables any finite, deterministic state machine // to be driven by a blockchain-based replication engine via the ABCI. // All methods take a RequestXxx argument and return a ResponseXxx argument, // except CheckTx/DeliverTx, which take `tx []byte`, and `Commit`, which takes nothing. type Application interface {// Info/Query ConnectionInfo(RequestInfo) ResponseInfo // Return application infoQuery(RequestQuery) ResponseQuery // Query for state// Mempool ConnectionCheckTx(RequestCheckTx) ResponseCheckTx // Validate a tx for the mempool// Consensus ConnectionInitChain(RequestInitChain) ResponseInitChain // Initialize blockchain w validators/other info from TendermintCoreBeginBlock(RequestBeginBlock) ResponseBeginBlock // Signals the beginning of a blockDeliverTx(RequestDeliverTx) ResponseDeliverTx // Deliver a tx for full processingEndBlock(RequestEndBlock) ResponseEndBlock // Signals the end of a block, returns changes to the validator setCommit() ResponseCommit // Commit the state and return the application Merkle root hash// State Sync ConnectionListSnapshots(RequestListSnapshots) ResponseListSnapshots // List available snapshotsOfferSnapshot(RequestOfferSnapshot) ResponseOfferSnapshot // Offer a snapshot to the applicationLoadSnapshotChunk(RequestLoadSnapshotChunk) ResponseLoadSnapshotChunk // Load a snapshot chunkApplySnapshotChunk(RequestApplySnapshotChunk) ResponseApplySnapshotChunk // Apply a shapshot chunk }-
Consensus Connection: InitChain, BeginBlock, DeliverTx, EndBlock,
-
CommitMempool Connection: CheckTxInfo
-
Connection: Info, SetOption, Query
proto定義位于 https://github.com/tendermint/abci/blob/master/types/types.proto
2. 一個(gè)應(yīng)用程序可以有3個(gè) ABCI 套接字連接
對(duì)應(yīng)3個(gè)消息:
- CheckTx消息
在內(nèi)存池中廣播時(shí)驗(yàn)證交易,用于驗(yàn)證交易。Tendermint Core中的mempool通過(guò)此消息校驗(yàn)交易的合法性,通過(guò)之后才會(huì)將交易廣播給其它節(jié)點(diǎn)。 - DeliverTx消息
應(yīng)用的主要工作流程,通過(guò)此消息真正執(zhí)行交易,包括驗(yàn)證交易、更新應(yīng)用程序的狀態(tài)。 - Commit消息
通知應(yīng)用程序計(jì)算當(dāng)前的世界狀態(tài),并存在下一區(qū)塊頭中
總結(jié)
以上是生活随笔為你收集整理的跨链Cosmos(5)ABCI 接口的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 跨链Cosmos(4)Tendermin
- 下一篇: 跨链Cosmos(6)ABCI 原理