Address (Account ID)
NEAR accounts are identified by a unique address, which take one of two forms:
- Implicit addresses, which are 64 characters long (e.g.
fb9243ce...
) - Named addresses, which are simpler to remember and act as domains (e.g.
alice.near
)
You have multiple ways to create an account, you can sign-up using your email (note: email-based accounts currently have limited ability to transfer funds or sign transactions), get a mobile wallet through telegram, or create a web wallet.
Implicit Address
Implicit accounts are denoted by a 64 character address, which corresponds to a unique public/private key-pair. Who controls the private key of the implicit account controls the account.
For example:
- The private key:
ed25519:4x1xiJ6u3sZF3NgrwPUCnHqup2o...
- Corresponds to the public key:
ed25519:CQLP1o1F3Jbdttek3GoRJYhzfT...
- And controls the account:
a96ad3cb539b653e4b869bd7cf26590690e8971...
Implicit accounts always exist, and thus do not need to be created. However, in order to use the account you will still need to fund it with NEAR tokens (or get somebody to pay the gas for your transaction).
🧑💻 Technical: How to obtain a key-pair
The simplest way to obtain a public / private key that represents an account is using the NEAR CLI
near generate-key
# Output
# Seed phrase: lumber habit sausage used zebra brain border exist meat muscle river hidden
# Key pair: {"publicKey":"ed25519:AQgnQSR1Mp3v7xrw7egJtu3ibNzoCGwUwnEehypip9od","secretKey":"ed25519:51qTiqybe8ycXwPznA8hz7GJJQ5hyZ45wh2rm5MBBjgZ5XqFjbjta1m41pq9zbRZfWGUGWYJqH4yVhSWoW6pYFkT"}
# Implicit account: 8bca86065be487de45e795b2c3154fe834d53ffa07e0a44f29e76a2a5f075df8
Named Address
In NEAR, users can register named accounts (e.g. bob.near
) which are simpler to share and remember.
Another advantage of named accounts is that they can create sub-accounts of themselves, effectively working as domains:
- The
registrar
account can create top-level accounts (e.g.near
,sweat
,kaiching
). - The
near
account can create sub-accounts such asbob.near
oralice.near
bob.near
can create sub-accounts of itself, such asapp.bob.near
- Accounts cannot create sub-accounts of other accounts
near
cannot createapp.bob.near
account.near
cannot createsub.another-account.near
- Accounts have no control over their sub-account, they are different entities
Anyone can create a .near
or .testnet
account, you just to call the create_account
method of the corresponding top-level account - testnet
on testnet, and near
on mainnet.
🧑💻 Technical: How to create a named account
Named accounts are created by calling the create_account
method of the network's top-level account - testnet
on testnet, and near
on mainnet.
near call testnet create_account '{"new_account_id": "new-acc.testnet", "new_public_key": "ed25519:<data>"}' --deposit 0.00182 --accountId funding-account.testnet
We abstract this process in the NEAR CLI with the following command:
near create_account new-acc.testnet --useAccount funding-account.testnet --publicKey ed25519:<data>
You can use the same command to create sub-accounts of an existing named account:
near create_account sub-acc.new-acc.testnet --useAccount new-acc.testnet
Accounts have no control over their sub-accounts, they are different entities. This means that near
cannot control bob.near
, and bob.near
cannot control sub.bob.near
.