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.

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/Klaytn account.

Send Cancel Transaction: Direct Payment of Transaction Fee

Send a transaction for canceling a pending (status = pending) transaction that was sent to Klaytn. For example, the transaction will be pending instead of being executed until all required signatures are obtained if the number of signatures for a transaction sent to Klaytn with a multisig account is lacking. Either a nonce or a transaction hash is required to cancel a transaction. For details about canceling transaction, please visit here.

To send the cancelation transaction, the user has to send a transaction to Klaytn Node and pay the transaction fee. To call the API, he/she must create an Account Pool and account, and then select an account to use. In this example, the sending account must directly pay the transaction fee for sending the cancelation transaction.

info

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 cancelation transaction transmission API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

cURLJavaScriptJava
Copy
Copied
curl --location --request DELETE "https://wallet-api.klaytnapi.com/v2/tx" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
    "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
    "transactionHash": "0x02e13becf638cac359381fa5dfc3ef8f598a90cceb9842eb714019bcd883fd59",
    "nonce": 0,
    "gasLimit": 1000000,
    "submit": true
}"
Copy
Copied
const tx = {
  from: "0x008Ad97530612A272d16228ec893e6Ce0F180b06",
  gas: 25000,
  nonce: "0x1",
  submit: true,
};
const result = await caver.kas.wallet.requestCancel(tx);
Copy
Copied
CancelTransactionRequest request = new CancelTransactionRequest();
request.setFrom("0x81ba6c299350719b18dfaec38ba566fbd5cd7202");
request.setNonce((long)1);

TransactionResult result = caver.kas.wallet.requestCancel(request);
System.out.println(result);
  • submit : If it is false, a transaction is not sent and the RLP of signed transaction and the transaction information are returned.

API Response

Here is a response of the cancelation transaction transmission API.

cURLJavaScriptJava
Copy
Copied
{
  "from": "0xa4068f0d4e4ffad5945824cddd748ba2dc450330",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "nonce": 99,
  "rlp": "0x38f869638505d21dba00830f424094a4068f0d4e4ffad5945824cddd748ba2dc450330f847f8458207f6a0df27642d09a731cb4002b3536db364821a2c25a1104e79d2295916c3368f6975a00db6df75befe463ca2da855e90b8389c41730cfe7773851e7391ab6431804852",
  "signatures": [
    {
      "R": "0xdf27642d09a731cb4002b3536db364821a2c25a1104e79d2295916c3368f6975",
      "S": "0xdb6df75befe463ca2da855e90b8389c41730cfe7773851e7391ab6431804852",
      "V": "0x7f6"
    }
  ],
  "status": "Submitted",
  "transactionHash": "0x665824b0c9cd2c8a76ac0fdb007f424f013d9c3e49723e2c8c896f38e7990375",
  "typeInt": 56
}
Copy
Copied
TransactionResult {
  from: '0x008ad97530612a272d16228ec893e6ce0f180b06',
  gas: 25000,
  gasPrice: '0x5d21dba00',
  nonce: 1,
  rlp: '0x38f868018505d21dba008261a894008ad97530612a272d16228ec893e6ce0f180b06f847f8458207f5a0a7d28d563fb7e10877d16de2ccfb154329c48fe234629c71fb0844707f81885ca075c7f7588b92efc92a05cd359a76f5e6dcb4580b84e2efe0e50dfc42b04d03d6',
  typeInt: 56,
  signatures: [
    Signature {
      R: '0xa7d28d563fb7e10877d16de2ccfb154329c48fe234629c71fb0844707f81885c',
      S: '0x75c7f7588b92efc92a05cd359a76f5e6dcb4580b84e2efe0e50dfc42b04d03d6',
      V: '0x7f5'
    }
  ],
  status: 'Submitted',
  transactionHash: '0xa598bb09c6a27cc1fe42baec4178ee81ca7fc4616ab626488626b2987475e722'
}
Copy
Copied
class TransactionResult {
    from: 0x81ba6c299350719b18dfaec38ba566fbd5cd7202
    gas: 1000000
    gasPrice: 0x5d21dba00
    input: null
    nonce: 1
    rlp: 0x38f869018505d21dba00830186a09481ba6c299350719b18dfaec38ba566fbd5cd7202f847f8458207f5a0d2f2c40a6ea2e82fde8f629995e3eb5667044c1d87764644c460c5773a47282ea0180f51d82c38c29f7900b4fc6616c1c1253a1d8fba910463ca1f091a7f02a86e
    signatures: [class Signature {
        R: 0xd2f2c40a6ea2e82fde8f629995e3eb5667044c1d87764644c460c5773a47282e
        S: 0x180f51d82c38c29f7900b4fc6616c1c1253a1d8fba910463ca1f091a7f02a86e
        V: 0x7f5
    }]
    status: null
    to: null
    transactionHash: null
    typeInt: 56
    value: null
    code: null
    message: null
    transactionId: null
    accountKey: null
}

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

