Aptos Review — Account System
Tags: aptos
Published: 2022-11-20 16:28:53


Everyone must set up an account when starting to use blockchain applications. No matter what your Web3 adventure looks like, your blockchain account is always part of the experience.

A well-designed and secure account system is crucial for user onboarding and retaining. In this article, I will cover the advancements of blockchain account systems and show how Aptos implements best practices.

Bitcoin’s UTXO model
Bitcoin is the first widely adopted distributed ledger system. Its authentication mechanism is based on asymmetric cryptography. To create a digital identity, you generate a key pair consisting of a private key and a corresponding public key. The public key generates its shortened version through hashing, which becomes your address.

The relationship between private key, public key, and address is shown as follows:


Bitcoinbook
The Bitcoin blockchain operates on unspent transaction outputs, also called UTXOs. You can imagine a UTXO as a “note” someone handing you as a trader, which describes the value (the amount of cryptocurrency) that remains after your transaction. You can directly spend this UTXO or convert it into more UTXOs with an equal sum of value. The total value of your asset is the sum of all the UTXOs in your wallet. When you transfer assets, your wallet picks one or more UTXOs you own to create a transaction and generate new UTXOs.


Bitcoin Official Documents
The UTXO model is suitable for blockchain-based payment networks. Different UTXOs can be spent without dependency on one another, giving these blockchain networks the potential for parallel execution and increasing their throughputs per second.

However, the UTXO model can be less flexible for general purposes, where you want to have other data types associated with your address.

Account-based model
A more intuitive and flexible blockchain account model is the account-based model. In this model, your balance is stored directly in your account, and blockchain ledger keepers keep a big table of accounts and their associated balances; aside from balances, it can store a wide range of data, including your Zodiac sign, friends’ addresses, NFTs, etc. Hence, account-based blockchains like Ethereum and Solana, as well as other blockchains that support smart contracts, are suitable for general purposes.

However, most of these chains still base their authentication mechanism on asymmetric cryptography. Users’ addresses are still derived from private keys, which is no different from their counterparts based on UTXOs. Your on-chain identity remains bound to your private key to provide security to your account, which is a big problem.

What’s wrong deriving your address directly from your private key?
Many blockchain applications allow users to build digital identities. For example:

You can create an on-chain identity on social network
You can collect Soulbound Tokens (SBTs) representing your achievements or experiences
You can accumulate transaction records to raise credit scores
Having your identity bound to your private key means that if you accidentally lose your key or leak it to a malicious third party, you will have to abandon your identity and start anew. Sure, there are also cases where you have short-lived identities for privacy protection or development purposes. However, a sophisticated blockchain platform should allow users to rotate keys. In other words, it should decouple identity and security.

Requirement #1: The key(s) of the account should be rotatable.

In addition to rotatable key(s), it is crucial to have flexible authentication methods like:

Multi-factor authentication on different devices
Multi-party authentication for corporates or DAOs
Recovery mechanism, in case you lose your key(s)
Multi-signature authentication is the foundation of these methods, and it not only adds an extra layer of security but also serves as the backup of blockchain data.

Requirement #2: The account should support multi-signature authentication.

Aptos’s account system
Aptos’s account system fulfills both above-mentioned requirements with multi-signature authentication and rotatable keys, which is dev-friendly to consumer-facing applications.

Although smart contract wallets like Dapper Wallet on Ethereum provide similar features, compatibility issues occur. EIP-1271 deals with message signing and verification for smart contract wallets. Having native support for key rotation and multi-signature authentication is crucial for a robust blockchain ecosystem.


An Aptos account uses a rotatable authentication key to represent the account’s ownership.

In single-signer authentication, the authentication key is determined by:

auth_key = sha3–256(pubkey_1 | 0x00)

In multi-signer authentication, the authentication key is determined by:

auth_key = sha3–256(pubkey_1 | . . . | pubkey_n | K | 0x01)

0x00 and 0x01 are one-byte identifiers denoting which kind of authentication the account goes through.
n is the total number of public keys registered for the multi-signer account.
K is the total number of signatures required for the multi-signer account.
When sending a transaction from a multi-signer account, the right amount of public keys and signatures must be included and signed with corresponding private keys. This authentication method allows you to update your authentication key while keeping your original address. The decoupling between identity and security makes Aptos a home for normie-facing apps with the potential to bring the next billion users to Web3.

References
“UTXO vs Account Model” by Flora Sun
“Accounts” by Aptos
“Accounts in Aptos” by Martian DAO



"Original Medium Link: https://medium.portto.com/aptos-review-series-2-account-system-e8e8af712115
Learn more about Blocto: https://docs.blocto.app/"