# Smooth 模块化区块链系列教程(五): Celestia App **Published by:** [wiger.eth](https://paragraph.com/@wiger/) **Published on:** 2022-10-13 **URL:** https://paragraph.com/@wiger/smooth-celestia-app ## Content Celestia App: 一个 PoS 链 Celestia App Celestia 本质上由 PoS 区块链组成,这条链被称作 Celestia App,采用 Cosmos SDK 构建。 Celestia App 建立在 Celestia Core 之上,Celestia Core 通过 Tendermint 共识算法的修改得到,修改的地方在前文提到过,同时 Celestia Core 节点仍在使用 Tendermint p2p 网络: 采用了 2D R-S 编码方案: https://mirror.xyz/wiger.eth/sqxu0qWWyS6TmxH89qKlmDGkdjh2g-HseZLygIWBOwQ 将 Tendermint 中存储数据的常规 Merkle Tree 替换为 Namespaced Merkle Tree: https://mirror.xyz/wiger.eth/WkJKoUoqgROOx_orWrCETZSy5vJfb-Fyo-r9uP8bGZY 与 Tendermint 类似,Celestia Core 通过 ABCI 连接到应用层(即状态机),Celestia App 状态机是执行 PoS 和进行 DA 层治理所必需的。 但 Celestia App 与数据无关:状态机既不验证也不存储 Celestia App 提供的数据。 Celestia App 上交易的生命周期 The Lifecycle of a Celestia App Transaction 用户通过 PayForData 交易,向 Celestia App (Celestia Core) 请求,使交易数据可用。 在 Block Producer 中,Celestia Core 通过 ABCI 将 PayForData 交易传递给状态机。 状态机将 PayForData 交易拆分为 2 部分,并传回给 Celestia Core: Msg 命名空间消息:当中包含了交易数据和 Namespace ID。 e-Tx 可执行交易:不包含数据,只有一个 commitment 在之后用于证明数据可用。 每个出块的节点,将多笔 PayForData 打包在一个块内,块中就包含了上面提到的 Msg 和 e-Tx。 然后区块生产者向块头添加块数据的 commitment,不同于 e-Tx 的 commitment,这里的是 2D R-S 编码后 4k 个交易 Merkle Roots 的 Merkle Root。 最后出块。 检验数据可用性 Checking Data Availability Celestia 采用了一个 DA Network 来为 Consensus Network 处理 DAS 验证,二者通过 RPC 通信。 轻节点向全节点请求通过 2D R-S 编码得到的 4k Merkle Roots 和 DA 原始数据。 轻节点在获取数据后进行 DAS 抽样验证,只要有一个查询失败,即没有收到数据块,或 Merkle 证明无效,则轻节点拒绝区块头部并稍后重试。 轻节点还可以通过全节点,向 Celestia App 提交 PayForData 交易。 有时候尽管数据不可用,轻节点也可以接受区块头部,即误报。 通过微调 Celestia 的参数,例如,每个轻节点采样数据块的数量,可以充分降低误报的可能性,从而使区块生产者没有动机扣留区块数据。 引用 Celestia's Data Availability Layer: https://docs.celestia.org/concepts/how-celestia-works/data-availability-layer The Lifecycle of a Celestia App Transaction: https://docs.celestia.org/concepts/how-celestia-works/transaction-lifecycle ## Publication Information - [wiger.eth](https://paragraph.com/@wiger/): Publication homepage - [All Posts](https://paragraph.com/@wiger/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@wiger): Subscribe to updates - [Twitter](https://twitter.com/JizhouW): Follow on Twitter