Bulk Semaphore: Decentralizing Centralized Workflows with Traceability
This article focuses on the broader applications of Bulk Semaphore beyond privacy which we detailed in depth to implement sealed bid auctions in our previous articles:
Specifically, Bulk Semaphore also offers traceability which allows developers to decentralize otherwise centralized workflows. For example:
Decentralizing an image editor, allowing NFT marketplaces to support editable NFTs. By default, an image editor would have to live on a centralized website. With Bulk Semaphore, the computations made by the image editor be secured by zero knowledge proofs and approved by the user.
Decentralizing price computations made by a DeFi exchange offering more guarantees and transparency than an oracle-based pricing system
Blockframe is LIVE at:
Blockframe will be introducing decentralized editable NFTs persisting across marketplaces via Bulk Semaphore over the coming weeks.
A Brief Recap:
Before the advent of zero knowledge proofs, the only method to store private values on-chain was through public key cryptography, specifically ECDSA. However this method’s reliance on a single private key for security introduces a clear vulnerability, a single point of failure.
Zero Knowledge Proofs (ZKP) aimed to address this technological gap among other purposes. In a paper by Gurkan, Wei Jie, and Whitehat titled "Semaphore: Zero-Knowledge Signaling on Ethereum", published in March 2020, they introduced Semaphore - a framework for zero-knowledge signaling on Ethereum which used ZKPs as a more reliable method for private signaling than ECDSA.
The problem is that the gas cost for a single verification using Semaphore is 60,000 units. This is not scalable and cannot support large-scale systems with a large number of participants.
Blockframe introduces Bulk Semaphore inspired by the original Semaphore paper and the zkTree paper by the team at Polymer Labs. This protocol allows for bulk verification of any number of proofs for a mere 200,000 units of gas allowing for the implementation of sealed bid auctions and more generally any private workflow on-chain and at scale. Additionally, Bulk Semaphore can be used for more than privacy, it can offer traceability. Bulk Semaphore unlocks a property that is at the core of validity proof systems — in the worst case scenario, centralized systems can only censor operations or halt functioning, but can never manipulate results; decoupling trust and centralization.
This feature of traceability means Bulk Semaphore can be used to secure any centralized workflow in the same way zero knowledge L2 blockchains are secured via validity proof systems.
Representing Problems the Bulk Semaphore Way
An NFT Marketplace, Blockframe intends on building out the infrastructure for editable NFTs in decentralized fashion. They have an in-house image editor and are ready to perform edits to images on behalf of their users. The problem they will face is two-fold:
Blockframe becomes a centralized entity overseeing the edits, potentially undermining the decentralized ethos of web3 and risking user trust.
Ensuring that on-chain edits come from Blockframe's image editor and preventing unauthorized modifications is a major concern.
The naive solution here is to use ECDSA or public key cryptography when submitting the edits on-chain such that they need to be signed by a private key generated by Blockframe. However as mentioned previously, this means that the entire system touts a single point of failure, and opens the system up to security breaches.
Decentralize Centralized Workflows With Traceability
Bulk Semaphore presents an elegant solution. Framing the problem as a Semaphore signaling challenge, each edit made to an NFT via Blockframe's editor is associated with a proof. These proofs are combined in a zkTree, facilitating simultaneous verification of multiple edits at a minimal cost which is the true power of Bulk Semaphore. Users post these proofs on-chain alongside their edits. At the end of an editing session, the cumulative root proofs from the zkTree and Semaphore Merkle Tree are submitted on-chain. This ensures:
External parties, including other platforms, can validate that the user-submitted edits align with Blockframe's final root proof, guaranteeing traceability.
Blockframe remains unable to alter the zkTree or Semaphore Merkle Tree since any alterations would render the root proofs inconsistent with user-submitted proofs.
Users retain the autonomy to switch verifier contracts, allowing diverse marketplaces or platforms to engage in the editing process.
In this case, Bulk Semaphore is used as a tool for traceability on-chain. One can associate a value with each modification which extends to use-cases beyond image NFTs. We will explore this implementation in depth in a future article.
System Architecture
The zkSNARK system is a stateless Rust server connected to a Postgres database. This is only possible by leveraging serialization and deserialization for proof data structures.
The user takes an action, such as editing an image, the client forwards the action to the application server which makes an HTTP call to the zkSNARK application load balancer. When the zkSNARK load balancer receives the request, it forwards it to an instance in the auto scaling group which generates proofs in parallel, serializes the result and stores it in the database.
The inner workings of the zkSNARK system for the editable NFTs example is as follows:
The user submits multiple edits with their identity nullifier and trapdoor
Each edit is inserted into the circuit Semaphore Merkle Tree, and a proof is generated
The proof is added to the zkTree
Once the editing session is complete, the final root proof of the zkTree is submitted on-chain thereby certifying Blockframe carried out the exact edits as provided by the user.
Tying this back to privacy, this is an example of Bulk Semaphore with the minimum privacy possible as the entire details are revealed in the commitment phase and the reveal phase is skipped completely:
Bulk Semaphore’s traceability can apply to many use cases such as:
A decentralized exchange verifying and proving its price computations for an asset. Thereby strengthening the appeal of an oracle-based pricing system.
Editable and dynamic NFTs in decentralized fashion without reliance on an API gateway or metadata registry.
Any system that depends on a central authority taking an action or making a computation that cannot easily be represented as a blockchain problem such as an image editor.
FAQ
Observers can verify the final proof submitted by Blockframe but what stops Blockframe from editing an image maliciously or carrying out an incorrect computation and still submitting a valid proof?
Yes but the edit details are submitted on-chain by the user, by their wallet, Blockframe just issues a zero knowledge proof based on user input. If the result is not satisfactory, the user can refuse the proof submission.
Can Blockframe omit edits?
The integrity of the editing process is maintained as the Semaphore Merkle tree root is posted on-chain when the proof is verified. This allows anyone to verify which modifications were included in the process, ensuring transparency and preventing omission. The system can be automatically disabled if any skew is detected.
Who can generate the proofs?
The proofs are generated by the zkSNARK server.
Who can verify the proofs?
Anyone can verify the proof as long as they have access to it. The proof is emitted by the zkSNARK server.
How is it possible for anyone to verify a proof? Could a user misuse the proof in a transaction once it is revealed to them?
To prevent this, the prover emits hash(proof || group_id || Semaphore Merkle root), which must be submitted to the smart contract prior to on-chain proof verification.
How can I generate a proof-of-censorship and proof-of-authenticity after the process is completed?
When a proof is verified, the Semaphore Merkle tree root associated with the proof is posted on-chain as part of the Bulk Semaphore process. This allows anyone to verify which commitments were included in the proof verification process conducted by the administrator, ensuring transparency and authenticity.