Git Product home page Git Product logo

zkvm's Introduction

ZKVM

Intro

We want to build a ZKP that validates an entire EVM block or as much of it as we can efficiently. Its okay to adjust the gas costs for every EVM opcode. Its also to exclude some opcodes for now if they are super expensive. Its okay to exclude precompiles.

This repo creates a sketch of how this can work as a way to explain but also to get the idea clear in my mind.

Arch

We have two proofs that we use to prove validity of the state transition

Proof 1: Contruct the stack

We construct a commitment to the stack that is being executed.

So here we do loads AND stores happen as well as membership proofs. The comimmtent to the new state after this block is also stored.

The commitment is the whole stack for that block. It includes the op codes AND the variables that are loaded from memory.

[barry] Signatures go here too ?

Proof 2: Execution

For each opcode in the stack we execute it and update the stack.

Each EVM opcode is a custom constraint. We select the custom constraint based upon the stack and execute that.

Variables used

State proof variables

  1. Opcodes: A list of the codecodes that can get executed.

  2. Execution Map: An ordered list of the index (in Opcodes) of all the opcodes that get executed.

  3. StateQue: An ordered list of all the State objects that get loaded from or written to the state.

  4. MemoryQue: An ordered list of variables that get loaded from or written to memory.

EVM proof variables

  1. ExectionContext[]: This containts an opcodes instance, MemoryPage instance, stackCount instance , ExecutionMap and msg.sender.
  2. ExecutionContextIndex: This is the index of the currently exectued ExecutionContext.
  3. Opcodes: This is an array of the opcodes to be executed in this ExecutionContext.
  4. stackCount: The position in the stack that the next opcode to be read is from.

zkvm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

0xyicheng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.