Accounts
Introduction
Stacks uses an accounts-based model, more similar to Ethereum, rather than a UTXO model like Bitcoin. In a UTXO model, the network operates as a ledger, with each UTXO being analagous to a cash bill.
With an accounts-based model, each account is associated with a balance and that balance can be added to or subtracted from.
Stacks accounts are entities that own assets, like Stacks (STX) tokens. An account has an address, private key, nonce, and one or more asset balances.
Assets cannot leave an account without an action from the account owner. All changes to assets (and the balances of the account) require a corresponding transaction.
The transaction type doesn't need to be a token transfer - contract deploy and contract call transactions can change the balances of an account
Creation
An account is generated from a 24-word mnemonic phrase. This is often referred to as the seed phrase. The seed phrase provides access to Stacks accounts.
If the seed phrase is lost, access to the associated account cannot be restored. No person or organization can recover a lost seed phrase.
The easiest way to generate a new Stacks account is to use the Stacks CLI:
make_keychain
creates the following file:
Check out the Stacks CLI reference for more details
Note that a new account automatically exists for each new private key. There is no need to manually instantiate an account on the Stacks blockchain.
Addresses are created by generating the RIPEMD-160 hash of the SHA256 of the public key. BTC addresses are encoded with Base58Check. For Stacks addresses, c32check is used. Deriving an address from a public key can be done without internet access, for instance using the c32check c32addressDecode
method.
Alternatively to the CLI creation, the Stacks Transactions JS library can be used:
Finally, you can generate new account using a Stacks-enabled wallet like Leather, Xverse, or Asigna.
Last updated