{"id":27021207,"url":"https://github.com/jonas089/spectre-rad","last_synced_at":"2025-07-14T18:15:17.293Z","repository":{"id":258560115,"uuid":"873889052","full_name":"jonas089/spectre-rad","owner":"jonas089","description":"Zero Knowledge Ethereum Lightclient in Rust (SP1, Risc0) ","archived":false,"fork":false,"pushed_at":"2025-02-06T13:03:04.000Z","size":11694,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T19:46:15.314Z","etag":null,"topics":["consensus","ethereum","light-client","risc0","sp1","zkvm"],"latest_commit_sha":null,"homepage":"https://github.com/ChainSafe/Spectre","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonas089.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-16T22:30:21.000Z","updated_at":"2025-03-17T23:03:56.000Z","dependencies_parsed_at":"2024-12-02T13:27:54.151Z","dependency_job_id":"ad9f3112-f0dc-4c13-b667-6954f357dfeb","html_url":"https://github.com/jonas089/spectre-rad","commit_stats":null,"previous_names":["jonas089/spectre-rad"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jonas089/spectre-rad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas089%2Fspectre-rad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas089%2Fspectre-rad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas089%2Fspectre-rad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas089%2Fspectre-rad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonas089","download_url":"https://codeload.github.com/jonas089/spectre-rad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas089%2Fspectre-rad/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265328379,"owners_count":23747890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consensus","ethereum","light-client","risc0","sp1","zkvm"],"created_at":"2025-04-04T19:43:06.794Z","updated_at":"2025-07-14T18:15:17.215Z","avatar_url":"https://github.com/jonas089.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast, Modular \u0026 Secure ZK Ethereum Light Client 🧪\n![cover](https://github.com/jonas089/spectre-rad/blob/master/resources/banner.png)\n\n# Spectre Use Cases\nSpectre is a trust minimized light-client for `Ethereum`. With Spectre it is possible to cryptographically verify the integrity of Ethereum `state root`.\nLightclients are essentially cryptographic infrastructure that make all queries to a blockchain verifiable and therefore enhance security.\nWithout lightclients the development of secure decentralized applications would be challenging since they would have to query many nodes rather than \nrelying a single source of truth. Additionally there would be no way to verify the integrity of the state transitions even when querying a large number\nof nodes.\n\n\n\u003e [!NOTE]\n\u003e Spectre makes blockchain queries secure \n\u003e by proving that the state is valid through cryptography(ZK). \n\n\n## Naming convention for crates\n\n`iso-*`: Raw Rust implementation of a Spectre component in Isolation. Example: `committee-iso` for the `CommitteeUpdateCircuit` logic.\n\n`circuit/rz-*`: Risc0 circuit implementation of an `iso` component.\n\n`circuit/sp1-*`: SP1 circuit implementation of an `iso` component.\n\n\n`prover`: A special crate that generates proofs using either of the `circuits`. This crate will be extended to support verification on `AlignedLayer`.\n\n# Benchmarks\nBenchmarking the Step and Committee Circuits on different machines in SP1 and Risc0\n\n## Proving Speed Benchmarks\nBenchmarks were performed on SP1 v3.4.0, but we migrated to 4.x. \nTherefore more recently performed benchmarks may differ from the results listed here.\n\n### Step Circuit\n| Hardware | 1x H100 lambdalabs 80 GB sxm5 |\n| --- | --- |\n| wrapped (groth16) | 91.6s |\n| wrapped (plonk) | 170.8s |\n| generic (SP1) | 43.2s |\n\n### Commitee Circuit\n| Hardware | 1x H100 lambdalabs 80 GB sxm5 |\n| --- | --- |\n| wrapped (groth16) | 56.9s |\n| wrapped (plonk) | 137.6s |\n| generic (SP1) | 22.1 |\n\n### Sync Committee Rotation\n| Hardware | 1x GH200 lambdalabs 96 GB pcie |\n| --- | --- |\n| wrapped (groth16) | 239.1s |\n| wrapped (plonk) | 289.5s |\n\n\u003e [!WARNING]\n\u003e This benchmark was performed on less powerful hardware, using SP1 v4.0.1.\n\n# Circuit Inputs and Outputs\nIn ZKVMs we refer to public outputs as information committed to the `journal`. Inputs can either be committed or kept a secret.\n\n## The Beacon Header\n|  Input  | Type |\n| ------------- | ------------- |\n| slot  | int  |\n| proposer_index  | int  |\n| parent_root | Vec\u003cu8\u003e |\n| state_root | Vec\u003cu8\u003e |\n| body_root | Vec\u003cu8\u003e |\n\n## 1. Committee-Circuit\n\n### 1.1. Inputs\n|  Input  | Type |\n| ------------- | ------------- |\n| Public Keys Compressed  | [u8;49] |\n| Finalized Header  | BeaconBlockHeader  |\n| Sync Committee Branch | Vec\u003cVec\u003cu8\u003e\u003e |\n\n### 1.2. Outputs\n| Output | Type |\n| ------------- | ------------- |\n| Key Commitment  | [u8;32] |\n| Finalized Block (Header) Root  | [u8;32] |\n\n## 2. Step-Circuit\n### 2.1. Inputs\n| Input | Type |\n| ------------- | ------------- |\n| Aggregate Signature  | [u8;32] |\n| Public Keys Uncompressed  | Vec\u003c[u8;96]\u003e |\n| Participation bits  | Vec\u003cbool\u003e |\n| Attested Header  | BeaconBlockHeader |\n| Finalized Header | BeaconBlockHeader |\n| Finality Branch | Vec\u003cVec\u003cu8\u003e\u003e |\n| Execution Payload Root | Vec\u003cu8\u003e |\n| Execution Payload Branch | Vec\u003cVec\u003cu8\u003e\u003e |\n| domain | [u8;32] |\n| Committee Commitment | [u8;32] |\n\n### 2.2. Outputs\n| Output | Type |\n| ------------- | ------------- |\n| Slot Number | u32 |\n| Key Commitment  | [u8;32] |\n| Finalized Block (Header) Root | [u8;32] |\n\n\n## 3. Rotation Circuit\n### 3.1. Inputs\n```rust\npub struct RotationCircuitInputs {\n    pub committee: CommitteeUpdateArgs,\n    pub step: SyncStepCircuitInput,\n}\n```\n### 3.2. Outputs\n| Output | Type  |\n| ------------- | ------------- |\n| Slot Number | u32 |\n| Commitment | bytes32 |\n| Finalized Header Root | bytes32 |\n| Next Commitment | bytes32 |\n\n\u003e [!NOTE]\n\u003e These are wrapped (Ethereum/Sol) types.\n\n## Generate (\u0026Verify) a proof for the Committee Circuit in Risc0\nPrerequisites:\n\n- Rust installation\n- Risc0 toolchain\n- Risc0 client `1.1.2`\n\n[Install Risc0](https://dev.risczero.com/api/zkvm/install)\n\n`rzup install cargo-risczero \u003cversion\u003e`\n\nRun this command:\n\n```bash\ncd prover\ncargo test --bin prover test_committee_circuit_default_sp1 -- --nocapture\n```\n\n- `-F metal` for metal acceleration (M2, M3 Macbooks)\n- `-F cuda` for cuda acceleration (NVIDIA GPUs)\n\n\u003e [!NOTE]\n\u003e Running the step circuit in `Risc0` only really makes sense on powerful hardware,\n\u003e currently it takes 40 minutes on my M3 Max Macbook Pro.\n\u003e `SP1` does not have metal acceleration so therefore `cuda` is recommended. \n\u003e For `Risc0` a strong Nvidia GPU or Rig should be better than the M3.\n\nMake sure to specify the path to `rotation_512.json` as an environment variable when running any of the integration tests that are related to the committee circuit.\n\nExample:\n\n```bash\nexport COMMITTEE_UPDATE_TEST_PATH=\"/Users/USERNAME/Desktop/spectre-rad/data/rotation_512.json\"\n```\n\nExample output:\n\n```rust\n   Compiling host v0.1.0 (/Users/chef/Desktop/spectre-rad/circuits/rz-committee/host)\n    Finished `dev` profile [optimized + debuginfo] target(s) in 0.95s\n     Running `target/debug/host`\nVerified Committee Root: [25, 122, 75, 125, 192, 12, 117, 238, 92, 109, 3, 192, 224, 63, 84, 28, 196, 131, 90, 32, 180, 39, 160, 7, 188, 177, 162, 100, 181, 205, 38, 142]\n```\n\n## Generate (\u0026Verify) a proof for the Step Circuit in Risc0\n\nRun this command:\n\n```bash\ncd prover\ncargo test test_step_circuit_default_sp1 -- --nocapture\n```\n\nMake sure to specify the path to `sync_step_512.json` as an environment variable when running any of the integration tests that are related to the step circuit.\n\nExample:\n\n`see above`\n\n## Test Data\n\nTest data for the circuit can be found in `data/*.json`. \nThe `rotation_512.json` file is used with the committee circuit,\nthe `sync_step_512.json` file is used with the step circuit.\n\n## Deployment - Theory\n\nIn order to deploy this prover in production, one would have to query one or more trusted Ethereum consensus nodes for `sync steps` and `committee updates`. \nWhenever a new `committee update` occurs, it must be applied before new `sync steps` can be proven. A solidity contract should handle the `committee updates` seperately to \nthe `sync steps` and aim to expose the most recent trusted Ethereum root.\n\n\u003e [!NOTE]\n\u003e `Sync steps` are always verified against the most recent committee.\n\n# Smart Contract\nThe verification Smart Contract is located in `spectre-verifier/src/Verifier.sol`. \nIt is initialized with a `trusted committee commitment` and `finalized header`.\nNote that a `committee commitment` refers to a commitment over the public keys in the active committee.\n\nExperimental deployment (developer notes):\n\n```rust\n✅  [Success] Hash: 0xf3d1d7505ea334542cc1e0954974e42e320e0ec73f0b5de3968340205ea0acdb\nContract Address: 0xE45E2ae4C38B951e6ad0aDEd86C108Bb4b9ad16f\nBlock: 7549914\nPaid: 0.000526296619253219 ETH (453433 gas * 1.160693243 gwei)\n```\n\n# Integrations - third party proof verification infrastructure\nWork in progress ⚙️⚙️\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonas089%2Fspectre-rad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonas089%2Fspectre-rad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonas089%2Fspectre-rad/lists"}