🛠️ Uses zkevm-circuits and anvil mainnetfork to prove that a tx solves an EVM challenge

Overview

zk-proof-of-evm-execution

This is a PoC developed at hackathon that enables a user to prove that they know some calldata that can solve a challenge on EVM.

How does it work?

This project depends on:

A block is locally mined containing the transaction which solves challenge. This block is used as a witness to the SuperCircuit.

The transaction is expected to flip a slot termed as "challenge slot" in a contract. E.g.

contract Challenge {
    function isSolved() public returns (bool) {
        // arbitrary challenge somewhere on EVM
    }
    
    // challenge slot
    bool slot;
    function solve() public {
        slot = isSolved();
    }
}

Potential use cases

  • Decentralised CTF (not practical as of now, since current prover effort is very huge).
  • Whitehat can prove knowledge of vulnerability on smart contract (by constructing it as a challenge).

Demo

Clone the repo and build.

cargo build --release

This creates a binary:

./target/release/prove  --help
Usage: prove [OPTIONS] --rpc-url <ETH_RPC_URL> --fork-block <FORK_BLOCK_NUMBER> --challenge-address <CHALLENGE_ADDRESS> --challenge-slot <CHALLENGE_SLOT> --raw-tx <RAW_TX>

Options:
      --rpc-url <ETH_RPC_URL>                  Archive node for mainnet fork [required]
      --fork-block <FORK_BLOCK_NUMBER>         Block number for mainnet fork [required]
      --challenge-address <CHALLENGE_ADDRESS>  Address of contract containing challenge slot [required]
      --challenge-slot <CHALLENGE_SLOT>        Storage slot that should be flipped by a correct solution [required]
      --raw-tx <RAW_TX>                        Witness tx, which should solve the challenge [required]
      --mock                                   Use MockProver for fast constraint verification [default: false]
      --print                                  Print witness and public inputs that has been provided to zkevm circuits [default: false]
      --dir <DIR>                              Directory for reading and writing [default: false] [default: ]
  -h, --help                                   Print help
  -V, --version                                Print version

Currently using real prover has a lot of system requires, mock prover consumes less resources. An example challenge and solution:

./target/release/prove     
  --mock      
  --rpc-url https://eth-sepolia.g.alchemy.com/v2/<api-key>      
  --fork-block 3147881      
  --challenge-address 0xdf03add8bc8046df3b74a538c57c130cefb89b87      
  --challenge-slot 0      
  --raw-tx 0xf88c8084ee6b28008301388094df03add8bc8046df3b74a538c57c130cefb89b8680a46057361d00000000000000000000000000000000000000000000000000000000000000018401546d72a0f5b7e54553deeb044429b394595581501209a627beef020e764426aa0955e93aa00927cb7de78c15d2715de9a5cbde171c7202755864656cd4726ac43c76a9000a
You might also like...
Selendra is a multichains interoperable nominated Proof-of-Stake network for developing and running Substrate-based and EVM compatible blockchain applications.

Selendra An interoperable nominated Proof-of-Stake network for developing and running Substrate-based and EVM compatible blockchain applications. Read

An extensible and practical demonstration of constructing evm-based sandwich attacks built with ethers-rs and Huff language.
An extensible and practical demonstration of constructing evm-based sandwich attacks built with ethers-rs and Huff language.

subway-rs • Construct evm-based sandwich attacks using Rust and Huff. Getting Started subway-rs is a port of libevm's original subway, implemented wit

Parser and test runner for testing compatable common Ethereum full node tests against Polygon Zero's EVM.

EVM Test Parses and runs compatible common Ethereum tests from ethereum/tests against Polygon Zero's EVM. Note: This repo is currently very early in d

Binding generator for EVM and ink!

Sumi is a binding generator specifically designed for Astar Network ecosystem with XVM in mind. It takes EVM metadata and converts it to an ink! modul

EVM compatible chain with NPoS/PoC consensus

Reef Chain Reef chain is written in Rust. A basic familiarity with Rust tooling is required. To learn more about Reef chain, please refer to Documenta

A temporary repo for ETH connector to be used by EVM

ETH connector for Rainbow bridge Definitions bridgedETH - NEP-141 fungible-token representation of ETH inside Near. nETH - native ETH inside Near EVM.

DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support

DeFiCh/metachain is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support . Proposed as a DFIP on Nov 2021; D

Minimalistic EVM-compatible chain indexer.

EVM Indexer Minimalistic EVM-compatible blockchain indexer written in rust. This repository contains a program to index helpful information from any E

Minimalistic EVM-compatible chain indexer.

EVM Indexer Minimalistic EVM-compatible blockchain indexer written in rust. This repository contains a program to index helpful information from any E

Owner
soham
buidling decentralized stuff... one commit at a time.
soham
Uses Plonky2 proof system to build recursive circuits for Merkle Trees.

ProvableMerkleTrees Introduction This repo provides Rust code to build Merkle Trees, equipped with a Provable interface to generate Zero Knowledge pro

null 5 Aug 18, 2023
deductive verification of Rust code. (semi) automatically prove your code satisfies your specifications!

Le marteau-pilon, forges et aciéries de Saint-Chamond, Joseph-Fortuné LAYRAUD, 1889 About Creusot is a tool for deductive verification of Rust code. I

Xavier Denis 609 Dec 28, 2022
Fastmurmur3 - Fast non-cryptographic hash, with the benchmarks to prove it.

Fastmurmur3 Murmur3 is a fast, non-cryptographic hash function. fastmurmur3 is, in my testing, the fastest implementation of Murmur3. Usage let bytes:

Kurt Wolf 13 Dec 2, 2022
A performant, type-1 zkEVM written in Rust & SP1.

SP1 Reth SP1 Reth is a 100% open-source POC that showcases how any rollup can use SP1 to build a performant (type-1, bytecode compatible) zkEVM with l

Succinct 90 Mar 24, 2024
A basic implementation of Yao's Garbled Circuits

yao-gc This is a rudimentary implementation of Yao's Garbled Circuits. This is a technique which allows two parties to evaluate a boolean function on

Lúcás Meier 21 Nov 23, 2022
Arkworks circuits for verifiable time-lock encryption

zk-timelock This repo contains arithmetic circuits for verifiable time-lock encryption made using arkworks-rs toolkit. For more details on such an enc

Timofey 68 Apr 5, 2023
Implementation of zero-knowledge proof circuits for Tendermint.

Tendermint X Implementation of zero-knowledge proof circuits for Tendermint. Overview Tendermint X's core contract is TendermintX, which stores the he

Succinct 3 Nov 8, 2023
A down-to-the-metal ongoing cryptography challenge designed by Radical Semiconductor.

woodpecker ?? [NOTE: scoreboard will now be updated weekends, starting the weekend of 12/10/2022--sorry for delays! I'll also be merging in pull reque

Radical Semiconductor 16 Dec 15, 2022
A challenge agent for Optimism written in pure Rust.

op-challenger • Note Work in progress. A set-and-forget challenge agent for the OP Stack written in pure Rust ?? Usage op-challenger [OPTIONS] \ --l

null 18 Apr 6, 2023
Fiddi is a command line tool that does the boring and complex process of checking and processing/watching transactions on EVM compatible Blockchain.

Fiddi is a command line tool that does the boring and complex process of checking and processing/watching transactions on EVM compatible Blockchain.

Ahmad Abdullahi Adamu 7 Jan 9, 2023