Skip to content
 
 

Repository files navigation

Yoimiya Binary SDK

Production-ready, pre-built Zero-Knowledge Proving SDK for Windows, Linux, macOS, Android, and iOS.

This is the binary distribution—no compilation needed. Choose your platform and language binding below.

Platform Status Architecture
Windows x86_64
Linux x86_64
macOS x86_64, ARM64 (Apple Silicon)
Android ARMv8
iOS ARM64

Language Bindings: C • Python • Node.js • C#


📦 Getting Started

Step 1: Download — Get the binary SDK from releases

Step 2: Extract

# Unix-like systems
tar -xzf yoimiya-sdk-v0.1.0.tar.gz
cd yoimiya-sdk-0.1.0

# Windows
unzip yoimiya-sdk-v0.1.0.zip
cd yoimiya-sdk-0.1.0

Step 3: Choose your language — Pick Python, Node.js, C, or C# below.

All libraries are pre-built. No compilation required.


� What's Included

yoimiya-sdk-0.1.0/
├── platforms/              ← Pre-built binaries (pick your OS)
│   ├── windows-x86_64/     ← Windows users
│   ├── linux-x86_64/       ← Linux x86_64 users
│   ├── macos-x86_64/       ← macOS Intel users
│   ├── macos-aarch64/      ← macOS Apple Silicon users  
│   ├── android-armv8/      ← Android users
│   └── ios-arm64/          ← iOS users
│
├── include/                ← C header file (yoimiya.h)
│
├── bindings/               ← Language-specific bindings
│   ├── python/             ← Python: pip install .
│   ├── nodejs/             ← Node.js: npm install
│   └── csharp/             ← C#: binding code
│
├── examples/               ← Working example programs
│   ├── c_example.c
│   ├── python_example.py
│   ├── nodejs_example.js
│   └── circuits/           ← Test circuit files
│       ├── test_circuit.r1cs
│       ├── test_circuit.acir
│       └── test_circuit.plonkish
│
└── docs/                   ← Full API documentation

�🚀 Installation by Language

Python

cd bindings/python
pip install .

First proof:

from yoimiya import generate_test_srs, prove_test

srs = generate_test_srs(max_degree=2048)
proof = prove_test(num_constraints=500, witness=[1,2,3,4], srs=srs)
assert proof.verify(srs)
print("✓ Proof valid!")

With circuit files:

from yoimiya import prove_r1cs, prove_r1cs_field, prove_acir, prove_plonkish

# R1CS with u64 witness
proof_r1cs = prove_r1cs("path/to/circuit.r1cs", witness=[1,2,3], srs=srs)

# R1CS with Circom / 254-bit BN254 field-element witness (integers may exceed u64)
proof_r1cs_field = prove_r1cs_field("path/to/circuit.r1cs", witness=[large_int, ...], srs=srs)

proof_acir = prove_acir("path/to/circuit.acir", witness=[1,2,3], srs=srs)
proof_plonkish = prove_plonkish("path/to/circuit.plonkish", witness=[1,2,3], srs=srs)

Test circuit files are in examples/circuits/ for quick testing.

Aggregating and rolling up to chain:

from yoimiya import aggregate, aggregate_batches

# Level 1: each compute node folds its own proofs
batch_a = aggregate(proofs_node_a, srs)  # any number of proofs
batch_b = aggregate(proofs_node_b, srs)

# Level 2: fold all node batches into one 275-byte on-chain submission
super_batch = aggregate_batches([batch_a, batch_b])
calldata = super_batch.to_calldata()  # always 275 bytes
# submit calldata to YoimiyaBatchVerifier.verifyBatch()

Node.js

cd bindings/nodejs
npm install
node  # Interactive REPL

First proof:

const { generateTestSrs, proveTest } = require('yoimiya-sdk');

const srs = generateTestSrs(2048);
const proof = proveTest(500, [1n, 2n, 3n, 4n], srs);
console.log(proof.verify(srs)); // true

C

Link with pre-built library:

On Linux:

gcc -o myapp myapp.c \
  -I./include \
  -L./platforms/linux-x86_64 \
  -lyoimiya
./myapp

On Windows (MSVC):

cl myapp.c /I.\include /link /LIBPATH:.\platforms\windows-x86_64 yoimiya.lib
myapp.exe

On macOS:

clang -o myapp myapp.c \
  -I./include \
  -L./platforms/macos-x86_64 \
  -lyoimiya
