MCPcopy Index your code
hub / github.com/cosmos/ics23

github.com/cosmos/ics23 @v0.7.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.1 ↗ · + Follow
606 symbols 1,330 edges 33 files 95 documented · 16% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Proofs

This is an attempt to define a generic, cross-language, binary representation of merkle proofs, which can be generated by many underlying merkle tree storage implementations and validated by many client libraries over various languages.

The end goal is to provide a standard representation not only for light-client proofs of blockchains, but more specifically for proofs that accompany IBC (inter-blockchain communication) packets as defined in the cosmos specification.

Feature Set

The features and naming follow the ICS23: Vector Commitments Specification

  • Proof of Existence (key-value pair linked to root hash)
  • Hold Existence Proof to db-specific spec (avoid reinterpretation of bytes to different key-value pair)
  • Proof of Non-Existence (key proven not to be inside tree with given root hash)

Planned Features

  • Batch Proof or Range Proof (prove many keys at once, more efficiently than separate proofs)

Organization

The top level package will provide language-agnostic documentation and protobuf specifications. Every language should have a sub-folder, containing both protobuf generated code, as well as client-side code for validating such proofs. The server-side code should live alongside the various merkle tree representations (eg. not in this repository)

Client Languages Supported

Planned Support

Supported Merkle Stores

Planned

Unsupported

I spent quite some time to wrestle out a well-defined serialization and a validation logic that didn't involve importing too much code from go-ethereum (copying parts and stripping it down to the minimum). At the end, I realized the key is only present from parsing the entire path and is quite a painstaking process, even with go code that imports rlp and has the custom patricia key encodings. After a long time reflecting, I cannot see any way to implement this that doesn't either: (A) allow the provider to forge a different key that cannot be detected by the verifier or (B) include a huge amount of custom code in the client side.

If anyone has a solution to this, please open an issue in the proofs-ethereum repo.

Known Limitations

This format is designed to support any merklized data store that encodes key-value pairs into a node, and computes a root hash by repeatedly concatenating hashes and re-hashing them.

Notably, this requires the key to be present in the leaf node in order to enforce the structure properly and prove the key provided matches the proof without extensive db-dependent code. Since some tries (such as Ethereum's Patricia Trie) do not store the key in the leaf, but require precise analysis of every step along the path in order to reconstruct the path, these are not supported. Doing so would require a much more complex format and most likely custom code for each such database. The design goal was to be able to add new data sources with only configuration (spec object), rather than custom code.

Extension points exported contracts — how you extend this code

PaddingResult (Interface)
(no doc)
js/src/proofs.ts
RefData (Interface)
(no doc)
js/src/testvectors.spec.ts
LoadResult (Interface)
(no doc)
js/src/testvectors.spec.ts
BatchResult (Interface)
(no doc)
js/src/testvectors.spec.ts

Core symbols most depended-on inside this repo

decode
called by 22
rust/src/ops.rs
iavl_spec
called by 18
rust/src/api.rs
verify_test_vector
called by 18
rust/src/api.rs
ensureSpec
called by 11
js/src/proofs.ts
applyLeaf
called by 10
js/src/ops.ts
smt_spec
called by 10
rust/src/api.rs
load_batch
called by 10
rust/src/api.rs
verify_batch
called by 10
rust/src/api.rs

Shape

Method 286
Function 215
Class 44
Struct 33
Interface 20
Enum 5
TypeAlias 3

Languages

Go64%
TypeScript18%
Rust18%

Modules by API surface

go/proofs.pb.go307 symbols
rust/src/api.rs43 symbols
js/src/generated/codecimpl.d.ts41 symbols
rust/src/verify.rs24 symbols
rust/src/ops.rs16 symbols
rust/src/ics23.rs16 symbols
go/proof.go16 symbols
js/src/proofs.ts13 symbols
js/src/generated/codecimpl.js13 symbols
js/src/ops.ts12 symbols
go/vectors_data_test.go12 symbols
go/ics23.go10 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add ics23 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact