Accounts
Implicit-account derivation, on-chain creation, transfers, key management, and account costs for exchanges.
NEAR supports implicit accounts with 64-character hexadecimal IDs derived locally from an ED25519 public key. An account can be created with no initial deposit; the creator pays a 0.007 NEAR creation charge through gas fees, plus the other transaction fees.
[!TIP]
See the NEAR account model for account types, access keys, and permissions.
Implicit Accounts
An ED25519 implicit account ID is the 64-character lowercase hexadecimal encoding of its 32-byte public key. Exchanges can derive deposit addresses locally before creating the accounts on-chain. The corresponding private key signs transactions after account creation.
[!NOTE]
Generate a key pair and account ID
These examples generate an ED25519 key pair and derive the account ID locally; they do not create the account on-chain.
[tab] NEAR CLI
The CLI saves the credentials to
~/.near-credentials/implicit.# Test environment should use the testnet, for production use mainnet export NEAR_ENV=testnet near account create-account fund-later use-auto-generation save-to-folder ~/.near-credentials/implicit # Example output: # The file "~/.near-credentials/implicit/8bca86065be487de45e795b2c3154fe834d53ffa07e0a44f29e76a2a5f075df8.json" was saved successfully # # Here is your console command if you need to script it or re-run: # near account create-account fund-later use-auto-generation save-to-folder ~/.near-credentials/implicit
[tab] near-api-js
import { KeyPairEd25519, baseDecode } from "near-api-js"; const keyPair = KeyPairEd25519.fromRandom(); const publicKey = keyPair.getPublicKey().toString(); const accountId = Buffer.from(baseDecode(publicKey.split(":")[1])).toString("hex"); const privateKey = keyPair.toString(); // Store securely for signing transactions. console.log({ accountId, publicKey });
[accordion] How are Account IDs derived
This Python example derives the account ID from a public key:
import base58 public_key = 'ed25519:DGiK1ZZ4K5D89dz8YLKjhFz3xvJioSedgJbxtKna4DL6' pk58 = public_key.removeprefix('ed25519:') account_id = base58.b58decode(pk58).hex() print(account_id) # Output: # b652aa4a5697a1dd3151edf8edad3454fd3bf6b7f2c49787fccbea5c57635bab
Create the account on-chain
Deriving an address locally does not create the account on-chain. Before the account can send transactions, including meta-transactions, it must be created on-chain and its creation charge paid.
The first transfer to the address creates the account, including a transfer of 0 NEAR. The sender pays the 0.007 NEAR creation charge through gas fees, plus other transaction fees. See account creation costs.
For example, this transaction created the implicit account f44f3... by sending a zero-deposit transfer using the command:
near tokens influencer.testnet send-near f44f34572d483c73600d0b117b68901cab911e9363968d78c5d57501b7331bfd '0 NEAR' network-config testnet sign-with-keychain send
[!TIP]
Once created on-chain, an implicit account can send transactions using its access key. See Sending Withdrawals for CLI and SDK examples.
Key management and recovery
Backup keys can provide signing authority if another key is lost or deleted. Recovery depends on the access keys and contract permissions that remain available.
Loss of FullAccess key
Loss of the only FullAccess private key removes the ability to sign transactions with that key.
Only if the account had a smart contract with a recovery method implemented - which is not the default - can the account potentially be recovered after losing the FullAccess key.
Loss of FunctionCall access key
Function call keys do not have the authority to perform native transfers or replace other keys on the account.
Deleting a FunctionCall access key revokes its on-chain permissions to call methods on a specific smart contract. Be careful when removing these keys, specially if they are the only remaining access keys for the account.
Frequently Asked Questions
[accordion] What is a valid account ID?
See Account IDs for address formats and derivation.
[accordion] What is the account model?
User can have one or multiple NEAR Accounts. Each account lives on a single shard, can hold a smart contract, and store multiple keys for signing transactions.
You can read more about NEAR accounts here
[accordion] How much does account creation cost?
Account creation has a 0.007 NEAR creation charge, collected through gas fees.
NEAR supports zero-balance accounts: an account can be created with an initial deposit of 0 NEAR, while the creator still pays the creation charge and transaction fees.
[accordion] Is there a minimum account balance?
Accounts pay for their own stored data. For accounts using 770 bytes or less, the creation charge covers this storage, so no additional storage balance is required.
Accounts using more than 770 bytes must reserve a balance to cover all their stored data, including the first 770 bytes, at 10^19 yoctoNEAR (0.00001 NEAR) per byte. Query the current price using
protocol_config; see storage staking.Deleting stored data reduces the storage requirement, making any balance no longer needed for storage available.
Creation charges and transaction gas are separate from the balance retained for storage; see account creation costs.
An account can remain active with a zero balance if it meets the storage requirements above. Explicit deletion removes its native account state. Recreating the account starts with fresh state.
[accordion] How many keys can an account have?
An account can have arbitrarily many keys, as long as it has enough tokens for their storage.
[accordion] How are cryptographic functions used?
Account keys support
ed25519,secp256k1, andML-DSA-65, with different encodings and signing rules. The transaction examples use ED25519. Consult the cryptographic definitions for your node version when implementing other key types.
[accordion] Do you have a cold wallet implementation (ie. Ledger)?