0xMiden / 0xMiden/miden-proposals

Private state management solution

未关闭
#3 4 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
没有语言数据
星标
1
派生
1
PR 合并指标
30 天内没有已合并 PR

描述

## TL;DR

Miden keeps private state (accounts and notes) off-chain, preserving user privacy and reducing on-chain data bloat. However, this architecture comes with two major challenges:

1. **Loss of local state = permanent loss of access**
2. **Shared accounts (e.g. multisigs) require manual and insecure state sync**

There are workarounds today (e.g. encrypted backups via Google Cloud), but we lack a **canonical and user-friendly solution** for both solo and shared state management. This discussion outlines the problems, proposes potential directions, and invites contributions for a robust and developer-friendly private state strategy.

---

## Problem

### 1. **State Loss**

In Miden, private state lives locally on the user's machine. If users lose their local state (e.g., due to disk failure or device change), **the state is gone forever** — there’s no way to recover it from the chain or another party.

### 2. **Shared State Synchronization**

When multiple parties share control over the same account (e.g., in a multisig setup), they each need the **latest state** to generate valid transactions. This opens up two issues:

- **Manual state exchange** is required and error-prone
- **Trust assumptions** arise: a dishonest party can withhold or manipulate state updates, potentially invalidating others' actions or locking funds

---

## Current Workaround

- The WebClient allows exporting/importing local state
- Users can manually **encrypt their `.mac` state files** (e.g., with a password or derived key) and upload them to a cloud provider like **Google Drive**
- State can then be re-imported on another device or restored in case of loss

However:
- There’s no standard backup format or strategy
- It’s not user-friendly
- It doesn’t solve the shared state problem

---

## Vision

We envision a **canonical private state management solution** with the following properties:

- **Automatic encryption + off-device storage** (cloud, IPFS, Matrix, etc.)
- Seamless **recovery on device loss**
- **Multi-party sync** support for shared accounts, without relying on trust
- Optional **delegation to “state guardians”** who hold the latest encrypted state (and potentially co-sign all txs)

---

## Proof of Concept Ideas

### For Solo Users:
- Encrypt state client-side and store it:
- On IPFS + pin via a gateway
- On a cloud storage provider (Drive, Dropbox, S3)
- On a Matrix room or secure peer channel
- Automatically retrieve latest backup on boot if keys match
- API to integrate solution for app developers

### For Shared Accounts:
- Introduce a “**state guardian**” contract/account:
- Guardian(s) receive state updates signed by the account controller
- All multisig members can pull the latest state from them
- Optionally require guardian co-signatures for tx validity
- API to integrate solution for app developers

---

## Final Product (Desired Outcomes)

- Miden Wallet and SDK offer:
- Seamless encrypted state backup + restore
- Pluggable backend (user-chosen cloud, IPFS, Matrix, etc.)
- Intuitive UX for account recovery

- Shared account protocol:
- Sync + trust-minimized coordination between multiple parties
- Formalized support for “guardians” or sync servers

---

## Timelines

| Milestone | Target |
|--------------------------------------------------|----------|
| PoC: Cloud-based encrypted backup | 4 weeks |
| PoC: State guardians & sync | 4 weeks |
| Canonical solution integrated into Wallet/SDK | 2-3 month |

---

## Open Questions

- Where should state be stored? IPFS? Matrix? Centralized cloud? All of them?
- How can we ensure forward secrecy for backups?
- How do we coordinate state versioning between multiple users?
- What are the trade-offs between guardians vs. full p2p sync?

---

**Feel free to suggest improvements, share ideas, or volunteer to prototype below! 👇**

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。