vector commitment为:
- constant-size commitment
- binding commitment to an indexed vector of elements
- short membership and/or non-membership proofs for any indices & elements in the vector
Cosmos IBC中使用的vector commitment还额外要求具有:
- positionally binding属性:必须可证明 existence or nonexistence of values at specific positions (indices)。
IBC中的vector commitment主要用于保证:
- 链A上的特定状态变更可在链B上进行验证,vector commitment可 prove inclusion or non-inclusion of particular values at particular paths in state。
-
“manager”:a vector commitment的manager,为负责从commitment中增减items的actor。该actor通常为某链的state machine。
-
“prover”:为生成特定element inclusion 或 non-inclusion proof的actor,通常为a relayer。
-
“verifier”:检查proof,以验证该commitment的manager 确实加了 或 确实没加某特定element 的actor。通常为运行在另一条链上的an IBC handler(实现了IBC的module)。
-
“path and value”:commitments以"path and value"类型进行实例化,可为任意可序列化数据。
具体的数据类型定义可参看confio/ics23(Go语言,构建的generic merkle proof format for IBC)。
3.1 数据类型构建的commitment需遵循如下数据类型,必须为可序列化的:
- 1)Commitment State:为该commitment的full state,由 manager存储。
- 2)Commitment Root:commit to a particular commitment state 且应为constant-size的。
- 3)Commitment Path:为用于验证commitment proof的path,可构建为任意结构对象(由commitment类型决定),单必须使用
applyPrefix
计算。 - 4)Prefix:
CommitmentPrefix
中定义了a store prefix of the commitment proof。在path传送到proof verification函数之前,用于path。applyPrefix
函数会根据参数构建新的commitment path,会在prefix参数中解析path参数。 对于2个相同的(prefix, path)
tuples,applyPrefix(prefix, path)
必须返回相同的key。 必须为每个Path
实现applyPrefix
,因为Path
具有不同的详细结构。applyPrefix
可接受多个CommitmentPrefix
类型。applyPrefix
返回的CommitmentPath
不要求可序列化(比如,可为a list of tree node identifiers),但是要求可进行equality比较。 - 5)Proof:
CommitmentProof
表示了membership or non-membership for an element or set of elements,verifiable in conjunction with a known commitment root。 Proofs should be succinct。
commitment构建过程中必须实现以下函数。其中path为可序列化object,value为byte arrays:
type Path = string
type Value = []byte
- 1)初始化:
generate
函数会根据可能为空的初始path->value map 对应的commitment state来初始化。 - 2)计算root:
calculateRoot
函数为commitment state计算a constant-size commitment,用于验证proof。 - 3)增减元素:
set
函数用于设置commitment中某value的path。remove
函数用于从commitment中移除某path和相应的value。 - 4)生成proof:
createMembershipProof
用于生成commitment中某特定path对应为某特定值 的 proof。createNonMembershipProof
函数用于生成commitment中任意值均未设定该commitment path 的proof。 - 5)验证proof:
verifyMembership
用于验证proof 中某特定path对应为commitment内某特定值。verifyNonMembership
用于验证proof中某coMmitment path不对应commitment中任意值。 - 6)可选函数:
batchVerifyMembership
验证多个path 与 多个value之间的关系。batchVerifyNonMembership
验证多个path 均不对应commitment中任意值的关系。这两个函数应分别与verifyMembership
和verifyNonMembership
这两个函数的验证结果一致。batch方法可能比单一验证方法效率更高。
IBC vector commitment具有如下属性:
- 1)完备性
- 2)可靠性
- 3)position binding
相关论文参考有:
- Vector Commitments and their Applications
- Commitments with Applications to Anonymity-Preserving Revocation
- Batching Techniques for Commitments with Applications to IOPs and Stateless Blockchains
[1] ics-023-vector-commitment