Skip to content

Commit d806567

Browse files
committed
Add mina-tx-type crate with zkApp transaction types
Create a new standalone crate `mina-tx-type` that extracts transaction type structures from the ledger crate. This enables external projects to reuse these structures without duplicating code. The crate includes: - ZkAppCommand and related types (FeePayer, AccountUpdate, CallForest) - Account update body with all fields (update, balance_change, preconditions) - Preconditions (network, account, valid_while) - SetOrKeep and OrIgnore wrapper types - Authorization types (AuthorizationKind, MayUseToken, Permissions) - Primitive types (Fee, Amount, Balance, Nonce, Slot, etc.) Key features: - no_std only (no std feature) for embedded/constrained environments - Comprehensive rustdoc documentation for all fields - Generic over public key and field element types References issue #1665.
1 parent 2dd8590 commit d806567

File tree

5 files changed

+955
-0
lines changed

5 files changed

+955
-0
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ members = [
77
"ledger",
88
"macros",
99
"mina-p2p-messages",
10+
"mina-tx-type",
1011
"node",
1112
"node/account",
1213
"node/common",
@@ -147,6 +148,7 @@ mina-p2p-messages = { path = "mina-p2p-messages" }
147148
mina-poseidon = { git = "https://github.com/o1-labs/proof-systems", tag = "0.2.0" }
148149
mina-signer = { git = "https://github.com/o1-labs/proof-systems", tag = "0.2.0" }
149150
mina-transport = { path = "tools/transport" }
151+
mina-tx-type = { path = "mina-tx-type" }
150152
mio = { version = "1.0.4", features = ["os-poll", "net"] }
151153
multiaddr = "0.18.1"
152154
multihash = { version = "0.18.1", features = ["blake2b"] }

mina-tx-type/Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "mina-tx-type"
3+
version = "0.18.1"
4+
edition = "2021"
5+
description = "Transaction types for the Mina Protocol"
6+
license = "Apache-2.0"
7+
readme = "README.md"
8+
repository = "https://github.com/o1-labs/mina-rust"
9+
keywords = ["mina", "blockchain", "cryptocurrency", "zkapp", "transaction"]
10+
categories = ["cryptography::cryptocurrencies"]
11+
12+
[dependencies]
13+
14+
[dev-dependencies]

mina-tx-type/src/lib.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//! Transaction types for the Mina Protocol
2+
//!
3+
//! This crate provides standalone data structures representing Mina Protocol
4+
//! transaction types. It is designed to be `no_std` compatible for use in
5+
//! constrained environments such as hardware wallets and WebAssembly.
6+
//!
7+
//! # Overview
8+
//!
9+
//! The Mina Protocol supports two primary user-initiated transaction types:
10+
//!
11+
//! - **Signed Commands**: Traditional payments and stake delegations authorized
12+
//! by a cryptographic signature.
13+
//! - **zkApp Commands**: Complex multi-account operations using zero-knowledge
14+
//! proofs for authorization and state updates.
15+
//!
16+
//! # zkApp Transaction Structure
17+
//!
18+
//! A zkApp command consists of:
19+
//! - A **fee payer** account that pays the transaction fee
20+
//! - A tree of **account updates** that modify account state
21+
//! - A **memo** field for user-defined metadata
22+
//!
23+
//! Each account update can specify:
24+
//! - State updates (app state, delegate, permissions, etc.)
25+
//! - Balance changes
26+
//! - Preconditions that must be satisfied
27+
//! - Authorization method (signature, proof, or none)
28+
//!
29+
//! # Documentation References
30+
//!
31+
//! For detailed information about zkApp transaction signing, see:
32+
//! - TODO: Issue #1748 - zkApp transaction signing documentation
33+
//! - <https://mina-rust.o1labs.org/researchers/zkapp-signing>
34+
//!
35+
//! # no_std Support
36+
//!
37+
//! This crate is `no_std` by design to support embedded and constrained
38+
//! environments such as hardware wallets and WebAssembly.
39+
40+
#![no_std]
41+
42+
extern crate alloc;
43+
44+
pub mod zkapp;
45+
46+
pub use zkapp::*;

0 commit comments

Comments
 (0)