Create Klaytn Account

This page introduces how to create Klaytn accounts used in KAS.

What is Klaytn Account?

For a blockchain application developed by a user, the application will send transactions to the blockchain. The host sending transactions to the blockchain is the "Account," while the user's account is denoted by EOA in Klaytn. A Klaytn account is required for sending transactions to the platform using Wallet API or searching for KLAY or token transaction records through the Token History API.

A KAS account is created through KAS membership, while a Klaytn account must be created on the KAS Console. For details on the transaction, please visit here.

For inquires about this document or KAS, please visit Developer Forum.

Account, Fee-payer Account, Operator Account

Klaytn accounts include all accounts for storing, sending, and receiving KLAY (externally-owned account, EOA), smart contract accounts created when deploying smart contracts, etc.

KAS offers several account types according to account roles for your convenience.

For inquires about this document or KAS, please visit Developer Forum.

Account Pool

A KAS account may contain several Klaytn accounts. KAS provides account pool for easy and convenient management of all Klaytn accounts using just one KAS account. Individual types of Klaytn accounts also have their own account pools, and one KAS account may create and operate multiple storages.

KAS provides the following account pool types for your convenience according to account roles.

  • Account Pool: A space for managing regular Klaytn accounts

  • Fee-payer Pool: A space for managing fee-payer accounts

For inquires about this document or KAS, please visit Developer Forum.

Create Klaytn Account

Create Account Pool

KAS provides account pool for managing several Klaytn accounts. To use this, a user must first create account pool on the KAS Console and then create a new KAS Console account in the account pool created using the account creation API. account pool must be created first to use and manage the personal account pool instead of resorting to the default account pool.

Default Account Pool

The default account pool is the account pool provided to you when you do not choose your own account pool in calling KAS API. If you didn't feed the KRN of your own account pool into x-krn in API Request header, then the Klaytn account in the default account pool is used for calling this API. All the default account pools are tagged with DEFAULT as you look at these on KAS Console - Service - Wallet - Account Pools menu.

The first account pool you create is automatically designated as the default account pool. For example, if you have created an account pool named A in KAS Console and you didn't specify any account pool in calling API, the Klaytn account stored in this A account pool is automatically used in calling API afterwards. When you haven't created any account pool and you try to call API that creates a Klaytn account, KAS automatically create the default account pool and push this newly created Klaytn account into this default account pool for you.

Feed the KRN of other account pool to x-krn if you want to call API with Klaytn account stored in some other account pool.

KAS Console > Service > Wallet > Account Pools

Click the [Create] button under the KAS Console > Service > Wallet > Account Pools menu. And then click on the button to display the screen for creating Klaytn account pools.

Create Account Pool

Create a Klaytn account pool, and it must have a different name from other account pools on the current KAS account.

Check the Account Pool

Once the account pool is created, check the account pool in the account pool list.

If you put KRN which is obtained from account pool into x-krn in API request header, you would call this API with the Klaytn account stored in this account pool.

For inquires about this document or KAS, please visit Developer Forum.

Create Account

Create in Console

Select any one of the account pools created above. On the screen of the selected account pool, click [Create Account] to create an account.

API Request

Call the Klaytn account creation API as follows. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

An API authentication key can be created on KAS Console - Security - Credential menu, and the authentication password (Secret AccessKey) and Authorization can only be checked once upon their creation. Therefore, it is necessary to copy or download Secret AccessKey and Authorization to a safe location for proper and safe management after its creation. Authorization (e.g., Basic S0FTS1A2WkRaSjh...), which can be checked after creating an authentication key, refers to a value encoded using the AccessKey ID and Secret AccessKey through the basic authentication method and used for the call header when calling APIs.

A KAS API Authentication Key (API Auth Key) provides access to all KAS services and all the rights to a Klaytn account which was created by calling Wallet API via this API Auth Key. The rights here include accessing and transferring all the assets (KLAY, etc.) of or sending a transaction from a Klaytn account. If you shared your API Auth Key with any unauthorized personnel, your Klaytn account could be compromised and might cause unwanted transaction execution.

DO NOT share your API Auth Key (Secret AccessKey or Authorization) with any unauthorized personnel. DO PUT efforts necessary to keep your API Auth Key safe for the security of your KAS/Klaytn account.

//An example of using the default account pool of KAS with the x-krn header parameter is omitted
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/account" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}"

//An example of using the account pool created above with the x-krn header parameter is included
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/account" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}"
--header "x-krn: krn:1001:wallet:6698d79e-78ee-439a-815d-f293ec6ae736:account-pool:ap1"

API Response

Here is the response of the Klaytn account creation API.