Send Cancel Transaction: Transaction Fee Delegation by User

Send a transaction for canceling a pending (status = pending) transaction that was sent to Klaytn. For example, the transaction will be pending instead of being executed until all required signatures are obtained if the number of signatures for a transaction sent to Klaytn with a multisig account is lacking. Either a nonce or a transaction hash is required to cancel a transaction. For details about canceling transaction, please visit here.

To send the cancelation transaction, the user has to send a transaction to 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.

info

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 cancelation transaction transmission with fee-delegation API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

cURLJavaScriptJava
Copy
Copied
curl --location --request DELETE "https://wallet-api.klaytnapi.com/v2/tx/fd-user" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "transactionHash": "0x02e13becf638cac359381fa5dfc3ef8f598a90cceb9842eb714019bcd883fd59",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true,
  "feePayer": "0x85B98485444c89880cD9C48807CEF727C296F2da",
  "feeRatio": 10
}"
Copy
Copied
const tx = {
  from: "0x008Ad97530612A272d16228ec893e6Ce0F180b06",
  gas: 45000,
  nonce: "0x1",
  feeRatio: 99,
  feePayer: "0x44Ee3906a7a2007762E9d706dF6E4eF63FA1edA8",
  submit: true,
};
const result = await caver.kas.wallet.requestFDCancelPaidByUser(tx);
Copy
Copied
FDUserCancelTransactionRequest request = new FDUserCancelTransactionRequest();
request.setFrom("0x81ba6c299350719b18dfaec38ba566fbd5cd7202");
request.setFeePayer("0x31d845Ac80A0B2a38f6267CabcF34F8fA9DcD2B7");
request.setNonce((long)1);

FDTransactionResult result = caver.kas.wallet.requestFDCancelPaidByUser(request);
System.out.println(result);
  • 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 a response of the cancelation transaction transmission API with fee-delegation.

