Sign up KAS
You can start using KAS after authenticating your e-mail address. On the Sign Up page, enter your email, password, name, phone number, and company name (optional).
Click [Join] to send a verification email to the entered email address. Check your inbox for the KAS authentication email, and look for the authentication number.
Enter this number on the KAS Console page to complete verification.
Once authenticated, you will be redirected to the Login page.
For inquires about this document or KAS, please visit KAS Developers Forum.
Sign in KAS Console
Log in using the registered email and password.
Once logged in, you will be redirected to default [Dashboard] where you can check the API usage by your Klaytn accounts created in KAS.
For any inquires about this document or KAS in general, please visit KAS Developers Forum.
What is Kaia Account?
A blockchain application will need to send transactions to the blockchain. The sender of the transactions to the blockchain is the "Account," whereas the user's account is denoted as EOA in Kaia. You need a Kaia account to send transactions to the platform using Wallet API, or to check the transaction history for KAIA or other tokens via the Token History API.
info
A KAS account is created by joining KAS, whereas a Kaia account must be created on the KAS Console.
For details on the transaction, please visit here.
For questions about this document or KAS in general, please visit KAS Developers Forum.
Account, Fee-payer Account, Operator Account
Kaia accounts include all accounts including the EOA (externally-owned account) for storing, sending, and receiving KAIA, and smart contract accounts created when deploying smart contracts, etc.
KAS offers several account types with different functions:
- Account : The account that sends transactions to Kaia
- Fee-payer Account : The account that pays transaction fees on behalf of the Accounts
- Operator : The account that anchors the service chain data to the Kaia mainnet
For questions about this document or KAS in general, please visit KAS Developers Forum.
Account Pool
A KAS account can have several Kaia accounts. KAS provides account pools for easy management of all Kaia accounts using just one KAS account. Each type of Kaia accounts can also have their own account pools, and one KAS account can create and operate multiple storages.
KAS provides the following account pool types with different roles:
- Account Pool : A repository for managing regular Kaia accounts
- Fee-payer Pool : A repository for managing fee-payer accounts
For questions about this document or KAS in general, please visit KAS Developers Forum.
Create Kaia Account
Create Account Pool
KAS provides account pools to manage multiple Kaia accounts. To use this, the 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.
Default Account Pool
The default account pool is assigned automatically when you do not do so yourself when calling a KAS API. If you didn't enter the KRN of your own account pool in x-krn
in API Request header, then the Kaia account in the default account pool will be used. You can find your the default account pool in [KAS Console] > [Service] > [Wallet] > [Account Pools], which is marked as DEFAULT
.
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
on KAS Console and you didn't specify any account pool when calling an API, the Kaia account stored in this A
account pool will automatically be used. When you didn't create any account pools and try to call an API that creates a Kaia account, KAS automatically designates the default account pool and push this newly created Kaia account into the default account pool.
info
Enter the KRN of other account pool to x-krn
if you want to call an API with a Kaia account stored in some other account pool.
KAS Console > Service > Wallet > Account Pools
Click the [Create] button under [KAS Console] > [Service] > [Wallet] > [Account Pools]. And then click on the button to display the screen for creating Kaia account pools.
Create Account Pool
Create a Kaia account pool. It must have a different name from other account pools for the current KAS account.
Check the Account Pool
Once the account pool is created, you can find it on the account pool list.
info
If you enter KRN, which is obtained from account pool, into the x-krn
in the API request header, you will be calling this API with the Kaia account stored in this account pool.
For questions about this document or KAS in general, please visit KAS Developers 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 Kaia 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 Kaia account which was created by calling Wallet API via this API Auth Key. The rights here include accessing and transferring all the assets (KAIA, etc.) of or sending a transaction from a Kaia account. If you shared your API Auth Key with any unauthorized personnel, your Kaia account could be compromised and might cause unwanted transaction execution.
danger
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/Kaia 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"
const result = await caver.kas.wallet.createAccount();
Account account = caver.kas.wallet.createAccount();
System.out.println(account);
API Response
Here is the response of the Kaia 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
}
Account {
address: '0xC42cF87D75d3233de424cD68B0B6fE381aD83E98',
chainId: 1001,
createdAt: 1601876981,
keyId: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default:0x199647191a710a38496ed645eeec3b82d980dd635eebe236464ebc3c28f2d841',
krn: 'krn:1001:wallet:8e76d003-d6dd-4278-8d05-5172d8f010ca:account-pool:default',
publicKey: '0x04f86e01d9ec2f80cf47594c342aa1151a5b9cf95c3d0b8ba8613afa531ebdf7fe4b7c49c2b0d25be6491fe53b92bbb40f23f1f830ca50708f8fe2775f24e9c4ce',
updatedAt: 1601876981
}
class Account {
address: 0xE8785620772e6d5cddB4C71808C0EcF2FDEB4079
chainId: 1001
createdAt: 1602120333
keyId: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool:0xa7b69c64336b0bc63481569cd81edaee81d61b35b4511d954dc534651eca75a3
krn: krn:1001:wallet:d5c346f5-bb80-4f45-9093-57e25205cdc8:account-pool:pool
publicKey: 0x04c5d9f0da5f39dcfb10fc386ce33853f6fbe0b75854433fd48af63af11ed889026d5b4f254637d21d8c03f9072065144529c0a54a36ed757b1893bad670d7dd0c
updatedAt: 1602120333
multiSigKeys: null
threshold: null
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.
Loading KAIA into Account
warning
You can only receive KAIA on the testnet (Kairos). After you claim your KLAY from Faucet for a certain account, you have to wait 24 hours for the daily limit to reset.
Getting 150 KAIA
You can load 150 KAIA 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 Kaia 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.
info
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.
warning
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.
info
KRN is used to call APIs for sending fee-delegated transactions.
For inquires about this document or KAS, please visit KAS Developers 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 KAS Developers 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.
Parameter | Description |
---|---|
feepayer | User's fee-payer account address. Used when paying data anchoring transaction fees using user's own fee-payer account. |
useOperator | Whether the operator will pay the data anchoring transaction fee |
useGlobalFeepayer | Whether KAS will pay data anchoring transaction fee (the transaction fee will be charged to the user later) |
-
Use
useGlobalFeepayer
to send the data anchoring transaction even if the KAIA 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.
warning
Use useGlobalFeepayer
to guarantee the execution of anchoring transaction.
info
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.
Priority | Parameter | the transaction fee payer |
---|---|---|
1 | feepayer | User's separate fee-payer account |
2 | useOperator | Operator |
3 | useGlobalFeepayer | KAS (transaction fee will be charged to the user later) |
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:
useGlobalFeepayer | feepayer | useOperator | Priority |
---|---|---|---|
false | X | false | Error |
true | X | false | KAS |
false | X | true | Operator |
true | X | true | Operator > KAS |
false | O | false | User fee-payer |
false | O | true | User fee-payer > Operator |
true | O | true | User fee-payer > Operator > KAS |
true | O | false | User fee-payer > KAS |
Create and Check 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 KAS Developers Forum.
Generate API Authentication Key
An API authentication key is used to verify membership of the API caller. The authentication key consists of AccessKey ID
and Secret AccessKey
. Enter the authentication key in the request header when calling the API by following these steps:
...
-u {access-key-id}:{secret-access-key}
...
Click [Security] > [Credential] menu on the Console Dashboard.
Click on [Create AccessKey] to create the AccessKey ID and Secret AccessKey. Push [Download] to download the created authentication key as a file (kas-credential-{access-key-id}.json).
An API authentication key can be created in [KAS Console] - [Security] - [Credential], and the authentication password (Secret AccessKey
) and Authorization
will only be displayed once, at the time of creation. So please copy and store the Secret AccessKey and Authorization in a safe location for safe management. Authorization
(e.g., Basic S0FTS1A2WkRaSjh...
), which is also generated when creating the Credential, is an encoded value of the AccessKey ID
and Secret AccessKey
using the basic authentication method. It is used in the request header when calling APIs.
The KAS API Authentication Key (API Auth Key) enables access to all KAS services and reserves the rights to the Kaia account created with the Wallet API using the said API Auth Key. "Rights" include the access to and disposal of all assets (KAIA, etc.) or sending a transaction from the Kaia account. If you share your API Auth Key with any unauthorized party, your Kaia account could be compromised and might result in unwanted transactions.
danger
DO NOT share your API Auth Key (Secret AccessKey or Authorization) with any unauthorized party. MAKE SURE to keep your API Auth Key safe for the security of your KAS/Kaia account.
info
Authentication keys can be created in [KAS Console] - [Security] - [Credential].
You can create up to two authentication keys.
To replace an existing authentication key, delete it first before creating a new one.
For any inquires about this document or KAS in general, please visit KAS Developers Forum.