Account ID
An immutable and unique identifier for the Account.
The Account ID is encoded in 120 bits and includes the account's metadata. The account type and callback flag occupy one bit each. The version occupies four bits. These fields can be read without needing the full account state.
The ID is generated by hashing a random seed together with commitments to the account's initial code and storage. Seeds are tried until the Eidos digest has the desired metadata. Matching those six bits requires about 64 hash attempts on average, assuming pseudorandom hash outputs.
Eidos produces four 63-bit digest elements. The ID prefix is digest[1], whose high bit is zero. The suffix is digest[0] with its lower eight bits cleared, retaining 55 varying bits below its fixed high bit. For fixed metadata, the prefix has 57 varying bits and the suffix has 55, giving 112 in total. The suffix's high-bit constraint is satisfied automatically and adds no grinding work. The 120-bit encoding width is unchanged.
The account type is chosen at account creation time and cannot be changed later.
Account typeโ
Users can choose whether their accounts are stored publicly or privately. The preference is encoded in the account's ID:
-
Private Accounts: Only a commitment (hash) to the account's state is stored on-chain. This mode is suitable for users who prioritize privacy or plan to store a large amount of data in their
Account. To interact with a privateAccount, a user must have knowledge of its interface. -
Public Accounts: The account's state is stored on-chain, similar to how accounts are stored in public blockchains like Ethereum.
Encodingโ
Bech32 is the preferred encoding format and should be used for user-facing applications like wallets or websites.
An Account ID can be encoded in different formats:
- Bech32 (user-facing):
- Example:
mm1ap86qhrsrs4gcy2ntrerfkwylure4ly5 - Benefits:
- Built-in error detection via checksum algorithm
- Human-readable prefix indicates network ID
- Less prone to transcription errors
- Structure:
- Human-readable prefix that
determines the network:
mm(indicates Miden Mainnet)mtst(indicates Miden Testnet)mdev(indicates Miden Devnet)
- Separator:
1 - Data part with integrated checksum
- Human-readable prefix that
determines the network:
- Hexadecimal:
- Example:
0x4fa05c701c2a8c115358f234d9c4ff - Frequently used encoding for blockchain addresses
- Used to identify accounts in command-line interfaces or explorers.