Skip to main content

Create and Fund Aptos Accounts

For testing purposes, you will want to create an Aptos account and fund it with testnet tokens. Much of this can be accomplished in the wallet of your choice. We use the Petra Wallet here in combination with the Aptos CLI to show you how they work together.

This document accompanies the command line instructions for the Aptos CLI on creating and funding accounts, focusing upon the testnet network and leveraging a graphical wallet rather than the CLI.

Prerequisites

You will need these installed to proceed:

Create an Aptos account

First, understand you can use your private key straight from the wallet and not have to import it from the CLI.

Note that you may create specific account types by passing the --profile argument and a unique name to aptos-init for special assignments later. Here we will create a default (typical) account.

  1. Create the account on Aptos testnet to receive the NFT by running the following command and selecting testnet:

    aptos init
  2. Receive the output:

    Configuring for profile default
  3. When prompted for a network:

    Choose network from [devnet, testnet, mainnet, local, custom | defaults to devnet]

    Select testnet by entering it and hitting return. You may instead select devnet and get funds through the Aptos CLI later.

  4. When prompted for your private key:

    Enter your private key as a hex literal (0x...) [Current: None | No input: Generate new key (or keep one if present)]

    Hit enter to generate a new key.

  5. Receive output indicating success and resembling:

    No key given, generating key...
    Account a233bf7be2b93f1e532f8ea88c49e0c70a873d082890b6d9685f89b5e40d50c2 does not exist, you will need to create and fund the account through a community faucet e.g. https://aptoslabs.com/testnet-faucet, or by transferring funds from another account

    ---
    Aptos CLI is now set up for account a233bf7be2b93f1e532f8ea88c49e0c70a873d082890b6d9685f89b5e40d50c2 as profile default! Run `aptos --help` for more information about commands
    {
    "Result": "Success"
    }
  6. Note your configuration information can be found in .aptos/config.yaml relative to where you ran aptos init. Read that file to see each profile's private and public keys, account address, and REST API URL.

Import the account into the CLI

Here we will add the account to your wallet. We use the Petra Wallet Chrome extension here:

  1. Read .aptos/config.yaml to see and copy the default private key.
  2. Open the wallet and select the Testnet network in the wallet via Petra settings > Network > Testnet.
  3. Go to Petra > Settings > Switch account > Add Account > Import private key.
  4. Paste the default private key there.
  5. Click Submit to add the previously created account to the wallet.
  6. You are switched into that account automatically.

Get coins from the faucet

  1. Go to the Petra > Settings > Network > Testnet network if not there already.
  2. Connect your wallet to the Aptos faucet at https://aptoslabs.com/testnet-faucet: Faucet connect
  3. Select your wallet type: Wallet select
  4. Approve the connection request: Faucet approval
  5. Now when you load your wallet, you will see a Faucet button next to Send. Click Faucet to receive one APT per click to use when minting.

Authors