Account ID
An immutable and unique identifier for the Account.
The Account ID is a 120-bit long number. This identifier is designed to contain the metadata of an account. The metadata includes the account type and the version of the Account. This metadata is included in the ID to ensure it can be read without needing the full account state.
The ID is generated by hashing a randomly generated seed together with commitments to the initial code and storage of the Account until the resulting ID has the desired account type. This process requires a small amount of Proof-of-Work (6 bits) that can be done even by low-powered devices. The resulting 256-bit hash is shortened to 120 bits.
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.