Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,052 changes: 2,059 additions & 993 deletions tests/Cargo.lock → Cargo.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]
members = [
"program",
"script",
]
resolver = "2"

[workspace.dependencies]
alloy-sol-types = "0.7.7"
21 changes: 21 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Succinct Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Cryptographic Sync Project

This project implements a cryptographic synchronization system using [SP1](https://github.com/succinctlabs/sp1), a zero-knowledge virtual machine for RISC-V programs.

Reimplementation of [celestia-recursive-sync](https://github.com/S1nus/celestia-recursive-sync/tree/main) using SP1.

## Requirements

- [Rust](https://rustup.rs/)
- [SP1](https://docs.succinct.xyz/getting-started/install.html)

## Project Structure

The project consists of two main components:

1. `program`: Contains the RISC-V program that performs the cryptographic operations.
2. `script`: Contains the Rust script to build, execute, and generate proofs for the program.

## Running the Project

```
cd program
cargo build
cd ../script
cargo run --release
```

### Output
```
Running `target/release/main`
[?] Loading proof from file...
[#1] encoded len: 1 (null genesis header)
[#1] encoded len: 40885 (first header)
[?] Initializing ProverClient #1...
Writing verification key and additional data...
[?] Generating proof0...
stdout: [ZK] Verifying genesis header (nil + h2)...
stdout: [ZK] Verifying genesis header (nil + h2)...
stdout: [ZK] Verifying genesis header (nil + h2)...
[+] proof0 generation time: 337.920366667s
[?] Saving proof #0 to file...
[+] Reading public values from proof...
-> 1st hash: [182, 233, 193, 235, 0, 146, 86, 229, 224, 49, 98, 229, 130, 123, 78, 220, 176, 246, 0, 178, 8, 4, 0, 114, 215, 21, 148, 106, 197, 64, 254, 88]
-> 2nd hash: [182, 233, 193, 235, 0, 146, 86, 229, 224, 49, 98, 229, 130, 123, 78, 220, 176, 246, 0, 178, 8, 4, 0, 114, 215, 21, 148, 106, 197, 64, 254, 88]
-> result: true
[?] Initializing ProverClient #2...
[#2] encoded len: 40885 (genesis header)
[#2] encoded len: 41453 (first header)
Writing verification key and additional data...
[?] Generating proof #1...
stdout: [ZK] Verifying proof (h1 + h2)...
stdout: [ZK] Verifying proof...
stdout: [ZK] Done.
stdout: [ZK] Header verification...
stdout: [ZK] Success.
stdout: [ZK] Verifying proof (h1 + h2)...
stdout: [ZK] Verifying proof...
stdout: [ZK] Done.
stdout: [ZK] Header verification...
stdout: [ZK] Success.
stdout: [ZK] Verifying proof (h1 + h2)...
stdout: [ZK] Verifying proof...
stdout: [ZK] Done.
stdout: [ZK] Header verification...
stdout: [ZK] Success.
[+] proof1 generation time: 555.818201375s
[?] Saving proof1.json to file...
[+] Reading public values from proof...
-> 1st hash: [182, 233, 193, 235, 0, 146, 86, 229, 224, 49, 98, 229, 130, 123, 78, 220, 176, 246, 0, 178, 8, 4, 0, 114, 215, 21, 148, 106, 197, 64, 254, 88]
-> 2nd hash: [21, 215, 48, 134, 90, 6, 9, 102, 57, 115, 99, 48, 222, 189, 17, 93, 97, 63, 169, 141, 76, 158, 2, 10, 154, 218, 170, 166, 172, 58, 63, 7]
-> result: true

[+] Success.
```
Binary file added elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
Loading