Send KLAY

This page introduces how to send KLAY from your Klaytn account to other Klaytn account with Wallet API.

Before Getting Started

  • The x-chain-id value for calling the API is 8217 (Cypress) or 1001 (Baobab).

  • Essential parameters for calling APIs are described in individual examples.

Values that a user needs to enter for calling APIs will be represented with one pair of braces ({}). A user must enter the following values.

Item

Description

Note

chain-id

8217 or 1001

Cypress(Klaytn mainnet) or Baobab(Klaytn testnet

access-key-id

Auth ID

accessKeyId obtained from KAS Console - Security - Credential

secret-access-key

Auth Password

secretAccessKey obtained from KAS Console - Security - Credential

krn

(optional) ID of Account Pool

Unnecessary when using Default Account Pool

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.

KLAY is the cryptocurrency of Klaytn. For details about KLAY, please visit here.

Send KLAY: Direct Payment of Transaction Fee

The KLAY transmission API sends a transaction for sending KLAY to another account.

To send Klay, a user must send a transaction to the Klaytn Node and pay the transaction fee. In this example, the account who sends this transaction must directly pay the transaction fee for sending KLAY.

For details about KAS SDK (caver-js/caver-java extensions) installation and execution, please visit KAS SDK. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started.

API Request

Call the KLAY transmission API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

curl --location --request POST "https://wallet-api.klaytnapi.com/v2/tx/value" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "value": "0x100",
  "to": "0x2F87Ba64de5526F7880F21481Effbf950f70005c",
  "memo": "memo",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true
}"
  • submit: If it is false, a transaction is not sent and the RLP of signed transaction and the transaction information are returned.

  • from: The EOA of a Klaytn account to send the KLAY. This account sends KLAY to “to” account and it also sends this transaction directly.

API Response

Here is the response of the KLAY transmission API.

{
  "from": "0xa4068f0d4e4ffad5945824cddd748ba2dc450330",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0x6d656d6f",
  "nonce": 0,
  "rlp": "0x10f886808505d21dba00830f4240942f87ba64de5526f7880f21481effbf950f70005c82010094a4068f0d4e4ffad5945824cddd748ba2dc450330846d656d6ff847f8458207f5a029e618253df93692d7f26712e0aa29393f3fb72e5170fe99a43257ed9d32c2e6a02257927ba0ebf9d80471bb56b52efc196c319b40d33cd1f0a566911376da805f",
  "signatures": [
    {
      "R": "0x29e618253df93692d7f26712e0aa29393f3fb72e5170fe99a43257ed9d32c2e6",
      "S": "0x2257927ba0ebf9d80471bb56b52efc196c319b40d33cd1f0a566911376da805f",
      "V": "0x7f5"
    }
  ],
  "status": "Submitted",
  "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
  "transactionHash": "0x04cbfe6b4c1a39d4a8ab2fc4373a9da91e54762fdcbd90a7409a60cda0bea044",
  "typeInt": 16,
  "value": "0x100"
}

The API response value is as follows if the KLAY transmission transmit field is pending. Moreover, the KLAY transmission transaction can be pending if signatures are not obtained as required when sending KLAY to a Multiple Signing Account.

// KLAY transmission transaction, which is in pending status, is received as the API response value.
{
  "from": "0x6b0861be172884d6bcec75558b617287404d7073",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0x6d656d6f",
  "nonce": 1,
  "status": "Pending",
  "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
  "transactionId": "0x7ee5d33b931e1c172dee21027aeeca31c33ddd44efd02cd3fd4fdfa0a86f888e",
  "typeInt": 16,
  "value": "0x100"
}
  • transactionId: Transaction ID. This transaction requires multiple signatures.

“typeInt” variable is a value for identifying the transaction type. For details about the types of transactions, please visit here.

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

Send KLAY: Transaction Fee Delegation by User

The KLAY transmission API sends a transaction for sending KLAY to another account. If you send this transaction with fee-delegation, a fee payer account will pay the transaction fee instead of the transaction sender account.

