0xMiden / 0xMiden/miden-proposals

Enable Atomic Composability via User-Defined Batches

Open
#7 1 comment 1 reaction 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 follows the **actor model**: each transaction represents the state transition of a single account. This enables **parallel execution** and **asynchronous transaction processing**, but comes at the cost of **atomic composability** — the ability to modify multiple accounts atomically in one transaction.

Many DeFi use cases (e.g., flash loans, DEX arbitrage, liquidations) rely on atomic multi-account operations. We're looking for a team to research and implement **user-defined batches** as a way to bring atomic composability to Miden without sacrificing its core architectural advantages.

---

## Problem

Miden's actor model processes one account per transaction:
- This allows efficient parallel execution
- It minimizes contention and improves scalability

However, it also **prevents atomic updates across multiple accounts**. For example:
- A flashloan where funds are borrowed, used, and repaid must happen in one atomic operation
- Complex DeFi protocols often require multi-step workflows involving several accounts

On Miden, each account is updated in isolation, so such atomic interactions are not currently possible.

---

## Proposed Direction: User-Defined Batches

Users could construct a **batch** of account updates (transactions) that are:
- Verified together
- Either all succeed or all fail (atomicity)
- Executed sequentially or in a specified order

This introduces a limited form of atomic composability **without breaking the actor model**.

Key considerations:
- Accounts touched by a batch must be **locked** during verification
- Execution remains deterministic and auditable
- Fees, proofs, and constraints must be aggregated and validated coherently

---

## Objectives

We are looking for a team to:

1. **Analyze** the problem and explore multiple solutions
- What are the trade-offs of different batching models?
- How do they fit with Miden's parallel proving and execution design?

2. **Design** a concrete mechanism for user-defined batches
- Define batch structure, verification rules, account locking, etc.
- Evaluate potential DoS or front-running vectors
- Ensure compatibility with note/account model

3. **Implement** the batching feature in the Miden SDK
- Batch builder and validator APIs
- Tooling to simulate and test batch transactions
- Error reporting and debug tooling

4. **Document** and teach
- Write developer-facing documentation
- Publish tutorials or walkthroughs on how to use batch transactions in practice

---

## Deliverables

- Specification document outlining the proposed batching design and rationale
- SDK implementation (batch builder, validator, etc.)
- CLI or testing tools for working with batches
- Documentation and tutorials for developers

Specific milestones and timelines are to be defined.

---

## Desired Expertise

- Familiarity with Miden’s architecture (actor model, off-chain proving, notes/accounts)
- Strong Rust and some MASM expertise

Contributor guide

Open the contributing guide

Research direction

The issue describes a research and implementation project for user-defined batches in the Miden protocol. Start by studying the Miden SDK and its actor model architecture. The work involves designing a batch structure, verification rules, and account locking, then implementing batch builder and validator APIs in Rust. Deliverables include a specification document, SDK implementation, CLI/testing tools, and documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.