./myapp

Sample code:

#include <yoimiya.h>

YoimiyaSrs* srs = yoimiya_generate_test_srs(2048);
YoimiyaProof* proof = yoimiya_prove_test(500, witness, len, srs);
int valid = yoimiya_verify(proof, srs);  // 1 = valid, 0 = invalid
yoimiya_free_proof(proof);
yoimiya_free_srs(srs);

C#

Add the binding and use:

using Yoimiya.SDK;

var srs = YoimiyaSdk.GenerateTestSrs(2048);
var proof = YoimiyaSdk.ProveTest(500, witness, srs);
bool valid = proof.Verify(srs);
Console.WriteLine(valid ? "✓ Proof valid!" : "✗ Proof invalid!");

Full binding: bindings/csharp/Yoimiya.cs


📊 Performance

Benchmark Results (Windows x86_64 reference hardware, March 2026):

Operation Time
Prove 100 constraints 0.28 ms
Prove 500 constraints 0.34 ms
Prove 1,000 constraints 0.49 ms
Prove 2,000 constraints 0.82 ms
Verify proof (any size) ~0.59 ms
Aggregate 2 proofs 2.7 µs
Aggregate 5 proofs 9.3 µs
Aggregate 10 proofs 21.7 µs

Rollup-scale batching — fold N per-node BatchProofs into one 275-byte on-chain submission:

Node batches folded Time
100 nodes 0.42 ms
500 nodes 4.92 ms
1,000 nodes 16.9 ms

Verify time is constant at ~0.59 ms regardless of how many proofs are inside the batch.


⚡ Competitive Positioning

Competitor Their edge How Yoimiya closes it
gnark Hand-tuned AVX-512 MSM, fast FFT CDG+Mira bypasses FFT entirely; parallel chunked Pippenger closes the MSM gap
Barretenberg C++ SIMD, 15+ years of optimization Full Mira's O(1) memory advantage is permanent — no C++ rewrite overcomes memory bandwidth limits
snarkjs Circom ecosystem size Yoimiya parses .r1cs natively with 254-bit field-element witnesses; prove_r1cs_field() is a drop-in
Risc0 / SP1 Arbitrary RISC-V programs Different use case — not competing on raw constraints/second

The unique advantage: aggregate_batches() folds 1,000 independent proofs from any mix of circuit types into a single 275-byte on-chain submission in 16.9 ms via Full Mira accumulation — no trusted setup, no recursive SNARK. gnark and Barretenberg require a full recursive SNARK (100–500 ms, circuit-specific) to achieve equivalent compression. On-chain gas is the same whether the batch contains 1 proof or 1,000.


📚 Examples

Each language has a complete working example:

  • C: examples/c_example.c — Full workflow example
  • Python: examples/python_example.py — Integration example
  • Node.js: examples/nodejs_example.js — Service example
  • C#: Check docs/ for usage patterns

Run Examples

# Python
cd examples
python3 python_example.py

# Node.js  
node nodejs_example.js

# C
gcc -o c_example c_example.c \
  -I../include \
  -L../platforms/linux-x86_64 \
  -lyoimiya
./c_example

🔧 Building from Source (SDK Developers Only)

This is a binary distribution—you don't need to build anything.

To modify the SDK source or rebuild binaries for a new platform:

  1. Clone the source repo
  2. See the private repo README for build instructions

Note: Source builds require Rust 1.70+ and platform-specific toolchains.


� TEE Attestation Pinning (Optional)

Proving always runs on the server with full CPU access — rayon threads, file I/O, no restrictions. The TEE only receives the 32-byte proof hash and signs it with a sealed P-256 key. This proves server identity without any impact on proving performance.

Server (no TEE restrictions — full CPU, rayon, file I/O):
  Yoimiya prover → 275-byte blob → sha256(blob) → TEE enclave

TEE enclave (Intel SGX / AMD SEV-SNP / AWS Nitro):
  receives 32-byte hash → signs with sealed P-256 key → returns (R, S)

On-chain (~62k gas flat, forever):
  verifyBatchWithAttestation(blob, R, S)
  ├── KZG pairing check    ~57,300 gas
  └── P-256 precompile     ~3,450 gas  (RIP-7212 at 0x0100)