cURLJavaScriptJava
Copy
Copied
{
  "feePayer": "0xe8ab1729ab614551021cf5cc22c0e037f5a82930",
  "from": "0x9c56b45b7443bc73f47234199982481c64807f78",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "nonce": 330,
  "rlp": "0x39f8c982014a8505d21dba00830f4240949c56b45b7443bc73f47234199982481c64807f78f847f8458207f5a061ffd0e76da83a4c4b05ca23d8cd66ac4b6c5a63183b6cc89ac3b12e9688aeb8a052edf81652ff174e3a0e3856a35ee71ea814c70fbc9fb18f8c66adeb15d0550394e8ab1729ab614551021cf5cc22c0e037f5a82930f847f8458207f5a05a5bf47cbc87b1091ebfa140c504b3d7ab1756cdc1e25ea168a277e478a5e01da00f8bfdbad9f94507e53c3abfa6d9e824170939b47731483bc629d3d58326bbb9",
  "signatures": [
    {
      "R": "0x61ffd0e76da83a4c4b05ca23d8cd66ac4b6c5a63183b6cc89ac3b12e9688aeb8",
      "S": "0x52edf81652ff174e3a0e3856a35ee71ea814c70fbc9fb18f8c66adeb15d05503",
      "V": "0x7f5"
    }
  ],
  "status": "Submitted",
  "transactionHash": "0x176a40a522123e831107430e321adc34397f767ec9f75080ad0464ac0757be27",
  "typeInt": 57
}
Copy
Copied
FDTransactionResult {
  feePayer: '0x44ee3906a7a2007762e9d706df6e4ef63fa1eda8',
  from: '0x008ad97530612a272d16228ec893e6ce0f180b06',
  gas: 45000,
  gasPrice: '0x5d21dba00',
  nonce: 1,
  rlp: '0x3af8c7018505d21dba0082afc894008ad97530612a272d16228ec893e6ce0f180b0663f847f8458207f6a0abb75a3ac1caa29f9562c7676f0d478265c4f27d0e5a726968e81f215373e5d4a0229f90dc72477110d6816b4f53b2afaf9af6e6885c168b1577f0a8a66699680d9444ee3906a7a2007762e9d706df6e4ef63fa1eda8f847f8458207f5a0415d11a8cee87f94d41bcd6e328d1c51edb648e067f5244baa459027c7e41ccfa05b294ff66d1d061c78fbbe4718f042bb1b5fe09291e0535f0a9d6bc5d1481957',
  typeInt: 58,
  signatures: [
    Signature {
      R: '0xabb75a3ac1caa29f9562c7676f0d478265c4f27d0e5a726968e81f215373e5d4',
      S: '0x229f90dc72477110d6816b4f53b2afaf9af6e6885c168b1577f0a8a66699680d',
      V: '0x7f6'
    }
  ],
  status: 'Submitted',
  transactionHash: '0xd83fe75bcb63a39ecc0b69b5d0a9a17417e76297a2128c81cdaf32f0881c6b0b',
  feeRatio: 99
}
Copy
Copied
class FDTransactionResult {
    feePayer: 0x31d845ac80a0b2a38f6267cabcf34f8fa9dcd2b7
    from: 0x81ba6c299350719b18dfaec38ba566fbd5cd7202
    gas: 1000000
    gasPrice: 0x5d21dba00
    input: null
    nonce: 1
    rlp: 0x39f8c7018505d21dba00830186a09481ba6c299350719b18dfaec38ba566fbd5cd7202f847f8458207f6a09133c0735f66655799bce48c9624652d5a16fb0a2c1a764efc2d7513c20cd0dba05010da7070a6f7c26dbade1fd98971c7ecaa09c115f4e2d492d0080cd8ffa6719431d845ac80a0b2a38f6267cabcf34f8fa9dcd2b7f847f8458207f6a0f5e62a92a0eec30fc3a4a1e564da1241e05eb2388c199a4b09acc98cff8b4c5fa00574f058510fd7f779c7880b55e2a22a7584de1eb979cb63526c82d5093035ad
    signatures: [class Signature {
        R: 0x9133c0735f66655799bce48c9624652d5a16fb0a2c1a764efc2d7513c20cd0db
        S: 0x5010da7070a6f7c26dbade1fd98971c7ecaa09c115f4e2d492d0080cd8ffa671
        V: 0x7f6
    }]
    status: null
    to: null
    transactionHash: null
    typeInt: 57
    value: null
    feeRatio: null
    transactionId: null
    accountKey: null
}
info

"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 Developers Forum.

Send Cancel Transaction: Transaction Fee Delegation by KAS

Send a transaction for canceling a pending (status = pending) transaction that was sent to Klaytn. For example, the transaction will be pending instead of being executed until all required signatures are obtained if the number of signatures for a transaction sent to Klaytn with a multisig account is lacking. Either a nonce or a transaction hash is required to cancel a transaction. For details about canceling transaction, please visit here.

To send the cancelation transaction, the user has to send a transaction to 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.

info

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 cancelation transaction transmission with KAS GlobalFeePayer fee-delegation API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

cURLJavaScriptJava
Copy
Copied
curl --location --request DELETE "https://wallet-api.klaytnapi.com/v2/tx/fd" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "transactionHash": "0x02e13becf638cac359381fa5dfc3ef8f598a90cceb9842eb714019bcd883fd59",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true,
  "feePayer": "0x85B98485444c89880cD9C48807CEF727C296F2da",
  "feeRatio": 10
}"
Copy
Copied
const tx = {
  from: "0xBB0fDDc3F01BE0E72EFDaE72B30Db509d9a2396A",
  gas: 45000,
  nonce: "0x1",
  feeRatio: 99,
  submit: true,
};
const result = await caver.kas.wallet.requestFDCancelPaidByGlobalFeePayer(tx);
Copy
Copied
FDCancelTransactionRequest request = new FDCancelTransactionRequest();
request.setFrom("0x81ba6c299350719b18dfaec38ba566fbd5cd7202");
request.setNonce((long)1);

FDTransactionResult result = caver.kas.wallet.requestFDCancelPaidByGlobalFeePayer(request);
System.out.println(result);
  • 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 a response of the cancelation transaction transmission API with KAS GlobalFeePayer fee-delegation.