//Example of a response when creating an account in the KAS default account pool
{
  "address": "0xa809284C83b901eD106Aba4Ccda14628Af128e14",
  "chainId": 1001,
  "createdAt": 1599187293,
  "keyId": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default:0x4cbbcb974e32a7960e1b356edf60087613101919ed83199f12e872cba068a50f",
  "krn": "krn:1001:wallet:68ec0e4b-0f61-4e6f-ae35-be865ab23187:account-pool:default",
  "publicKey": "0x04cdccfb99b2905561e3dd886687b429a004718f11b04914f17ce68fd3a0db46c598a45da85caa61fe84cb78a0f2eaa9983ec7b8805a93ef9428eb1350a8558237",
  "updatedAt": 1599187293
}

//Example of a response when creating an account in the account pool that you created
{
  "address": "0xa809284C83b901eD106Aba4Ccda14628Af128e14",
  "chainId": 1001,
  "createdAt": 1599187293,
  "keyId": "krn:1001:wallet:6698d79e-78ee-439a-815d-f293ec6ae736:account-pool:ap1:0x4cbbcb974e32a7960e1b356edf60087613101919ed83199f12e872cba068a50f",
  "krn": "krn:1001:wallet:6698d79e-78ee-439a-815d-f293ec6ae736:account-pool:ap1",
  "publicKey": "0x04cdccfb99b2905561e3dd886687b429a004718f11b04914f17ce68fd3a0db46c598a45da85caa61fe84cb78a0f2eaa9983ec7b8805a93ef9428eb1350a8558237",
  "updatedAt": 1599187293
}

For details about this API, please visit here. For inquires about this document or KAS, please visit Developer Forum.

Loading KLAY into Account

You can only receive KLAY on the testnet (Baobab). After you claim your KLAY from Faucet for a certain account, you have to wait 24 hours for the daily limit to reset.

Getting 5KLAY

You can load 5KLAY into your account by clicking on the battery icon next to the account address.

For more information on this API, please refer to here. For inquiries on this document or on KAS in general, please visit Klaytn Forum.

Create Fee-payer Account

Create Fee-payer Pool

If you want to create the fee-payer account that pays the transaction fee for your other Klaytn accounts in KAS, you first have to create the fee-payer pool that manages those fee-payer accounts. You can create multiple fee-payer pools. After creating fee-payer pools in KAS Console, you need to select one to create a fee-payer account inside of it.

For details of the fee delegation methods that KAS provides, please visit here.

KAS Console - Service - Wallet - Fee-payer Pools

Click the “Create” button under the KAS Console - Service - Wallet - Fee-payer Pools menu. Click the button to display the screen for creating fee-payer pools.

Create Fee-payer Pool

Create a fee-payer pool, and it must have a different name from other fee-payer pools on the current KAS account.

Fee-payer accounts must only be created on the KAS Console, according to this guide. If a fee-payer account is created through another KAS API, it will not be registered to a KAS fee-payer pool.

Check Fee-payer Pool

Once the fee-payer pool is created, verify the pool in the fee-payer pool list.

KRN is used to call APIs for sending fee-delegated transactions.

For inquires about this document or KAS, please visit Developer Forum.

Create Fee-payer Account

Select one of the fee-payer pools to create a fee-payer account. Click a pool's KRN to display the "Details" screen of the fee-payer pool.

Click "Create Account" button to create the fee-payer account.

Check the newly created fee-payer account on the Details screen under the fee-payer pool.

For inquires about this document or KAS, please visit Developer Forum.

Create Operator

KAS Console - Service - Anchor - Operators

Click the "Create" button on the KAS Console - Service - Anchor - Operators menu. Click the button to display the screen for creating operators as follows.

Configure Transaction Fee Payments for Data Anchoring Transaction

For creating an operator on the KAS Console, set the account that would pay the anchoring transaction fee for data to be sent by the operator.

  • Use useGlobalFeepayer to send the data anchoring transaction even if the KLAY balance is insufficient.

  • An error will occur if all thee parameters are not set.

  • The data anchoring transaction fee will be delegated according to the following priorities if one or more parameters are entered.

Use useGlobalFeepayerto guarantee the execution of anchoring transaction.

To use feepayer, first create fee-payer pool and fee-payer account. The fee-payer account address and the KRN value of the fee-payer pool are required to use the feepayer.

The fee payment priority will be as follows if several parameters are used together to send anchoring transactions.

The account with higher priority will pay the anchoring transaction fee first if all three parameters are used. If the operator struggles to pay the transaction fee because of insufficient feepayer account balance, the operator that sends an anchoring transaction will directly pay the fee as it has the next priority.

Expected behaviors according to parameter values are as follow:

Create Operator

Once the parameters are set, create an operator.

You can check the created operator in the operator list.

For inquires about this document or KAS, please visit Developer Forum.

Last updated