To send Klay, a user must send a transaction to the Klaytn Node and pay the transaction fee. To call this API, you first need to create the Klaytn account who sends this transaction and the Klaytn account who pays the transaction fee (fee-payer) in Account Pool and Fee Payer Account Pool, each. In this example, the fee payer account pays the transaction transmission fee, not the account who sends this transaction. For details about fee-delegation methods that KAS provides for you, please visit here.

For details about KAS SDK (caver-js/caver-java extensions) installation and execution, please visit KAS SDK. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started. For more details on creating an fee payer Account Pool, fee payer account, and selecting an fee payer account, refer to Getting Started.

API Request

Call the fee delegation KLAY transmission API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

curl --location --request POST "https://wallet-api.klaytnapi.com/v2/tx/fd-user/value" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "value": "0x12",
  "to": "0x2F87Ba64de5526F7880F21481Effbf950f70005c",
  "memo": "memo",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true,
  "feePayer": "0x85B98485444c89880cD9C48807CEF727C296F2da",
  "feeRatio": 10
}"
  • from: The EOA of a Klaytn account to send the KLAY. This account sends KLAY to “to” account and it also sends this transaction directly.

  • submit: If it is false, a transaction is not sent and the RLP of signed transaction and the transaction information are returned.

  • fee_payer: If a user uses a separate transaction fee-payer account, he/she provides the account address to this parameter. Do not use the "feePayer" parameter to make KAS pay for the transaction fee first.

  • feeRatio: The ratio (1%~99%) of the transaction fee that a feePayer pays. The remaining fees will be directly paid by the account (from) that sends transactions to Klaytn.

    • This parameter is available for fee delegation through either a user fee-payer account or and KAS (KAS Global fee payer).

API Response

Here is the response of the fee delegation KLAY transmission API.

{
  "feePayer": "0xe8ab1729ab614551021cf5cc22c0e037f5a82930",
  "from": "0x9c56b45b7443bc73f47234199982481c64807f78",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0x6d656d6f",
  "nonce": 0,
  "rlp": "0x11f8e2808505d21dba00830f4240942f87ba64de5526f7880f21481effbf950f70005c12949c56b45b7443bc73f47234199982481c64807f78846d656d6ff847f8458207f6a06335f41b59276bd1d1c2b276d65b633545fe624b4c6eb854ac85c2bc0bfcb869a004e7b8910e1ce4cf47739dfa7801dd9b6f3d23de7acc932ad38c6bcc51429f2e94e8ab1729ab614551021cf5cc22c0e037f5a82930f847f8458207f6a0e4d799e18080ab2d9c82f979256d27ef87f68d19a07a6e9a57b006c4a639da12a0088df123474ad3a7ad6ef772603abc2ec209d9148ad3de29b475793240f54b41",
  "signatures": [
    {
      "R": "0x6335f41b59276bd1d1c2b276d65b633545fe624b4c6eb854ac85c2bc0bfcb869",
      "S": "0x4e7b8910e1ce4cf47739dfa7801dd9b6f3d23de7acc932ad38c6bcc51429f2e",
      "V": "0x7f6"
    }
  ],
  "status": "Submitted",
  "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
  "transactionHash": "0xbc35a85f694e27d88d9e65ddb005fff0abd5efa180862184ec466a6945e1fd55",
  "typeInt": 17,
  "value": "0x12"
}

The API response value is as follows if the KLAY transmission transaction is in pending. For example, the KLAY transmission transaction is pending if signatures are not obtained as required when a Multiple Signing Account sends KLAY.

// KLAY transmission transaction, which is in pending status, is received as the API response value.
{
  "feePayer": "0x6a7a7f60346852d23be184aa948fd7c5053c2096",
  "from": "0xe300034949f97251e3c5cf2c9fb5a159f713cae2",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0x6d656d6f",
  "nonce": 1,
  "status": "Pending",
  "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
  "transactionId": "0x036de62cde59113716ee3c8d453cf8cc0e2aac0b119d00c0290c1aacb5fe3847",
  "typeInt": 17,
  "value": "0x12"
}
  • transactionId: Transaction ID. This transaction requires multiple signatures.

“typeInt” variable is a value for identifying the transaction type. For details about the types of transactions, please visit here.

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

Send KLAY: Transaction Fee Delegation by KAS

