pub struct Account {
pub public_key: CompressedPubKey,
pub token_id: TokenId,
pub token_symbol: TokenSymbol,
pub balance: Balance,
pub nonce: Nonce,
pub receipt_chain_hash: ReceiptChainHash,
pub delegate: Option<CompressedPubKey>,
pub voting_for: VotingFor,
pub timing: Timing,
pub permissions: Permissions<AuthRequired>,
pub zkapp: Option<Box<ZkAppAccount>>,
}Expand description
Represents a Mina account stored in the ledger.
An account is the fundamental unit of state in the Mina ledger. Each account is uniquely identified by a public key and token ID pair, and contains the account’s balance, transaction nonce, and various protocol metadata.
Accounts can be regular user accounts holding the native Mina token, or more complex entities such as custom token accounts or zkApp accounts with programmable smart contract functionality.
The account structure is designed to support:
- Token transfers and balance tracking
- Stake delegation for consensus participation
- Time-locked vesting schedules
- Flexible permission policies for different operations
- Zero-knowledge application state and verification
OCaml reference: src/lib/mina_base/account.ml L:201-224 Commit: fc6be4c58091c761f827c858229c2edf9519e941 Last verified: 2025-10-13
Fields§
§public_key: CompressedPubKeyThe public key that controls this account. This is the address used to identify the account and authorize transactions.
token_id: TokenIdThe token type this account holds. The default token (value 1) represents the native Mina token. Custom tokens have different values derived from their creator’s account.
token_symbol: TokenSymbolThe symbol for a custom token that this account can create or manage. Note: this describes a token ID owned by this account (i.e., a token this account can create), not the token type used by this account’s balance.
balance: BalanceThe current balance of the account in the smallest unit (nanomina for the default token, or the smallest unit for custom tokens).
nonce: NonceThe sequence number for transactions from this account. Incremented by
pay_fee_impl
for signed commands and by the zkApp application logic in
apply when processing account
updates.
receipt_chain_hash: ReceiptChainHashA hash chain of all transaction receipts involving this account,
providing a tamper-evident history. Updated by
cons_signed_command_payload
for signed commands and
cons_zkapp_command_commitment
for zkApp commands.
delegate: Option<CompressedPubKey>The public key of the account to which this account delegates its
stake for consensus. If None, the account delegates to itself (or
cannot delegate if using a custom token). Delegation allows accounts
to participate in consensus without running a block producer.
voting_for: VotingForThe state hash this account is voting for in the consensus protocol.
Updated through zkApp account updates in
apply.
timing: TimingThe vesting schedule for this account’s funds. Either Untimed
(fully liquid) or Timed with parameters defining when and how
tokens unlock over time. Updated by
pay_fee_impl
for signed commands and through zkApp account updates in
apply.
permissions: Permissions<AuthRequired>The permissions controlling what operations can be performed on this
account and what authorization is required (none, signature, proof,
or both). Updated through zkApp account updates in
apply.
zkapp: Option<Box<ZkAppAccount>>zkApp-specific account data. If Some, this account is a zkApp
(zero-knowledge application) with additional state including app
state fields, a verification key, action state, and other zkApp
metadata. Regular accounts have None. Managed through
AccountInterface::make_zkapp
and
AccountInterface::unmake_zkapp.
Implementations§
Source§impl Account
impl Account
pub fn create_with(account_id: AccountId, balance: Balance) -> Self
pub fn delegate_or_empty(&self) -> MyCow<'_, CompressedPubKey>
pub fn zkapp_or_empty(&self) -> MyCow<'_, Box<ZkAppAccount>>
pub fn initialize(account_id: &AccountId) -> Self
pub fn deserialize(bytes: &[u8]) -> Self
pub fn serialize(&self) -> Vec<u8> ⓘ
pub fn empty() -> Self
pub fn id(&self) -> AccountId
pub fn has_locked_tokens(&self, global_slot: Slot) -> bool
pub fn has_locked_tokens_checked( &self, global_slot: &CheckedSlot<Fp>, w: &mut Witness<Fp>, ) -> Boolean
pub fn liquid_balance_at_slot(&self, global_slot: Slot) -> Balance
pub fn min_balance_at_slot(&self, global_slot: Slot) -> Balance
Sourcepub fn has_permission_to(&self, control: ControlTag, to: PermissionTo) -> bool
pub fn has_permission_to(&self, control: ControlTag, to: PermissionTo) -> bool
pub fn checked_has_permission_to<F: FieldWitness>( &self, consts: PermsConst, signature_verifies: Option<Boolean>, to: PermissionTo, w: &mut Witness<F>, ) -> Boolean
Sourcepub fn has_permission_to_send(&self) -> bool
pub fn has_permission_to_send(&self) -> bool
true iff account has permissions set that enable them to transfer Mina (assuming the command is signed)
Sourcepub fn has_permission_to_receive(&self) -> bool
pub fn has_permission_to_receive(&self) -> bool
true iff account has permissions set that enable them to receive Mina
Sourcepub fn has_permission_to_set_delegate(&self) -> bool
pub fn has_permission_to_set_delegate(&self) -> bool
true iff account has permissions set that enable them to set their delegate (assuming the command is signed)
Sourcepub fn has_permission_to_increment_nonce(&self) -> bool
pub fn has_permission_to_increment_nonce(&self) -> bool
true iff account has permissions set that enable them to increment their nonce (assuming the command is signed)
pub fn hash(&self) -> Fp
pub fn checked_hash(&self, w: &mut Witness<Fp>) -> Fp
pub fn rand() -> Self
Trait Implementations§
Source§impl AccountInterface for Account
impl AccountInterface for Account
type W = ()
type Bool = bool
type Balance = Balance
type GlobalSlot = Slot
type D = ()
type VerificationKeyHash = Option<Fp<MontBackend<FqConfig, 4>, 4>>
fn register_verification_key(&self, data: &Self::D, w: &mut Self::W)
fn get(&self) -> &Account
fn get_mut(&mut self) -> &mut Account
fn set_delegate(&mut self, new: CompressedPubKey)
fn zkapp(&self) -> MyCow<'_, ZkAppAccount>
fn zkapp_mut(&mut self) -> &mut ZkAppAccount
fn verification_key_hash(&self) -> Option<Fp>
fn set_token_id(&mut self, token_id: TokenId)
fn is_timed(&self) -> Self::Bool
fn balance(&self) -> Self::Balance
fn set_balance(&mut self, balance: Self::Balance)
fn check_timing( &self, txn_global_slot: &Self::GlobalSlot, w: &mut Self::W, ) -> (TimingValidation<Self::Bool>, Timing)
fn make_zkapp(&mut self)
fn unmake_zkapp(&mut self)
fn proved_state(&self) -> Self::Bool
fn set_proved_state(&mut self, proved_state: Self::Bool)
fn app_state(&self) -> [Fp; 8]
fn last_action_slot(&self) -> Self::GlobalSlot
fn set_last_action_slot(&mut self, slot: Self::GlobalSlot)
Source§impl<'de> Deserialize<'de> for Account
impl<'de> Deserialize<'de> for Account
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl ToFieldElements<Fp<MontBackend<FqConfig, 4>, 4>> for Box<Account>
impl ToFieldElements<Fp<MontBackend<FqConfig, 4>, 4>> for Box<Account>
fn to_field_elements(&self, fields: &mut Vec<Fp>)
fn to_field_elements_owned(&self) -> Vec<F>
Source§impl ToInputs for Account
impl ToInputs for Account
fn to_inputs(&self, inputs: &mut Inputs)
fn to_inputs_owned(&self) -> Inputs
fn hash_with_param(&self, param: &LazyParam) -> Fp
fn checked_hash_with_param(&self, param: &LazyParam, w: &mut Witness<Fp>) -> Fp
impl Eq for Account
impl StructuralPartialEq for Account
Auto Trait Implementations§
impl Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnwindSafe for Account
Blanket Implementations§
§impl<T> BinProtSize for Twhere
T: BinProtWrite,
impl<T> BinProtSize for Twhere
T: BinProtWrite,
fn binprot_size(&self) -> usize
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FromBinProtStream for Twhere
T: BinProtRead,
impl<T> FromBinProtStream for Twhere
T: BinProtRead,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.