Ethan Buchman
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# IBC Snark Account *authors: Ethan Buchman & Aditya Sripal* We wanted to follow up on the idea of using IBC for C[elestia Snark Accounts](https://forum.celestia.org/t/celestia-snark-accounts-design-spec/1639), since most of the Snark account design options look more or less like a partial implementation of ICS-20 (IBC token transfer). Essentially, the ZK updates can be implemented as an ICS-02 client, which is a generalized scheme that operates on blobs and can accomodate ZK proofs. The benefit of this is that it fits in a common standard, and allows other IBC standards to be layered on top (eg. both ICS-20 token transfer and ICS-27 interchain accounts), which would enable generalized functionality between Celestia and its rollups without requiring repeated rounds of custom protocol design. The withdraw mechanics and replay protection that most of the Snark Account design options focus on come for free from ICS-20. However, ICS20 as currently designed does result in significant state bloat (commitments stored in state for every packet sent), but this can actually be addressed by adding an extra IBC message to clean up the state after packet timeouts (this would benefit all IBC users, but it seems might be a requirement for Celestia. Note Celestia currently incurs this state bloat in all its existing IBC connections, which might be acceptable for 10s of chains, but not for millions of rollups). In what follows we first sketch how to capture the ZK updates as an ICS-02 client. Then we briefly sketch how to prune the ICS-20 state. ## Client Mechanics ICS-02 is the generalized IBC client interface defined [here](https://github.com/cosmos/ibc/blob/main/spec/core/ics-002-client-semantics/README.md). At a glance, it defines a `Consensus State` and a `Client State`, and datagrams `Client Messages` and related handlers (`CreateClient`, `UpdateClient`, `SubmitMisbehaviour`) to instantiate and update them. The client then offers APIs for verifying membership or non-membership of elements in the state. In the world of Tendermint chains, the `ConsensusState` is the Tendermint Header, the `ClientState` tracks the validator set and state root so the headers and Merkle proofs can be verified, the `ClientMessage` is a Tendermint light client update message. Finally `verifyMembership` checks a generalized merkle proof as defined in [ICS-23](https://github.com/cosmos/ics23). This "standard" implementation of an ICS-02 client is defined in [ICS-07](https://github.com/cosmos/ibc/blob/main/spec/client/ics-007-tendermint-client/README.md). In the world of Celestia to rollup communication, we are largely replacing Tendermint light client verification with ZK proofs of rollup state transition functions. And since the rollups depend on Celestia block space anyways, their client verification can also be simplified. Here we briefly sketch what the client management looks like going both ways: L1 to L2 "state update": - There does not need to be a real client on the L2. This is to prevent having the Tendermint Light client algorithm in the STF of a zk rollup. - Note: The downside of not having a true client in the rollup STF is that IBC direct connections are only possible with the L1. Connection to the rest of the ecosystem is still possible by routing through the L1 - Instead packets from L1 to L2 will simply be added as part of the sequencing logic (these are the "Deposit Transactions" defined in the [original Snark Accounts writeup](https://hackmd.io/@succinct/SJ4LeWyop)) - i.e. Rollup block producers must add IBC packet flow messages (RecvPacket, AcknowledgePacket, etc) as part of their block creation. These would be system transactions for sequencer rollups and public inputs for based rollups. - Open question: How would we include packet flow messages that cannot be triggered by changes in L1 state, the only example of this is TimeoutPacket. We emit Timeout event upon receiving a packet that has already timed out so this could be used by sequencers, though this doesn't exist in state. - Celestia IBC logic can write the relayer messages directly into the namespace to enforce ordering between Deposit Tx's and regular txs. This could also be done for the Timeout. L2 to L1 state update: - Implement an ICS-02 client with ZK proof of the state machine. This would live on the Celestia chain and there would be one per rollup. - The Client State itself contains the verification key(s) for state updates and for proofs of inclusion/exclusion in state. - The ConsensusState contains the state root and the timestamp - UpdateClient takes in a ClientMessage that includes a ZK proof of the next state update and verifies it before adding the next ConsensusState - Misbehaviour performs a no-op since we do not have misbehaviour in ZK rollups - VerifyMembership accepts a CommitmentProof that is a ZK proof of the commitment to a Path and Value at the given State root (ie. proving that an IBC packet was committed on the rollup) - Similar logic for VerifyNonMembership With these clients in place, ICS-20 can be layered on top by standard means, allowing for transfers to and from rollups. Each ICS-20 channel would involve its own escrow account on the Celestia chain. This does mean there are more state objects on Celestia than just a single `SnarkAccount` but the benefit is that with the client mechanics in place we can easily layer multiple different IBC protocols (token transfer, interchain accounts, nft transfer, etc) on top of a single client. All the replay protection for token transfers comes from the ICS-20 standard itself. However, as we cover next, ICS-20 does have significant state bloat, though this can be addressed. ## State Pruning The ICS-20 flow is as follows. On a sender chain (eg. the rollup), a user initates an IBC transfer with a specified timeout which results in funds being escrowed and an "outgoing" packet commitment stored in state. Proof of this packet is then relayed to the receiver chain (eg. Celestia). On receiving, the receiver chain stores a receipt (hash of the packet), and creates and stores an acknowledgement, which is then relayed back to the sender. If the receiver does not receive the packet in time, the original packet times out. No future receiving of the packet is possible, and the sender can time out the packet. In either case, the sender prunes everything, but the receiver does not (for the sake of replay protection). Thus during a succesful transfer the receiver stores both the receipt commitment and the ack commitment, and it does this for every packet, which is obviously significant state bloat. While this is overall problem for IBC chains that needs to be addressed, it's especially acute for chains with high IBC traffic, and would presumably be a barrier to Celestia adopting it for communication with its rollups. Fortunately, a simple extension of the IBC protocol (ICS-04 unordered channels, which ICS-20 is an instance of) should allow for the receiver commitments to be safely pruned, though this would require an extra message on the receiver. Once the packet timeout has passed, a proof that the sender has pruned everything can be sent to the receiver, allowing it to prune the commitments related to that packet. At this point, all intermediate data from the packet would be pruned from state.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully