Skip to content

An example of ICS23 verification on Ethereum powered by SP1.

License

Notifications You must be signed in to change notification settings

noble-assets/sp1-ics23-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SP1 ICS23 Template

An example of ICS23 verification on Ethereum powered by SP1.

Overview

ICS23 is the commitment standard used by IBC, allowing chains to verify state inclusion across light clients. The SP1 ICS23 template demonstrates how to use SP1 to generate proofs of ICS23 commitment verifications, and verify it on Ethereum.

When requesting a proof, you must supply the program with a merkle root hash. For Tendermint light clients, this can be retrieved from the block header, which should be separately verified using the SP1 Tendermint program.

Example

Before you can successfully generate a proof locally, ensure you have followed the instructions to install SP1.

For this example, we will be using this IBC receive packet message. This specific transfer gives us the following inputs:

# Retrieved via the /block RPC endpoint.
MERKLE_ROOT     = eoeq0RV8L4fjApSM/rxSUCuhAuCf8tCYAJ0FsD94MVc=

# Retrieved via the /abci_query RPC endpoint.
MERKLE_PROOF    = CrEICq4ICj5jb21taXRtZW50cy9wb3J0cy90cmFuc2Zlci9jaGFubmVscy9jaGFubmVsLTEvc2VxdWVuY2VzLzE2NjYzMBIgp847odf8QF17fp6aNBeFqJbRWwWgHYNcPCxwAkuQuqgaDggBGAEgASoGAALGxvgFIi4IARIHAgTGxvgFIBohINrNshqA/y9qgXdROLe0fUtP1XoCS757C0Fu85vJbsZaIiwIARIoBAjGxvgFII+/WzDByTrJpal3B9WaC6/SF++mbeG6uGSFRxYLqAQyICIsCAESKAYQxsb4BSCvWg22kseAqzCUCUTiBKbjDrG4TfDStr0tpGtPexyH+iAiLAgBEigIIMbG+AUgxRpF0UxZF2zOVR8QT6EvC61vUXorenF7uZKRcwX8s0MgIi4IARIHDETGxvgFIBohIK7DxGA0YP34J/EmXOu8hgikAb13etvXTbCUNVbEYrW+Ii0IARIpDowBxsb4BSDT4M2cv/mnLMUKTHQZulip8vHKUElbNdBzsTGPd8OMOCAiLQgBEikQoALGxvgFIGIVYQfpbVuT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lm4+upM+EiJQgBEiEBSTr90PNsxLxfDexuMosguq4Wo4QV3xTcKMX/VkCBKMQiJwgBEgEBGiB22s1GhVC/MK/NQf5++Irir0ry2djNzvhAZHZyReYxPg==

# https://github.com/cosmos/ibc-go/blob/v4.6.0/modules/light-clients/07-tendermint/types/client_state.go#L381-L382
MERKLE_PATH     = CgNpYmMKPmNvbW1pdG1lbnRzL3BvcnRzL3RyYW5zZmVyL2NoYW5uZWxzL2NoYW5uZWwtMS9zZXF1ZW5jZXMvMTY2NjMw

# https://github.com/cosmos/ibc-go/blob/v4.6.0/modules/core/04-channel/types/packet.go#L19
COMMITMENT_VALUE = p847odf8QF17fp6aNBeFqJbRWwWgHYNcPCxwAkuQuqg=

Now, we can pass these inputs into our program to generate a proof:

cd script
RUST_LOG=info cargo run --bin prove --release $MERKLE_ROOT $MERKLE_PROOF $MERKLE_PATH $COMMITMENT_VALUE

About

An example of ICS23 verification on Ethereum powered by SP1.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages