Skip to content

NikitaMasych/fibonacci-nostd

Repository files navigation

Plonky2 Fibonacci no-std | WASM

This repository demonstrates that plonky2 proof verification works in wasm.

Execute

wasm-pack build --target web
npx http-server . -o

Data

You can see how proof_with_public_inputs.bin and verifier_data.bin are composed in src/bin

Launch this command to trigger circuit end-to-end; output the needed data in files:

cargo run --bin fibonacci

Launch this command to see how verification only happens using deserialized info.

cargo run --bin verify

Additional info

After trying to run end-to-end circuit execution, including building and proving, in wasm, it was discovered that failure happens on this step:

let data = builder.build::<C>();

Check out the exact line

So, even though verification part works in wasm, plonky2 in its completion may not be supported.

Benches

You can compare performance of the factorial circuit verification in WASM and native rust.

Environment: MacBook Pro M2 Max 32 GB 1 TB Storage

Rust:

cargo bench

WASM:

Same steps for executing, you will see timings in browser console.

Results

Rust: 1.13 ms WASM: 13 ms

About

Plonky2 Fibonacci no-std | WASM

Topics

Resources

Stars

Watchers

Forks