0xMiden / 0xMiden/miden-proposals

Implement Precompiles for Efficient Cryptography and ZK Proof Verification

Open
#6 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## TL;DR

Miden VM is designed for STARK-based proving, and while this enables parallelization and recursion, it makes certain algorithms prohibitively expensive to execute natively. We will build a [canonical interface for adding precompiles](https://github.com/0xMiden/miden-vm/issues/1796), and we're looking for a team to help build a first set of essential precompiles.

The goal is to support cryptographic primitives and proof systems that are currently inefficient or infeasible to implement directly in Miden Assembly, like eliptic curves.

---

## Problem

Miden’s core proving model excels at operations optimized for STARKs, but struggles with:

- Elliptic curve operations not friendly to STARKs (e.g., secp256k1 for ECDSA)
- Hash functions like Keccak (used in Ethereum compatibility)
- Recursive SNARK/STARK verification (e.g., SP1 or RISC Zero proofs)

These operations are foundational for:
- Verifying Ethereum and Solana signatures
- Bridging with EVM ecosystems
- Verifying off-chain computations (via recursive proofs)
- Integrating external ZK circuits or proving systems
- Oracles

Running these computations inside the Miden VM as MASM code is currently **too slow or too expensive** to be practical.

---

## Objective

We want to implement **precompiles** — native host functions callable from within the Miden VM — to enable the above use cases.

---

## Scope

Implement precompiles for:

1. **ECDSA (secp256k1)**: Signature verification for Ethereum-style accounts
2. **EdDSA (ed25519)**: Signature verification for Solana-style accounts
3. **Keccak-256**: Hash function used widely in EVM compatibility
4. **Proof verification**:
- **SP1** proofs
- **RISC Zero** proofs

---

## Proof of Concept Phase

The first goal is a working proof-of-concept:
- The precompiles are callable via the interface defined in [#1796](https://github.com/0xMiden/miden-vm/issues/1796)
- Each function should accept inputs in a Miden-compatible format (stack, memory, or note inputs)
- Return valid results verifiable inside the Miden VM
- Include simple test vectors or benchmarks
- Maybe: batching of signature verification using Miden's recursion

---

## Final Product

A production-ready implementation should include:
- Performance-optimized precompile logic
- Miden SDK integration
- Benchmarks for runtime and constraint cost
- Documentation and usage examples
- Defined performance targets (to be specified)

---

## Desired Expertise

We are looking for a team with experience in:
- Cryptographic implementation (especially ECDSA, EdDSA and Keccak)
- ZK proof systems and recursive verification
- Rust (the Miden VM is implemented in Rust)
- WASM or host binding experience is a plus

---

## Interested?

If you're interested in contributing to this effort or have relevant experience, please comment below or reach out directly. Let us know:
- Which precompile(s) you're interested in tackling
- Your relevant experience
- Timeline or availability for PoC and full implementation

Let's make Miden composable and interoperable without compromising on performance or privacy! 🔧🧪

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.