Creating an account
Algorand offers multiple approaches to account creation, in this guide we’ll explore the various methods available for creating accounts on the Algorand blockchain. Depending on your requirement, consider standalone accounts, wallet-derived accounts using kmd (Key Management Daemon), or multi-signature accounts (which entails one of the prior methods). This section will explore standalone accounts and wallet-derived accounts in-depth, guiding how to utilize them in algokit-utils
, goal
, algokey
, SDKs
, and Pera Wallet
, the reasons you might want to choose one method over another for your application.
Quick start videos
If you prefer videos, take a look at this 10-minute guide to get started with creating accounts, which also includes using the Pera Algo Wallet.
Standalone
A standalone account is an Algorand address and private key pair that is not stored on disk. The private key is most often in the 25-word mnemonic form.
Reasons to use standalone accounts
- Low setup cost: No need to connect to a separate client or hardware; all you need is the 25-word human-readable mnemonic of the relevant account.
- Supports offline signing: Since private keys are not stored on disk, standalone accounts can be used in secure offline-signing procedures where hardware constraints may make using kmd more difficult.
- Widely supported: Standalone account mnemonics are commonly used across various Algorand developer tools and services.
Reasons not to use standalone accounts
- Lack of encrypted storage: If you prefer storing keys securely on disk rather than as a 25-word mnemonic, kmd may be a better choice.
- Limited direct import/export options: Developers relying on import and export functions may find kmd more suitable, as Algokit Utils provides import and export capabilities.
How to generate a standalone account
There are different ways to create a standalone account:
Algokey
Algokey is a command-line utility for managing Algorand keys and it is used for generating, exporting, and importing keys.
$ algokey generatePrivate key mnemonic: [PASSPHRASE]Public key: [ADDRESS]
Algokit Utils
AlgoKit Utils simplifies the creation and management of standalone Algorand accounts in both Python and TypeScript by abstracting the complexities of Algorand SDKs, allowing developers to generate new accounts, retrieve existing ones, and manage private keys securely.
By leveraging AlgoKit Utils, developers can programmatically create accounts without depending on external key management systems, making it ideal for lightweight applications, offline signing, and minimal setup scenarios. AlgoKit Utils offers multiple ways to create and manage standalone accounts.
Random Account Generation
Developers can generate random accounts dynamically, each with a unique public/private key pair.
1 /**2 * Create random accounts that can be used for testing or development.3 * Each account will have a newly generated private/public key pair.4 */5 const randomAccount = algorand.account.random()6 const randomAccount2 = algorand.account.random()7 const randomAccount3 = algorand.account.random()
1 """2 Create random accounts that can be used for testing or development.3 Each account will have a newly generated private/public key pair.4 """5 random_account = algorand_client.account.random()
Mnemonic-Based Account Recovery
Developers can create accounts from an existing 25-word mnemonic phrase, allowing seamless account recovery and reuse of predefined test accounts.
1 /**2 * Create an account from an existing mnemonic phrase.3 * Useful for recovering accounts or using predefined test accounts.4 */5 const mnemonicAccount = algorand.account.fromMnemonic('mnemonic words...')
1 """2 Create an account from an existing mnemonic phrase.3 Useful for recovering accounts or using predefined test accounts.4 """5 mnemonic_account = algorand_client.account.from_mnemonic(mnemonic="MNEMONIC_PHRASE")
Pera Wallet
Pera Wallet is a popular non-custodial wallet for the Algorand blockchain. For more details, refer to the guided tutorial on How to create a new account on Pera Wallet.
Vault Wallet
Hashicorp Vault implementation can also be used for managing Algorand standalone accounts securely. By leveraging Vault, you can store private keys and 25-word mnemonics securely, ensuring sensitive data is protected from unauthorized access. This implementation provides a streamlined way to create and manage standalone accounts while maintaining best practices for key management.
The integration is particularly useful for developers and enterprises seeking a secure, API-driven approach to manage Algorand accounts at scale, without relying on local storage or manual handling of sensitive credentials.
Wallet-derived
The Key Management Daemon is a process that runs on Algorand nodes, so if you are using a third-party API service this process likely will not be available to you. kmd is the underlying key storage mechanism used with goal
.
Reasons to use kmd
-
Single Master Derivation Key: Public/private key pairs are generated from a single master derivation key. You only need to remember the single mnemonic that represents this master derivation key (i.e. the wallet passphrase/mnemonic) to regenerate all of the accounts in that wallet.
-
Enhanced Privacy: There is no way for someone else to determine that two addresses are generated from the same master derivation key. This provides a potential avenue for applications to implement anonymous spending for end users without requiring users to store multiple passphrases.
Reasons not to use kmd
- Resource Intensive: Using kmd requires running a process and storing keys on a disk. If you do not have access to a node or you require a more lightweight solution, Standalone Accounts may be a better-suited option.
How to use kmd
Start the kmd process
To initiate the kmd process and generate the required kmd.net
and kmd.token
files use goal kmd
or kmd
command line utilities.
Start kmd using goal with a 3600-second timeout.
$ goal kmd start -t 3600Successfully started kmd
Kmd can directly be used using the following command
$ kmd -d data/kmd-v<version>/ -t 3600
Once the kmd has started, retrieve the kmd IP address and access token:
$ echo "kmd IP address: " `cat $ALGORAND_DATA/kmd-v<version>/kmd.netkmd IP address: [ip-address]:[port]
$ echo "kmd token: " `cat $ALGORAND_DATA/kmd-v<version>/kmd.tokenkmd token: [token]
Create a wallet and generate an account
Wallet and account can be created using different ways.
goal
Following are the commands to create a new wallet and a generate an account using goal,
$ goal wallet new testwalletPlease choose a password for wallet 'testwallet':Please confirm the password:Creating wallet...Created wallet 'testwallet'Your new wallet has a backup phrase that can be used for recovery.Keeping this backup phrase safe is extremely important.Would you like to see it now? (Y/n): yYour backup phrase is printed below.Keep this information safe -- never share it with anyone!
[25-word mnemonic]
$ goal account newCreated new account with address [address]
Algokit Utils
- KMD client based Account Creation: We can also use the utils to create a wallet and account with the KMD client.
1/**2* Get or create an account from LocalNet's KMD (Key Management Daemon)3* by name. If the account doesn't exist, it will be created.4*/5const kmdAccount = algorand.account.fromKmd('ACCOUNT_NAME')1"""2Get or create an account from LocalNet's KMD (Key Management Daemon)3by name. If the account doesn't exist, it will be created.4"""5kmd_account = algorand_client.account.from_kmd(name="ACCOUNT_NAME")
Other operations like creating and renaming wallet can also be performed.
1 /**2 * Create a wallet with the KMD client.3 */4 await algorand.client.kmd.createWallet('ACCOUNT_NAME', 'password')5
6 /**7 * Rename a wallet with the KMD client.8 */9 await algorand.client.kmd.renameWallet('ACCOUNT_NAME', 'password', 'NEW_ACCOUNT_NAME')
1 """2 Create a wallet with the KMD client.3 """4 algorand_client.client.kmd.create_wallet(name="ACCOUNT_NAME", pswd="password")5
6 """7 Rename a wallet with the KMD client.8 """9 algorand_client.client.kmd.rename_wallet(10 id="PX2KLH4IVQ25DIU2IVGDWRPJ66RJKOCJ6F7CBCBQA4IXL2GAX645WSG3IQ",11 password="new_password",12 new_name="NEW_ACCOUNT_NAME",13 )
- Environment Variable-Based Account Creation: To create an account using environment variable will load the account from a KMD wallet called name. When running against a local Algorand network, a funded wallet can be automatically created if it doesn’t exist.
1 /**2 * Get or create an account from environment variables.3 * When running against LocalNet, this will create a funded wallet4 * if it doesn't exist.5 */6 const envAccount = algorand.account.fromEnvironment('MY_ACCOUNT', (1).algo())
1 """2 Get or create an account from environment variables.3 When running against LocalNet, this will create a funded wallet4 if it doesn't exist.5 """6 env_account = algorand_client.account.from_environment(7 name="MY_ACCOUNT", fund_with=AlgoAmount(algo=10)8 )
Recover wallet and regenerate account
To recover a wallet and any previously generated accounts, use the wallet backup phrase (also called the wallet mnemonic or passphrase). The master derivation key for the wallet will always generate the same addresses in the same order. Therefore the process of recovering an account within the wallet looks exactly like generating a new account.
$ goal wallet new -r <recovered-wallet-name>Please type your recovery mnemonic below, and hit return when you are done:[25-word wallet mnemonic]Please choose a password for wallet [RECOVERED_WALLET_NAME]:Please confirm the password:Creating wallet...Created wallet [RECOVERED_WALLET_NAME]
$ goal account new -w <recovered-wallet-name>Created new account with address [RECOVERED_ADDRESS]
HD Wallets
Algorand’s Hierarchical Deterministic (HD) wallet implementation, based on the ARC-0052 standard, enables the creation of multiple accounts from a single master seed. The API implementations are in TypeScript, Kotlin, and Swift, providing a consistent and efficient solution for managing multiple accounts with a single mnemonic.
HD wallets are especially beneficial for applications that require streamlined account generation and enhanced privacy. By using this approach, developers can ensure all accounts are deterministically derived from a single seed phrase, making wallet management more convenient for both users and applications.