Skip to main content
You can create an account from a key pair or choose a readable name like alice.testnet. This guide walks through both options: creating implicit accounts and named accounts.
Install the NEAR CLI before starting. The examples below use testnet.

Create an implicit account

Creating an implicit account takes two steps: generate a key pair locally, then send a transfer to its derived address.

Generate a key pair

The simplest way to obtain a public / private key pair is using the NEAR CLI:
The file contains the generated key pair and implicit account ID. Your generated ID will differ from the example above. Keep the private key secret. You can also generate a key pair using the near-seed-phrase library:
Note that generating the key pair runs locally; the account will only be created on-chain when it receives a transfer.

Fund the account

Send NEAR to the derived address from a wallet or an existing funded account:
After the transfer is confirmed, the implicit account is created on-chain and its public key is registered as a full-access key. You can then use the saved credentials to sign transactions from this account.
You can initialize an account by making a transfer of 0 NEAR. This is because the cost of creating an account is covered through GAS fees, and not the attached NEAR amount.

Create a named account

Named accounts are created through the top level accounts near in mainnet, and testnet in testnet. Both accounts possess smart contracts that expose the create_account.
You can also simply use the NEAR CLI command near create-account to create a named account without manually interacting with the parent account’s contract.

Call the parent account’s contract

To create alice.testnet with 0.1 NEAR, call create_account on testnet using an existing account such as funding-account.testnet:
Replace ed25519:<data> with the public key generated above. The contract creates and funds alice.testnet and adds the new_public_key as a full-access key to the account.
If you are not going through an intermediary such as a wallet, you can generate an implicit account, fund it, and call create_account on near / testnet.
You can initialize an account by using a deposit of 0 NEAR. This is because the cost of creating an account is covered through GAS fees, and not the attached NEAR amount.

Create a direct sub-account

If you control alice.testnet, you can trigger the CreateAccount action yourself to create a direct sub-account:
The CLI builds the transaction that creates the account and adds its first key. You can add --initialBalance <amount in NEAR> to set its initial balance.
A parent account has no control over its sub-accounts after creation. Control depends on the access keys and contract installed on each account.

Use the testnet faucet

A faucet can create and fund a named testnet account for you, so you don’t need an existing funded account. Choose an available .testnet name and run:
The CLI generates and saves your key pair, then asks the faucet service to create the account with that public key. Faucet-sponsored creation is available on testnet only.

Create accounts from an application or contract

See NEAR API Libraries for named-account creation and Create a Sub Account for creating accounts from a smart contract.