cURLJavaScriptJava
Copy
Copied
{
  "feePayer": "0x85b98485444c89880cd9c48807cef727c296f2da",
  "feeRatio": 10,
  "from": "0x9c56b45b7443bc73f47234199982481c64807f78",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "nonce": 330,
  "rlp": "0x39f8c982014a8505d21dba00830f4240949c56b45b7443bc73f47234199982481c64807f78f847f8458207f5a061ffd0e76da83a4c4b05ca23d8cd66ac4b6c5a63183b6cc89ac3b12e9688aeb8a052edf81652ff174e3a0e3856a35ee71ea814c70fbc9fb18f8c66adeb15d0550394e8ab1729ab614551021cf5cc22c0e037f5a82930f847f8458207f5a05a5bf47cbc87b1091ebfa140c504b3d7ab1756cdc1e25ea168a277e478a5e01da00f8bfdbad9f94507e53c3abfa6d9e824170939b47731483bc629d3d58326bbb9",
  "signatures": [
    {
      "R": "0x61ffd0e76da83a4c4b05ca23d8cd66ac4b6c5a63183b6cc89ac3b12e9688aeb8",
      "S": "0x52edf81652ff174e3a0e3856a35ee71ea814c70fbc9fb18f8c66adeb15d05503",
      "V": "0x7f5"
    }
  ],
  "status": "Submitted",
  "transactionHash": "0x176a40a522123e831107430e321adc34397f767ec9f75080ad0464ac0757be27",
  "typeInt": 57
}
Copy
Copied
FDTransactionResult {
  feePayer: '0x1b71a63903e35371e2fc41c6012effb99b9a2c0f',
  from: '0xbb0fddc3f01be0e72efdae72b30db509d9a2396a',
  gas: 45000,
  gasPrice: '0x5d21dba00',
  nonce: 1,
  rlp: '0x3af8c7018505d21dba0082afc894bb0fddc3f01be0e72efdae72b30db509d9a2396a63f847f8458207f5a03e9dcc9065241a864a6ff44e0aaf1524e7a1651d8cde87305357a61b85095138a03cc7e4ac2d45f65dc2f1671712a183b01c7eec1f333996bccf43d757c97514aa941b71a63903e35371e2fc41c6012effb99b9a2c0ff847f8458207f5a0de800fbb1039717090729f3b3bc4b73e49ced2da6f3f6589ef7ad143b48613aca01d26cf5060816e46756f2ccca4bf34696daebce0fd5349206116f66135fa0d70',
  typeInt: 58,
  signatures: [
    Signature {
      R: '0x3e9dcc9065241a864a6ff44e0aaf1524e7a1651d8cde87305357a61b85095138',
      S: '0x3cc7e4ac2d45f65dc2f1671712a183b01c7eec1f333996bccf43d757c97514aa',
      V: '0x7f5'
    }
  ],
  status: 'Submitted',
  transactionHash: '0x131b4952969855215a855b0655c96f757465c170cd8e13b834ac0f197c57b939',
  feeRatio: 99
}
Copy
Copied
class FDTransactionResult {
    feePayer: 0x1b71a63903e35371e2fc41c6012effb99b9a2c0f
    from: 0x81ba6c299350719b18dfaec38ba566fbd5cd7202
    gas: 1000000
    gasPrice: 0x5d21dba00
    input: null
    nonce: 1
    rlp: 0x39f8c7018505d21dba00830186a09481ba6c299350719b18dfaec38ba566fbd5cd7202f847f8458207f6a09b468cad159c571f5774dbc5cfea4b5e986d5529fa1be7275e3bd9dd6bed0282a063fb1acabb4f6c7b44282977de74b591f599263d554ddfa63059308dc57df27b941b71a63903e35371e2fc41c6012effb99b9a2c0ff847f8458207f6a08db1affae6da5ac520271e0219881122626c3d0a0e3e8af8847e2c497cd5c329a0387caed2d3e1d72dc405697fdc527d481da64a5d1ebeb100ead67224e148384e
    signatures: [class Signature {
        R: 0x9b468cad159c571f5774dbc5cfea4b5e986d5529fa1be7275e3bd9dd6bed0282
        S: 0x63fb1acabb4f6c7b44282977de74b591f599263d554ddfa63059308dc57df27b
        V: 0x7f6
    }]
    status: null
    to: null
    transactionHash: null
    typeInt: 57
    value: null
    feeRatio: null
    transactionId: null
    accountKey: null
}
info

"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 Developers Forum.