The KLAY transmission API sends a transaction for sending KLAY to another account. If you send this transaction with fee-delegation, a fee payer account will pay the transaction fee instead of the transaction sender account.

To send Klay, a user must send a transaction to the Klaytn Node and pay the transaction fee. To call this API, you first need to create an Account Pool and a Klaytn account who sends this transaction in that Account Pool. In this example, the KAS global fee payer account pays the transaction transmission fee, not the account who sends this transaction. This fee paid by KAS global fee payer instead of the Klaytn account who sent a transaction will later be charged to your KAS account. For details about fee-delegation methods that KAS provides for you, please visit here.

For details about KAS SDK (caver-js/caver-java extensions) installation and execution, please visit KAS SDK. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started.

API Request

Call the KAS GlobalFeePayer fee delegation KLAY transmission API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

curl --location --request POST "https://wallet-api.klaytnapi.com/v2/tx/fd/value" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "value": "0x12",
  "to": "0x2F87Ba64de5526F7880F21481Effbf950f70005c",
  "memo": "memo",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true,
  "feeRatio": 10
}"
  • from: The EOA of a Klaytn account to send the KLAY. This account sends KLAY to “to” account and it also sends this transaction directly.

  • submit: If it is false, a transaction is not sent and the RLP of signed transaction and the transaction information are returned.

  • feeRatio: The ratio (1%~99%) of the transaction fee that a feePayer pays. The remaining fees will be directly paid by the account (from) that sends transactions to Klaytn.

    • This parameter is available for fee delegation through either a user fee-payer account or and KAS (KAS Global fee payer).

API Response

Here is the response of the KAS GlobalFeePayer fee delegation KLAY transmission API.

{
  "feePayer": "0x85b98485444c89880cd9c48807cef727c296f2da",
  "feeRatio": 10,
  "from": "0x9c56b45b7443bc73f47234199982481c64807f78",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0x6d656d6f",
  "nonce": 0,
  "rlp": "0x11f8e2808505d21dba00830f4240942f87ba64de5526f7880f21481effbf950f70005c12949c56b45b7443bc73f47234199982481c64807f78846d656d6ff847f8458207f6a06335f41b59276bd1d1c2b276d65b633545fe624b4c6eb854ac85c2bc0bfcb869a004e7b8910e1ce4cf47739dfa7801dd9b6f3d23de7acc932ad38c6bcc51429f2e94e8ab1729ab614551021cf5cc22c0e037f5a82930f847f8458207f6a0e4d799e18080ab2d9c82f979256d27ef87f68d19a07a6e9a57b006c4a639da12a0088df123474ad3a7ad6ef772603abc2ec209d9148ad3de29b475793240f54b41",
  "signatures": [
    {
      "R": "0x6335f41b59276bd1d1c2b276d65b633545fe624b4c6eb854ac85c2bc0bfcb869",
      "S": "0x4e7b8910e1ce4cf47739dfa7801dd9b6f3d23de7acc932ad38c6bcc51429f2e",
      "V": "0x7f6"
    }
  ],
  "status": "Submitted",
  "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
  "transactionHash": "0xbc35a85f694e27d88d9e65ddb005fff0abd5efa180862184ec466a6945e1fd55",
  "typeInt": 17,
  "value": "0x12"
}

The API response value is as follows if the KLAY transmission transaction is in pending. For example, the KLAY transmission transaction is pending if signatures are not obtained as required when a Multiple Signing Account sends KLAY.

// KLAY transmission transaction, which is in pending status, is received as the API response value.
{
  "feePayer": "0x85b98485444c89880cd9c48807cef727c296f2da",
  "from": "0xe300034949f97251e3c5cf2c9fb5a159f713cae2",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0x6d656d6f",
  "nonce": 1,
  "status": "Pending",
  "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
  "transactionId": "0x036de62cde59113716ee3c8d453cf8cc0e2aac0b119d00c0290c1aacb5fe3847",
  "typeInt": 17,
  "value": "0x12"
}
  • transactionId: Transaction ID. This transaction requires multiple signatures.

“typeInt” variable is a value for identifying the transaction type. For details about the types of transactions, please visit here.

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

Last updated