Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs aiken soroban comparison #24

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions research/SemaphoreContractInAikenOrSoroban.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Suitability of Aiken (Cardano) and Soroban (Stellar) for Implementing Semaphore Smart Contracts

---

## 1. Introduction

Semaphore, a privacy protocol leveraging zero-knowledge proofs (ZKPs) for anonymous signaling, currently relies on Solidity-based on-chain smart contracts (for ZKP verification and anonymity set management) and off-chain JavaScript libraries (for proof generation and Merkle tree updates). To explore alternatives, this report examines Aiken (Cardano) and Soroban (Stellar), evaluating how each platform can replicate or adapt Semaphore’s architecture while potentially enhancing its native features.

For protocols like Semaphore, which depend on ZKPs and privacy-preserving infrastructure, the underlying blockchain model and tooling are critical. This report assesses Aiken and Soroban across four key areas: language paradigms, ecosystem integration, security, and performance, providing insights for implementing Semaphore smart contracts on each platform.

---

## 2. Language & Paradigm

### Aiken (Cardano)
Aiken, a smart contract language and toolchain for Cardano, simplifies writing secure and efficient smart contracts by offering a functional programming language inspired by Haskell. Its functional programming paradigm encourages the use of pure functions and modular design, enabling components of privacy protocols like Semaphore to be tested in isolation. This isolated testing simplifies debugging and ensures reliability in complex cryptographic workflows.

Aiken is designed to simplify smart contract development on Cardano, and compared to Plutus, it offers a more user-friendly experience while requiring less developer expertise. However, it’s important to note that its functional programming paradigm (i.e., Haskell-like syntax) is still generally considered more challenging to learn compared to imperative languages like Solidity or Rust. Developers unfamiliar with functional programming may find Aiken less intuitive initially.

### Soroban (Stellar)
Stellar’s smart contract platform, Soroban, offers a compelling environment for implementing privacy protocols by prioritizing performance, interoperability, and developer flexibility. Built on Rust, a widely used programming language, and compiled to WebAssembly (Wasm), Soroban leverages Rust’s memory safety and Wasm’s portability to enable efficient execution of complex cryptographic operations, such as zero-knowledge proof (ZKP) verification. While Stellar’s blockchain model emphasizes transparency, Soroban’s architecture provides a foundation for adapting existing privacy mechanisms through its robust tooling and scalable infrastructure.

---

## 3. Ecosystem & Integration

### Aiken (Cardano)
Since Aiken is built on Cardano, its functionalities are deeply influenced by the built-in features of the Cardano blockchain, making it essential to examine Cardano’s capabilities and features. Cardano’s recent zk-SNARK implementation, through the successful test of the Halo2 proving system (via Plutus), signals its ecosystem’s growing maturity for privacy-preserving protocols like Semaphore. Traditional zk-SNARKs require a trusted setup ceremony to generate public parameters, introducing potential centralization risks. However, Halo2 demonstrates the elimination of trusted setups while offering modularity and lower computational overhead.

Aiken itself does not yet natively support ZK proofs, but its compatibility with Plutus libraries positions it to inherit these advancements, reducing the effort required for implementation. Additionally, Cardano’s extended UTXO model enables parallel transaction processing and state isolation, which are critical for privacy-preserving protocols. These features are ideal for managing anonymity sets, preventing unintended data leakage, and enhancing scalability.

### Soroban (Stellar)
The Stellar blockchain is known for fast, low-cost transactions and its focus on cross-border payments and financial inclusion. Soroban’s strengths lie in its speed, cost efficiency, and interoperability, making it a pragmatic choice for deploying privacy protocols in use cases where scalability and performance outweigh strict anonymity requirements. However, Soroban inherits Stellar’s transparent ledger, making anonymity difficult to achieve.

By leveraging Rust’s safety, Wasm’s efficiency, and Stellar’s battle-tested network, developers can engineer privacy solutions that align with Soroban’s transparency-first model while pushing the boundaries of on-chain confidentiality. Soroban relies on third-party Rust libraries like Arkworks-rs for ZKP implementation since no native ZKP tooling exists. Developers must manually integrate cryptographic primitives, which potentially increases audit complexity.

---

## 4. Security & Performance

For zk-SNARKs, both Aiken and Soroban inherit the same trusted setup requirements from their underlying blockchains. However, the absence of ecosystem-level tooling increases reliance on external setups, raising audit complexity. Conversely, the stacks of both Aiken and Soroban could theoretically adopt zk-STARKs, which eliminate trusted setups entirely. However, this remains speculative and computationally intensive.

---

## 5. Conclusion

Aiken (Cardano) prioritizes provable security and privacy through formal methods and an EUTXO model but faces challenges with trusted setups for SNARKs. Despite this, it is still recommended for use in privacy-critical systems.

Soroban, on the other hand, simplifies building scalable applications using Rust-based contracts, prioritizing performance and interoperability. However, its functionalities are tightly coupled with Stellar’s account-based blockchain model, which emphasizes transparency and fast, low-cost transactions—features that conflict with privacy protocols like Semaphore. Soroban (Stellar) excels in performance and flexibility but sacrifices native privacy features, requiring developers to retrofit solutions.

In conclusion, it is recommended to use Aiken (Cardano) for high-assurance privacy protocols and to use Soroban (Stellar) for lightweight, semi-private applications where speed and cost are critical.

---