Setup (one time): Verify hardware attestation quote off-chain → extract P-256 pubkey → call pinTeeKey(keyX, keyY) (~30k gas, owner only). Key is immutable after pinning.

Python:

from yoimiya import aggregate

batch = aggregate(proofs, srs)
blob  = batch.to_calldata()    # 275-byte on-chain blob
hash_ = batch.proof_hash()     # sha256(blob) — send to TEE for signing
# TEE signs hash_ → (r, s)
# on-chain: verifyBatchWithAttestation(blob, r, s)  ← ~62k gas

Gas costs on L2 (Base / OP Mainnet):

Call Gas ~USD
pinTeeKey(x, y) — one time ~30,000 < $0.001
verifyBatch(blob) — no TEE ~58,000 < $0.001
verifyBatchWithAttestation(blob, r, s) ~62,000 < $0.001

TEE is fully optional. Teams that don’t use a TEE simply call verifyBatch() and never call pinTeeKey(). Both paths coexist in the same contract.


�🔗 API Overview

Core Types

Type Purpose
Srs Structured Reference String for proving/verification
Proof Single circuit proof
BatchProof Aggregated batch of proofs

Core Functions

Function Purpose
generate_test_srs(max_degree) Generate SRS
precompiled_test_srs(num_constraints) Get bundled SRS (no generation)
prove_test(constraints, witness, srs) Prove test circuit
prove_test_precompiled(constraints, witness) Prove with bundled SRS
prove_r1cs(path, witness, srs) Prove R1CS circuit file
prove_acir(path, witness, srs) Prove ACIR circuit file (Noir)
prove_plonkish(path, witness, srs) Prove Plonkish circuit file (Halo2)
verify(proof, srs) Verify single proof
verify_precompiled(proof) Verify with bundled SRS
aggregate_proofs(proofs[], srs) Aggregate proofs into batch
aggregate_batches(batches[]) Fold batches into super-batch
multi_batch_calldata(batches[]) Serialize N batches for multi-batch verify
batch.to_calldata() Serialize batch to 275-byte on-chain blob
batch.proof_hash() SHA-256 of blob — message for TEE to sign
detect_hardware() Get CPU info and optimal parameters

💡 Common Tasks

Prove and Verify

# Generate one-time SRS
srs = generate_test_srs(max_degree=2048)

# Prove a circuit
proof = prove_test(
    num_constraints=100,
    witness=[1, 2, 3, 4],
    srs=srs
)

# Verify locally (off-chain)
assert proof.verify(srs), "Proof invalid!"

Batch Processing

# Collect multiple proofs
proofs = []
for witness_data in batch_witnesses:
    proof = prove_test(100, witness_data, srs)
    proofs.append(proof)

# Aggregate into single batch proof
batch_proof = aggregate_proofs(proofs, srs)

# Verify batch (more efficient)
assert batch_proof.verify(srs), "Batch proof invalid!"

Super-Batch Aggregation (Batch-of-Batches)

# Level 1: Each service creates its own batch
batch_a = aggregate_proofs(proofs_a, srs)
batch_b = aggregate_proofs(proofs_b, srs)

# Level 2: Fold all batches into one super-batch
super_batch = aggregate_batches([batch_a, batch_b])

# Serialize for on-chain multi-batch verification
blobs = multi_batch_calldata([batch_a, batch_b])

On-Chain Verification

Two Solidity contracts are provided:

Contract Gas (single) Multi-batch TEE-attested Use case
YoimiyaBatchVerifier.sol ~58,000 ~62,000 Simple + TEE
YoimiyaOptimizedVerifier.sol ~64,000 ~22k/batch High-throughput

L2 gas costs (Base / OP Mainnet, 0.005 gwei, $2,500 ETH):

Function Gas ~USD
pinTeeKey(x, y) — one time ~30,000 < $0.001
verifyBatch(blob) ~58,000 < $0.001
verifyBatchWithAttestation(blob, r, s) ~62,000 < $0.001
verifyMultiBatch(blobs[]) ~22k/batch < $0.001/batch
verifyOnly(blob) ~34,000 < $0.001

📖 Full Documentation

See docs/README.md for:

  • Detailed API reference
  • Complete examples for each language
  • Performance metrics
  • On-chain verification guide
  • Troubleshooting

📄 License

Business Source License 1.1 (BSL-1.1)

See LICENSE file for terms.


🔗 Links


🤝 Support


Built with ❤️ by Atlas Protocol

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages