project screenshot 1
project screenshot 2
project screenshot 3

Stylus Noir Verifier

Noir verifier smart contract written using Stylus SDK for cheaper onchain verification

Stylus Noir Verifier

Created At

ETHGlobal London

Project Description

Verification of ZK proofs onchain can sometimes be relatively expensive which limits their usecases. For example, a Uniswap V4 hook could perform compliance checks utilising ZK proofs but the gas costs necessary for these proof verifications impose extra fees on swappers, making the pools less attractive.

Arbitrum's Stylus SDK promises orders of magnitudes of speedup with large gas reductions relative to solidity contracts, so a ZK proof verifier written using stylus would help avoid the extra costs imposed on swappers due to these hooks.

How it's Made

At the start of the hackathon, I planned on tackling this through linking barretenberg into the stylus project as a static lib with a thin Rust wrapper around it to inject the verification key, etc. I ended up running into a couple of issues at this stage:

  • Firstly our barretenberg library doesn't currently have up-to-date Rust bindings, once these were updated I started running into some compilation issues which seemed like they would need a decent amount of debugging which would chew up too much time to complete in the weekend.
  • I was a little concerned that due to the fact I'd be bringing in all of barretenberg there would be various proving logic, etc. which may be included in the final wasm, blowing up the size so that it couldn't be deployed.

Because of these I went down the route of doing a straight port of our solidity verifier into Rust to use the Stylus SDK directly. This would be guaranteed to fit within the size limit and sidestep any debugging of barretenberg.

I've made a certain amount of progress on this but I've also been splitting time on supporting other teams hacking on Noir so the verifier is about half written and in a seriously hacky state at the minute.

This hack was mainly motivated by wanting to explore Arbitrum's Stylus Rust SDK and as an added bonus to the cost reductions, it was nice to see the readability improvements relative to the original contract (even despite me writing it in a super hacky way due to time constraints).

background image mobile

Join the mailing list

Get the latest news and updates