Klaytn
Wallet Structure
The semi-custodial wallet of Klaytn has the following structure.
- 대표주소
- 수수료주소
- 자식주소
TIP
When the fee delegation feature for withdrawal is enabled, the fee will be charged from the fee address.
Child Address
Generates child addresses by calling the Generate Child Address API. Generally, one child address is given to each end user. Generated child addresses can be checked from [Child Address Information] from the console or by calling the Access Child Address List API.
Response example
[
{
"address": "0xba73C6D733E7cdb2E64848676c43Ee1Ae05f1ba5",
"name": "test klaytn address"
}
]
Deposit
Deposit Status
When an asset from the outside arrives at the main or a child address, Octet recognizes it as a deposit. However, the deposit is not finalized even if the deposit transaction is included in the blocks. Additional blocks must be generated to finalize(FINALIZED
) the transaction to ensure the integrity of the transaction. When an asset is sent to a main or a child address but has not arrived, that transaction is not recognized. Therefore, there is no FAILED
status for the deposit transaction.
Status name | Description |
---|---|
UNFINALIZED | Deposit transaction is included in the blocks |
FINALIZED | Deposit transaction is included in the blocks and the next block is generated |
The number of blocks required to finalize the deposit is different depending on the network. Both testnet and mainnet require additional 1 blocks to finalize the transaction.
Testnet | Mainnet |
---|---|
1 block (about 1s) | 1 block (about 1s) |
Deposit Confirmation
1. Checking from the Console
You can check the deposit status from [Transaction History] on the console. UNFINALIZED
deposits are displayed as ‘Processing’, and FINALIZED
deposits are displayed as ‘Completed’.
2. Checking with Webhooks
When a deposit is finalized to a main or a child address, a deposit webhook will be sent. You can check the deposit status from the received webhook. For more information about how to use webhooks and their data structure, check the 'Webhook' page.
Withdrawal
Withdrawal Process
Semi-custodial wallet withdraws assets from the main and child addresses to the outside.
- Request withdrawal.
- Generate transaction.
- Calculates the optimal fees and propagates the transactions.
- Withdrawal is completed when the transactions are confirmed in the blocks.
Withdrawal Status
Unlike a deposit, a withdrawal is finalized(FINALIZED
) at the moment when the transaction is included in the blocks.
Status name | Description |
---|---|
AWAITING_DECISION | Awaiting withdrawal approval |
REJECTED | Withdrawal is denied |
AWAITING_WITHDRAWAL | Approved and awaiting withdrawal |
PENDING | Withdrawal transaction is generated |
FINALIZED | Withdrawal transaction is included in the blocks |
FAILED | Withdrawal transaction failed |
Withdrawal Fees
You need to choose whether to use fee delegation for withdrawals.
1. Using Fee Delegation
The withdrawal fee will be deducted from the fee address if the fee delegation feature is enabled. In this case, the fee address should have assets (KLAY) to pay the fee. Withdrawal will not proceed if the withdrawal fee is insufficient.
2. Not Using Fee Delegation
When the fee delegation feature is disabled, withdrawal fees will be deducted from the address to be withdrawn. For example, when withdrawing from ‘child address A’, a fee will be deducted from ‘child address A’. Therefore, the address to be withdrawn should have assets (KLAY) to pay the fee. Withdrawal will not proceed if the withdrawal fee is insufficient.
Withdraw
You can request a withdrawal from the main or child address to the outside by calling the Request Withdrawal API. The uuid
value will be returned when the withdrawal request is successful. The value can be used to access the withdrawal process.
Response example
{
"uuid": "b3d75c50-58bc-4851-94dc-34448c58ec68"
}
Withdrawal Confirmation
1. Checking from the Console
You can check the withdrawal status from [Transaction History] on the console. AWAITING_WITHDRAWAL
or PENDING
withdrawals are displayed as ‘Processing’, and FINALIZED
withdrawals are displayed as ‘Completed’.
2. Checking with API
You can check the progress of a specific withdrawal transaction by calling the Access Withdrawal Transaction Information API.
Response example
{
"idx": 490,
"uuid": "07efdcb2-b3fd-4fe7-bf47-c0b460b289e3",
"fromAddress": "0x71b5De2970A32eEf6362AE7Bc3B73103b4392bB0",
"toAddress": "0x295909dC67B76f936BD4119aDd877088602cCaD3",
"amount": "2.00000000000000000000",
"memo": null,
"requestId": "25",
"type": "API",
"description": "",
"requiredApprovalCount": 1,
"useApiAutoApproval": true,
"status": "SENT",
"createdDate": "2022-01-25T09:25:02.383Z",
"modifiedDate": "2022-01-25T09:25:10.000Z",
"rejectedDate": null
}
3. Checking with Webhooks
When the withdrawal from the main address is finished, a withdrawal webhook will be sent. You can check the withdrawal status from the webhook. For more information about how to use webhooks and their data structure, check the Webhook page.
Balance Access Criteria
You can check the balance of the asset stored in a specific address by calling the Access Address Balance API. The accessed balances are specified into total balances and liquid balances.
- Total balance is all assets with a confirmation of 1 or above.
- Liquid balance is assets that can be withdrawn in each address.
Fees
Estimated Fees
Estimated fees are calculated by multiplying the gas price’s FASTEST
value and the gas limit. Octet sets the gas limit of KLAYTNs to 21,000. The gas limit for tokens is set to 300,000 since it varies depending on how the tokens are implemented. The gas limit is the maximum value, so the actual gas usage could be less than that, and the fees are charged for the actual gas usage.
Estimated Fees = Gas Limit x Gas Price
Transaction Fees
You can access the gas price in real-time by calling the Fee/Gas API. Fees charged for a transaction are calculated by multiplying the gas price’s FASTEST
value and the amount of used gas.
Transaction Fees = Usage by Txn x Gas Price
트랜잭션 수수료 = 총 가스 사용량(Usage by Txn) x 가스 단가(Gas Price)
Faucet
In the case of the testnet, you must obtain a testing KLAY from the faucet website and deposit it. When an actual KLAT is deposited in the testnet, it will not be recognized.
Updated about 1 year ago