π°οΈ UltraHonk Verifier for Soroban: Arkworks-Based Rapid Prototyping & BN254 Precompile Integration #8509
Replies: 2 comments 8 replies
-
Hey @yugocabrio, thanks for this excellent proposal! I'm Tomer from the product team at SDF. Overall I think this is a great proposal with one caveat: I have some doubts about the feasibility and necessity of the custom BN254 backend. As you can see in this example using With that said, I believe the main value prop of this proposal is to provide an end-to-end functional prototype of ultrahonk running on stellar/soroban. For the purpose of the prototype it's ok to blow through the budget using If you do want to help take this to production in this proposal than instead of the custom backend I would consider creating a CAP for bn254 (similar to this for BLS12-381) and a PR implementing it to rs-soroban-env. @jayz22 from the stellar core team, who implemented the bls12-381 proposal, can provide guidance. |
Beta Was this translation helpful? Give feedback.
-
Hi @yugocabrio, thanks for the great write-up. Similar to my comment in the other proposal, minor suggestion on "Testing & Validation" that testing compatibility with just Barretenberg (instead of Taceo's co-noir) could better benefit all Noir devs working with Barretenberg. No other comment from me π |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
π°οΈ UltraHonk Verifier for Soroban: Arkworks-Based Rapid Prototyping & BN254 Precompile Integration
This proposal reflects our initial plan, and we welcome feedback or suggestions to align it better with community needs.
π Changelog
no_std
, and implement BN254 elliptic curve operations from scratch in userland Rust for Soroban.rs-soroban-env
, following the successful precedent of CAP-0059: Host Functions for BLS12-381.π Summary
We propose a Rust implementation of the UltraHonk verifier (from Taceo Labsβ co-noir), which is compatible with Aztec/Barretenberg proof formats and adapted for deployment on the Stellar Soroban.
Our primary goal is to deliver an end-to-end verifier prototype that runs on Sorobanβs
no_std
environment using Arkworks-based BN254 (ark_bn254). This enables rapid development and immediate compatibility testing with Noir proofs, while deferring native cryptographic integration as a future optimization via host functions (CAP).The verifier will use a modular elliptic curve abstraction trait, enabling the same core logic to operate over multiple cryptographic backends. This allows us to begin with a functional Arkworks-based verifier for development, while maintaining the possibility of transitioning to a native BN254 backend via host functions for the future.
This phased approach ensures:
ark_bn254
.Our primary deliverable is a fully functional and testable verifier prototype using Arkworks.
Thanks to the EC abstraction trait interface, we ensure that Phase 1 (Arkworks backend) and Phase 2 (native precompile) share the same core logic, requiring no major rewrites.
π Motivation
Noir, Aztecβs universal zkSNARK language, outputs proofs using the Barretenberg backend targeting the BN254 curve (alt_bn128) β widely adopted across Ethereum-compatible ZK systems.
However, Soroban currently supports only BLS12-381 via host functions, making it impossible to natively verify Noir-generated proofs. This limits integration with tools like Barretenberg and constrains ZK-based use cases.
To address this, we propose bringing UltraHonk, Aztecβs recursive SNARK verifier, to Soroban in a way that is feasible today and future-compatible with native BN254 support.
We propose building on the well-maintained, community-recognized co-snarks(co-noir) Rust-based UltraHonk implementation, which already targets Barretenberg v0.86.0. Rather than starting from scratch, we will adapt this mature Rust codebase to Soroban, ensuring correctness, upstream compatibility with Noir ecosystem, and efficient use of engineering resources focused on integration to Stellar Soroban and optimization.
π§ Strategy Shift: Prototype First with Arkworks, Plan for Native Integration
Feedback from the Soroban core team confirmed that BN254 operations in WASM exceed on-chain compute limits, especially for pairings. The recommended path is to use native host functions, as done for BLS12-381 (CAP-0059).
In response, we will:
ark_bn254
-based prototype in localnet (no compute limits),This two-phase strategy balances immediate progress with long-term viability.
Phase 1: Rapid Prototyping with
ark_bn254
ark_bn254
to prototype the UltraHonk verifier in localnet, where compute is unrestricted.std
-based verifier tono_std
for Soroban.Phase 2: BN254 Host Support via CAP
g1_add
,pairing
).rs-soroban-env
and SDK, modeled on BLS12-381.π§ Technical Constraints & Design Motivation
ark_bn254
) is actively maintained and used in co-noir β ideal for fast prototyping and integration.no_std
WASM target restrictsstd
, but supportsark_bn254
via its SDK allocator.π Ecosystem Impact
This project will deliver:
ark_bn254
, locally verifiable with unlimited compute.βοΈ Methodology
We will begin by developing and testing in Sorobanβs localnet environment, where relaxed compute limits allow end-to-end validation of proof verification using
ark_bn254
. This enables us to iterate quickly without being blocked by on-chain constraints.Our approach consists of two complementary tracks:
ark_bn254
, enabling local testing of proof format compatibility, hashing, and verification logic.By architecting the verifier around a modular elliptic curve trait, we ensure the core logic remains backend-agnostic β supporting seamless transitions from Arkworks-based development to future native precompile integration.
Phase 1: Rapid Prototyping with
ark_bn254
1. Verifier Extraction &
no_std
RefactorVerifier Extraction
src/verifier.rs
,src/decider/
,src/oink/
, andsrc/transcript.rs
, and trace all proof structure, memory, and transcript dependencies.no_std
RefactorWe will refactor the
UltraHonk::verify
stack into a#![no_std]
-compatible crate tailored for Soroban's WASM runtime.std
types (Vec
,String
,Arc
, etc.) withalloc
equivalents or eliminate where unneeded. Disabletracing
via#[cfg(feature = "std")]
.ark-ff
,ark-ec
,ark-bn254
, andco-builder
areno_std
-aware (default-features = false
). Replaceeyre
with lightweight error types orResult<T, ()>
.heapless::Vec
, and allocate withBox
where necessary to align with WASM's memory model.serde
and file I/O. ReimplementTranscript
andManifest
usingalloc
or static structures, and parse.proof
and.vk
from&[u8]
buffers.no_std
refactored UltraHonk Verifier can verify the proof correctly2. EC Trait Abstraction: Pluggable Backend Architecture
Following the architecture used in Renegade-Fi and our Stylus proposal, we introduce a unified trait that abstracts the core elliptic curve operations required by the UltraHonk verifier. Renegade-Fi uses Arkworks for development and switches to EVM precompiles for on-chain use. While Stylus and Soroban differ, both support Rust-based WASM, making this dual-backend model equally applicable to Soroban.
We define a unified interface,
G1ArithmeticBackend
, which encapsulates the core elliptic curve operations required for pairing-based proof verification:The verifier logic will be wrapped in a generic struct over the backend:
This abstraction cleanly separates the cryptographic implementation from the proof logic, allowing backends to define their own elliptic curve operations and associated serialization/deserialization strategies.
Phase 1:
ArkworksBackend
Implementation for DevelopmentIn the development phase, we implement this trait for Arkworks via
ark_bn254
, resulting in anArkworksBackend
. This backend will be used to run the verifier end-to-end within Sorobanβs localnet environment, where compute limits can be relaxed. It enables immediate validation of Noir-generated Barretenberg proofs in a testable and debuggable context.Phase 2:
SorobanPrecompileBackend
for On-Chain DeploymentIn the deployment phase, we implement a second backend,
SorobanPrecompileBackend
, where the trait methods are fulfilled via native host functions for BN254, introduced through a Soroban Core Advancement Proposal (CAP). These host functions will be exposed as precompiled operations, specifically designed for Sorobanβs native SDK and runtime.This backend enables full proof verification within Soroban's production compute budget, without altering the verifier logic itself.
π Shared Infrastructure across Stylus and Soroban Tracks
This proposal is part of a unified UltraHonk strategy targeting both Stellar Soroban and Arbitrum Stylus.
Despite different runtimes, both verifiers:
no_std
verifier core,G1ArithmeticBackend
trait.This architecture ensures maintainability, consistent correctness across platforms, and engineering efficiency through shared infrastructure.
3. Soroban Smart Contract Interface
Once both the verifier logic and BN254 backend(
ArkworksBackend
) are complete, we expose the verifier as a Soroban smart contract callable from external clients or other contracts.This contract interface is designed to be simple and developer-friendly, enabling on-chain proof verification with minimal integration overhead.
API
Inside the contract, we will deserialize all inputs from Bytes to native Rust types prior to invoking the core verifier:
Phase 2: BN254 Host Support via CAP
Using the same verifier logic from Phase 1, we simply swap out the
ArkworksBackend
for a newSorobanPrecompileBackend
. Thanks to theG1ArithmeticBackend
trait, this transition is seamless and requires no changes to the core verifier code.4. BN254 Precompile: CAP Proposal and Native Host Functions (Stretch Goal)
Our main deliverable is the
ark_bn254-based
prototype, but we intentionally structure the verifier to remain compatible with a potential native BN254 integration via a Soroban CAP, which we treat as an optional stretch goal. This allows us to seamlessly swap in native operations once available, without rewriting verifier logic.The CAP and host-side implementation are planned as a stretch goal, to be pursued in parallel where feasible. If timing and review bandwidth allow, we will also draft the CAP specification and contribute a reference PR to
rs-soroban-env
.a. Draft and submit a Soroban CAP defining BN254 host functions:
Introduction & Scope
Function Signatures & Semantics
bn254_g1_add
Bytes(g1)
,Bytes(g1)
Bytes(g1)
bn254_g1_mul
Bytes(g1)
,U256(scalar)
Bytes(g1)
bn254_g2_add
Bytes(g2)
,Bytes(g2)
Bytes(g2)
bn254_g2_mul
Bytes(g2)
,U256(scalar)
Bytes(g2)
bn254_pairing
Vec<Bytes(g1), Bytes(g2)>
Bool
bn254_fp2_mul
Bytes(fp2)
,Bytes(fp2)
Bytes(fp2)
Input/Output Encoding Formats
(c1, c0)
(x, y)
β 64 bytes(x_im, x_re, y_im, y_re)
β 128 bytesBytesObject
andVecObject
per Soroban SDK conventionsValidation & Checks
ERR_INVALID_LENGTH
ERR_MALFORMED_POINT
ERR_SUBGROUP
false
(ERR_PAIRING_MISMATCH
only for internal logs)References & Compatibility
alt_bn128
precompile test vectors for conformance.b. Implement a reference PR to
rs-soroban-env
:host/bn254.rs
: Rust definitions of each extern βCβ host function stub.bn254_impl/
: Pure-Rust optimized BN254 library (based on ark-bn254), no_std-compatible.tests/
:alt_bn128
vectors.examples/zk_snark_verifier.rs
.c. Integrate SDK support:
g1_mul
,g2_add
,pairing
, etc.Type Conversions & Serialization
(Point<Fp>, Scalar)
BytesObject
usingto_be_bytes()
.BytesObject
soroban_sdk::bn254
module for high-level usage.Example SDK Interface
This work is treated as a stretch goal β the verifier is fully usable with the Arkworks backend in development settings. Native precompile integration is only required for production-grade deployment.
5. Mathematical Structure of BN254
Soroban currently lacks native support for the BN254 elliptic curve (also known as
alt_bn128
), which is used in Noir/Barretenberg proofs. To enable on-chain proof verification within Soroban's instruction limit, we will build BN254 curve in precompiled layer. Also, we will commit our BN254 elliptic curve feature to native Soroban-SDK.Key Components to Implement
1. G1 / G2 Arithmetic (Affine & Projective Coordinates)
G1 (base curve over Fp):
G2 (twist over Fp2):
Subgroup Checks:
where
Group Generators:
2. Finite Field Arithmetic: Fp, Fp2, Fp6, Fp12
Fp:
add
,sub
,mul
,square
,inv
using Montgomery or extended Euclidean methodsFp2:
add
,sub
,mul
,square
,neg
,inv
Fp6 (cubic extension over Fp2):
Fp12 (quadratic extension over Fp6):
square
,inv
, and Frobenius map applicationsFrobenius Coefficients:
3. Pairing Computation
Loop Parameter:
Miller Loop:
Final Exponentiation:
6. Testing & Validation
nargo compile
)nargo execute witness
)bb prove
,bb write_vk
wasm
form versus precompile backend7. Deliverables
Phase 1: Prototype Verifier (Arkworks-based)
no_std
Rust verifier crate usingark_bn254
Phase 2 (Stretch Goal): BN254 Precompile Integration
rs-soroban-env
rs-soroban-sdk
π Schedule
Phase 1
β’ Project kickoff: clone co-noir UltraHonk repo, spin up Soroban localnet, CI baseline
β’ Extract core modules (
verifier.rs
,transcript.rs
,decider/
,oink/
)β’ Stub out data structures for proof, VK, transcript
β’ Remove std types in core modules: replace
Vec
,String
,Arc
βalloc
/heapless
β’ Disable tracing and file-
I/O
featuresβ’ Audit & strip heavy deps (
eyre
,serde
): substitute lightweight error typesβ’ Verify successful build on
#![no_std]
targetβ’ Finalize memory model: fixed-size buffers or Box alloc, avoid dynamic alloc
β’ Reimplement Transcript parsing from
&[u8]
bufferβ’ Define
G1ArithmeticBackend
trait (add
,mul
,pairing
)β’ Wire up
ark_bn254
forec_add
&ec_mul
viaArkworksBackend
β’ Implement
pairing
+ subgroup checks inArkworksBackend
β’ Map
Arkworks
errors to our traitβs Error typeβ’ Hook
ArkworksBackend
intoUltraHonk::verify
logicβ’ Eliminate residual std API calls
β’ Build Soroban contract stub for
fn verify_proof(proof: Bytes, vk: Bytes, public_inputs: Bytes, has_zk: bool) -> bool;
β’ Load proof/VK as
Bytes
in localnetβ’ End-to-end proof validation: run Barretenberg proofs against
#![no_std]
verifierβ’ Benchmark runtime in unrestricted localnet
β’ Optimize hotspots (e.g. buffer handling, pairing calls)
β’ Harden contract API: error codes, safe unwraps, logging
β’ Add unit tests for edge cases (empty proof, malformed VK)
β’ Write README: getting started, build instructions, example CLI & contract calls
β’ Prepare tutorial showing proof generation β on-chain verify
β’ Internal demo for stakeholders: showcase prototype in Soroban localnet
β’ Gather feedback & adjust Phase 2 plans
Phase 2
β’ Outline CAP structure (mirror CAP-0059): intro, scope, function list
β’ Define host fns:
bn254_g1_add
,g2_mul
,pairing
, etc.β’ Detail I/O encoding (Fp, Fp2, G1, G2 byte formats)
β’ Specify error codes, length & subgroup checks
β’ Circulate draft with Stellar core team
β’ Incorporate feedback, finalize CAP document
β’ Add
extern "C"
host-function stubs inrs-soroban-env
β’ Define raw byte interfaces for each BN254 op
β’ Implement Fp arithmetic (add, sub, mul, inv) in 256-bit Montgomery form
β’ Implement Fp2 (complex), Fp6 & Fp12 extensions
β’ Implement G1/G2 projective formulas & subgroup checks
β’ Miller loop & final exponentiation for Optimal Ate pairing
β’ Add high-level wrappers in
soroban_sdk::bn254
(g1_add, pairing)β’ End-to-end tests: Noir β host precompile β contract verify
β’ Consolidate deliverables, publish grant report with benchmarks & links
Total epoch: 24 weeks
π― Team
Yugo Cabrio: Cryptography research engineer with experience across SNARK/STARK ecosystems. Integrated Circom with Sonobeβs folding scheme (PR), and authored technical explainers on Nova and Circle STARKs. Received community grants from PSE and zkBankai. Experienced in Rust-based implementation of cryptographic protocols, MEV tooling, and various ZKP schemes.
Contact: [email protected] / GitHub: @yugocabrio / Telegram: zeroxyg
Changmin Cho: Cryptography engineer with a strong mathematical background, particularly in algebraic topology. Implemented Circom-tfhe, zk-fft, and o1js-matrix for PSE and Mina. Interned at Nethermind, contributing to research on FRI and LatticeFold. Previously worked as a software engineer at a quantitative trading firm.
Contact: [email protected] / GitHub: @indextree / Telegram: indextree
AshWhitehat: Advisor to this project. A former zkEVM engineer at PSE, Ash has prior experience implementing BN254 and elliptic curveβbased zkSNARKs from scratch. He and Yugo have held weekly technical study sessions for over two years, and he will continue to provide advisory input, particularly on the BN254 curve implementation.
Contact: GitHub: @ashWhiteHat
We will dedicate a combined 1.2β1.8 FTE (Full-Time Equivalent) per week to this project.
π Start Date
June 7, 2025
Beta Was this translation helpful? Give feedback.
All reactions