IEP implements a brain wallet as part of its design: all accounts are stored on the network with private keys for each possible account address directly derived from each account’s passphrase using a combination of SHA256 and Curve25519 operations. Each account is represented by a 64-bit number, and this number is expressed as an account address using a Reed-Solomon error correcting notation that allows for detection of up to four errors in an account address, or correction of up to two errors.
This format was implemented in response to concerns that a mistyped account address could result in tokens, aliases, or assets being irreversibly transferred to erroneous destination accounts. Account addresses are always prefaced by “XIN-”, making token account addresses easily recognizable and distinguishable from address formats used by other cryptocurrencies. The Reed-Solomon-encoded account address associated with a secret passphrase is generated as follows:
- The secret passphrase is hashed with SHA256 to derive the account’s private key.
- The private key is encrypted with Curve25519 to derive the account’s public key.
- The public key is hashed with SHA256 to derive the account ID.
- The first 64 bits of the account ID are the visible account number.
- Reed-Solomon encoding of the visible account number, prefixed with “XIN-“, generates the account address.
When an account is accessed by a secret passphrase for the very first time, it is not secured by a public key. When the first outgoing transaction from an account is made, the 256-bit public key derived from the passphrase is stored on the blockchain, and this secures the account. The address space for public keys (2256) is larger than the address space for account numbers (264), so there is no one-to-one mapping of pass-phrases to account numbers and collisions are possible.
These collisions are detected and prevented in the following way: once a specific passphrase is used to access an account, and that account is secured by a 256-bit public key, no other public-private key pair is permitted to access that account number.
Account Balance Properties
For each IEP account, several different types of balances are available. Each type serves a different purpose, and many of these values are checked as part of transaction validation and processing.
- The effective balance of an account is used as the basis for an account’s forging calculations. An account’s effective balance consists of all tokens that have been stationary in that account for 1440 blocks. In addition, the Account Leasing feature allows an account’s effective balance to be assigned to another account for a temporary period.
- The guaranteed balance of an account consists of all tokens that have been stationary in an account for 1440 blocks. Unlike the effective balance, this balance cannot be assigned to any other account.
- The basic balance of an account represents all transactions that have had at least one confirmation.
- The forged balance of an account shows the total quantity of token that have been earned as a result of successfully forging blocks.
- The unconfirmed balance of an account is the one that is displayed in IEP clients. It represents the current balance of an account, minus the tokens involved in unconfirmed, sent transactions.
- Guaranteed asset balances lists the guaranteed balances of all the assets associated with a specific account.
- Unconfirmed asset balances lists the unconfirmed balances of all the assets associated with a specific account.