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.

Execute Smart Contract Functions: Direct Payment of Transaction Fee

A user may execute or call a smart contract function using KAS. The smart contract function execution records data in a smart contract or changes data stored in a smart contract. The smart contract function call only reads data stored in a smart contract. For more details on the smart contract function execution and call, refer to the followings. A smart contract must have been deployed to Klaytn Node before you execute a smart contract function. For more details on deploying a smart contract, refer to the followings.

To execute a smart contract function, the bytecode of the execution function is required. The bytecode of the function can be obtained by compiling the contract code using the Solidity Compiler when deploying the smart contract. To executes a smart contract to KAS, the user must send the transaction using KAS to Klaytn Node and pay the transaction fee for this. To call the API, he/she must first create an Account Pool and account, and then select an account to use. In this example, the executing account must directly pay the transaction fee for executing the smart contract.

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

cURLJavaScriptJava
Copy
Copied
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/tx/contract/execute" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "value": "0x0",
  "to": "0x71ca8095264fdf58f1a2007e0f91140d67292736",
  "input": "0xd14e62b80000000000000000000000000000000000000000000000000000000000000005",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true
}"
Copy
Copied
const tx = {
  from: "0x48c08e034c4c9779800713A9ad5BA768dA196288",
  to: "0x9c44fdb25e96d49731336b0346f09eea501ee895",
  value: 0,
  input:
    "0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000",
  gas: 500000,
  submit: true,
};
const result = await caver.kas.wallet.requestSmartContractExecution(tx);
Copy
Copied
ContractExecutionTransactionRequest request = new ContractExecutionTransactionRequest();
String input = "0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000";

request.setFrom("0x81bA6c299350719B18dFAEC38ba566fBd5Cd7202");
request.setTo("0x9c44fdb25e96d49731336b0346f09eea501ee895");
request.setInput(input);
request.setSubmit(true);

TransactionResult result = caver.kas.wallet.requestSmartContractExecution(request);
System.out.println(result);
  • input : The bytecode of smart contract to be executed. It can be obtained by compiling this smart contract that is written with Solidity using the Solidity compiler
  • 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 the response of the smart contract execution API.

cURLJavaScriptJava
Copy
Copied
{
  "from": "0xa4068f0d4e4ffad5945824cddd748ba2dc450330",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0xd14e62b80000000000000000000000000000000000000000000000000000000000000005",
  "nonce": 3,
  "rlp": "0x30f8a4038505d21dba00830f4240940a0ca70bd0074160874dc9337ca7ff8049b2e63e8094a4068f0d4e4ffad5945824cddd748ba2dc450330a4d14e62b80000000000000000000000000000000000000000000000000000000000000005f847f8458207f5a002b41abdf77b3d943c3c9000be45144ccc8cd25a75e523705aca3621ffdd4dd8a01bbf357d02e5f4bbc015cf35107e150d50094ffcb8fccbb7db981c739149eadb",
  "signatures": [
    {
      "R": "0x2b41abdf77b3d943c3c9000be45144ccc8cd25a75e523705aca3621ffdd4dd8",
      "S": "0x1bbf357d02e5f4bbc015cf35107e150d50094ffcb8fccbb7db981c739149eadb",
      "V": "0x7f5"
    }
  ],
  "status": "Submitted",
  "to": "0x0a0ca70bd0074160874dc9337ca7ff8049b2e63e",
  "transactionHash": "0x039e174f22e402caae753396d58e68e47062d8d32be1ae988bb1ddea7134afc0",
  "typeInt": 48,
  "value": "0x0"
}
Copy
Copied
TransactionResult {
  from: '0x48c08e034c4c9779800713a9ad5ba768da196288',
  gas: 500000,
  gasPrice: '0x5d21dba00',
  nonce: 1,
  rlp: '0x30f90145018505d21dba008307a120949c44fdb25e96d49731336b0346f09eea501ee895809448c08e034c4c9779800713a9ad5ba768da196288b8c4e942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000f847f8458207f5a0211b3d5c28310ca7ab572aab8993ddcce7046232a9c2242402fd7977246d16bea0217d8a7edf9189584e70b1c9e54e4e94044a0c75c96ab0a4cc22403762377fae',
  typeInt: 48,
  input: '0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000',
  signatures: [
    Signature {
      R: '0x211b3d5c28310ca7ab572aab8993ddcce7046232a9c2242402fd7977246d16be',
      S: '0x217d8a7edf9189584e70b1c9e54e4e94044a0c75c96ab0a4cc22403762377fae',
      V: '0x7f5'
    }
  ],
  status: 'Submitted',
  to: '0x9c44fdb25e96d49731336b0346f09eea501ee895',
  transactionHash: '0x52018b7031469ce927b620a0f089ebea6e87b9af938dec2846116547d03db52b',
  value: '0x0'
}
Copy
Copied
class TransactionResult {
    from: 0x81ba6c299350719b18dfaec38ba566fbd5cd7202
    gas: 1000000
    gasPrice: 0x5d21dba00
    input: 0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000
    nonce: 945
    rlp: 0x30f901478203b18505d21dba00830186a0949c44fdb25e96d49731336b0346f09eea501ee895809481ba6c299350719b18dfaec38ba566fbd5cd7202b8c4e942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000f847f8458207f5a086ea20f9cf6eab93045e1ed6c2d851c8c2498566c0a8a22d9d0d9f2af1d0527ea02fe23176eaac90e350d062af5fd8dcf85cbc73bbcb40ed7164e35583808688f8
    signatures: [class Signature {
        R: 0x86ea20f9cf6eab93045e1ed6c2d851c8c2498566c0a8a22d9d0d9f2af1d0527e
        S: 0x2fe23176eaac90e350d062af5fd8dcf85cbc73bbcb40ed7164e35583808688f8
        V: 0x7f5
    }]
    status: Submitted
    to: 0x9c44fdb25e96d49731336b0346f09eea501ee895
    transactionHash: 0x6f41e729d1be031fee875a1ff9e95f60e3db214351911399855130113831f17c
    typeInt: 48
    value: 0x0
    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.

Execute Smart Contract Functions: Transaction Fee Delegation by User

A user may execute or call a smart contract function using KAS. The smart contract function execution records data in a smart contract or changes data stored in a smart contract. The smart contract function call only reads data stored in a smart contract. For more details on the smart contract function execution and call, refer to the followings. A smart contract must have been deployed to Klaytn Node before you execute a smart contract function. For more details on deploying a smart contract, refer to the followings.

To execute a smart contract function, the bytecode of the execution function is required. The bytecode of the function can be obtained by compiling the contract code using the Solidity Compiler when deploying the smart contract. To executes a smart contract to KAS, the user must send the transaction using KAS to Klaytn Node and pay the transaction fee for this. 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 smart contract execution 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 POST "https://wallet-api.klaytnapi.com/v2/tx/fd-user/contract/execute" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "value": "0x0",
  "to": "0x71ca8095264fdf58f1a2007e0f91140d67292736",
  "input": "0xd14e62b80000000000000000000000000000000000000000000000000000000000000005",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true,
  "feePayer": "0x85B98485444c89880cD9C48807CEF727C296F2da",
  "feeRatio": 10
}"
Copy
Copied
const tx = {
  from: "0x48c08e034c4c9779800713A9ad5BA768dA196288",
  to: "0x9c44fdb25e96d49731336b0346f09eea501ee895",
  value: 0,
  input:
    "0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000",
  gas: 500000,
  feePayer: "0x44Ee3906a7a2007762E9d706dF6E4eF63FA1edA8",
  submit: true,
};
const result = await caver.kas.wallet.requestFDSmartContractExecutionPaidByUser(
  tx
);
Copy
Copied
String input = "0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000";

FDUserContractExecutionTransactionRequest request = new FDUserContractExecutionTransactionRequest();
request.setFrom("0x81bA6c299350719B18dFAEC38ba566fBd5Cd7202");
request.setTo("0x9c44fdb25e96d49731336b0346f09eea501ee895");
request.setFeePayer("0x31d845Ac80A0B2a38f6267CabcF34F8fA9DcD2B7");
request.setInput(input);
request.setSubmit(true);

FDTransactionResult result = caver.kas.wallet.requestFDSmartContractExecutionPaidByUser(request);
System.out.println(result);
  • input : The bytecode of smart contract to be executed. It can be obtained by compiling this smart contract that is written with Solidity using the Solidity compiler
  • 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 smart contract execution with fee-delegation API.

cURLJavaScriptJava
Copy
Copied
{
  "feePayer": "0xe8ab1729ab614551021cf5cc22c0e037f5a82930",
  "from": "0x9c56b45b7443bc73f47234199982481c64807f78",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0xd14e62b80000000000000000000000000000000000000000000000000000000000000005",
  "nonce": 2,
  "rlp": "0x31f90102028505d21dba00830f424094182efef646797698059fb0e6cbb4823687d869d880949c56b45b7443bc73f47234199982481c64807f78a4d14e62b80000000000000000000000000000000000000000000000000000000000000005f847f8458207f5a03a5ff2dfb032a774d84af240a2aeacf4ac4bcf428de4f1f5adc6f4c003a96794a053e39aa65cd1006136be9ade19413e5bfd53c5575b40d5f32aa7e19037003df794e8ab1729ab614551021cf5cc22c0e037f5a82930f847f8458207f5a029cb2ac282e5880ef0ed8bf1bfca08f51ae151757ff50cdf08eccb23600c4ee4a048aedf8ef1415a3a7d32358f0d45d7223fd37532eafb8c4937828b2a284b80e3",
  "signatures": [
    {
      "R": "0x3a5ff2dfb032a774d84af240a2aeacf4ac4bcf428de4f1f5adc6f4c003a96794",
      "S": "0x53e39aa65cd1006136be9ade19413e5bfd53c5575b40d5f32aa7e19037003df7",
      "V": "0x7f5"
    }
  ],
  "status": "Submitted",
  "to": "0x182efef646797698059fb0e6cbb4823687d869d8",
  "transactionHash": "0x4fcb4c06f81676d6b811f5b867f3ab5d166014e6c1dd982fec037eafdf89c88e",
  "typeInt": 49,
  "value": "0x0"
}
Copy
Copied
FDTransactionResult {
  feePayer: '0x44ee3906a7a2007762e9d706df6e4ef63fa1eda8',
  from: '0x48c08e034c4c9779800713a9ad5ba768da196288',
  gas: 500000,
  gasPrice: '0x5d21dba00',
  nonce: 3,
  rlp: '0x31f901a3038505d21dba008307a120949c44fdb25e96d49731336b0346f09eea501ee895809448c08e034c4c9779800713a9ad5ba768da196288b8c4e942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000f847f8458207f6a0637130c162fea33672be08919712cbe307af92f28cdb2b5f61477be1990191cca05f219bcaf2e03ca31a0dae2de9c677e19ee66b3b0b0d6f87f92635c0915deaea9444ee3906a7a2007762e9d706df6e4ef63fa1eda8f847f8458207f5a007e921390ff9745431384897c7e43d3815724836832c377a2e3010c41fd5231fa0201471047dd115259f632f27659e44dad4b262703cbdd93caa4d9fa83471086b',
  typeInt: 49,
  input: '0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000',
  signatures: [
    Signature {
      R: '0x637130c162fea33672be08919712cbe307af92f28cdb2b5f61477be1990191cc',
      S: '0x5f219bcaf2e03ca31a0dae2de9c677e19ee66b3b0b0d6f87f92635c0915deaea',
      V: '0x7f6'
    }
  ],
  status: 'Submitted',
  to: '0x9c44fdb25e96d49731336b0346f09eea501ee895',
  transactionHash: '0x3a5b3f1159ac4e9e92400e2f5d597ff92055db5db693f41a4283fdf6aac87739',
  value: '0x0'
}
Copy
Copied
class FDTransactionResult {
    feePayer: 0x31d845ac80a0b2a38f6267cabcf34f8fa9dcd2b7
    from: 0x81ba6c299350719b18dfaec38ba566fbd5cd7202
    gas: 1000000
    gasPrice: 0x5d21dba00
    input: 0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000
    nonce: 946
    rlp: 0x31f901a58203b28505d21dba00830186a0949c44fdb25e96d49731336b0346f09eea501ee895809481ba6c299350719b18dfaec38ba566fbd5cd7202b8c4e942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000f847f8458207f6a036ba607abbfef797efd83cb7d63133ff01e93c97eee9af086c987b27b502c7daa026457a867cb4fac2fa4485e3eeff4f29dcdd7bfe6e182b84a0e4d2cb433f41609431d845ac80a0b2a38f6267cabcf34f8fa9dcd2b7f847f8458207f5a05c5e1d83f93ef39aa2b74777a0018ceec2bb77798a5a41a35aef6eecce71f6b6a02b8d86ecb2acccfed67fedcecbd995c12d3035f573abbc7d32309fc9f3687c2e
    signatures: [class Signature {
        R: 0x36ba607abbfef797efd83cb7d63133ff01e93c97eee9af086c987b27b502c7da
        S: 0x26457a867cb4fac2fa4485e3eeff4f29dcdd7bfe6e182b84a0e4d2cb433f4160
        V: 0x7f6
    }]
    status: Submitted
    to: 0x9c44fdb25e96d49731336b0346f09eea501ee895
    transactionHash: 0x44fd5386497434281de8a6267ab403b4b1872d02670ed83bf86ed9b1afacf144
    typeInt: 49
    value: 0x0
    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.

Execute Smart Contract Functions: Transaction Fee Delegation by KAS

A user may execute or call a smart contract function using KAS. The smart contract function execution records data in a smart contract or changes data stored in a smart contract. The smart contract function call only reads data stored in a smart contract. For more details on the smart contract function execution and call, refer to the followings. A smart contract must have been deployed to Klaytn Node before you execute a smart contract function. For more details on deploying a smart contract, refer to the followings.

To execute a smart contract function, the bytecode of the execution function is required. The bytecode of the function can be obtained by compiling the contract code using the Solidity Compiler when deploying the smart contract. To executes a smart contract to KAS, the user must send the transaction using KAS to Klaytn Node and pay the transaction fee for this. 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 smart contract execution 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 POST "https://wallet-api.klaytnapi.com/v2/tx/fd/contract/execute" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "from": "0x5bb85d4032354E88020595AFAFC081C24098202e",
  "value": "0x0",
  "to": "0x71ca8095264fdf58f1a2007e0f91140d67292736",
  "input": "0xd14e62b80000000000000000000000000000000000000000000000000000000000000005",
  "nonce": 0,
  "gasLimit": 1000000,
  "submit": true,
  "feePayer": "0x85B98485444c89880cD9C48807CEF727C296F2da",
  "feeRatio": 10
}"
Copy
Copied
const tx = {
  from: "0xa3E4f619C1D5d737a72f1df74e14a57Fae5f2867",
  to: "0x24553ed65819df0fc78bb5544c84c8bcff35b89e",
  value: 0,
  input:
    "0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000",
  gas: 500000,
  feeRatio: 99,
  submit: true,
};
const result =
  await caver.kas.wallet.requestFDSmartContractExecutionPaidByGlobalFeePayer(
    tx
  );
Copy
Copied
String input = "0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000";
FDContractExecutionTransactionRequest request = new FDContractExecutionTransactionRequest();

request.setFrom("0x81bA6c299350719B18dFAEC38ba566fBd5Cd7202");
request.setTo("0x24553ed65819df0fc78bb5544c84c8bcff35b89e");
request.setInput(input);
request.setSubmit(true);

FDTransactionResult result = caver.kas.wallet.requestFDSmartContractExecutionPaidByGlobalFeePayer(request);
System.out.println(result);
  • input : The bytecode of smart contract to be executed. It can be obtained by compiling this smart contract that is written with Solidity using the Solidity compiler
  • 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 smart contract execution with KAS GlobalFeePayer fee-delegation API.

cURLJavaScriptJava
Copy
Copied
{
  "feePayer": "0x85b98485444c89880cd9c48807cef727c296f2da",
  "feeRatio": 10,
  "from": "0x9c56b45b7443bc73f47234199982481c64807f78",
  "gasLimit": 1000000,
  "gasPrice": "0x5d21dba00",
  "input": "0xd14e62b80000000000000000000000000000000000000000000000000000000000000005",
  "nonce": 2,
  "rlp": "0x31f90102028505d21dba00830f424094182efef646797698059fb0e6cbb4823687d869d880949c56b45b7443bc73f47234199982481c64807f78a4d14e62b80000000000000000000000000000000000000000000000000000000000000005f847f8458207f5a03a5ff2dfb032a774d84af240a2aeacf4ac4bcf428de4f1f5adc6f4c003a96794a053e39aa65cd1006136be9ade19413e5bfd53c5575b40d5f32aa7e19037003df794e8ab1729ab614551021cf5cc22c0e037f5a82930f847f8458207f5a029cb2ac282e5880ef0ed8bf1bfca08f51ae151757ff50cdf08eccb23600c4ee4a048aedf8ef1415a3a7d32358f0d45d7223fd37532eafb8c4937828b2a284b80e3",
  "signatures": [
    {
      "R": "0x3a5ff2dfb032a774d84af240a2aeacf4ac4bcf428de4f1f5adc6f4c003a96794",
      "S": "0x53e39aa65cd1006136be9ade19413e5bfd53c5575b40d5f32aa7e19037003df7",
      "V": "0x7f5"
    }
  ],
  "status": "Submitted",
  "to": "0x182efef646797698059fb0e6cbb4823687d869d8",
  "transactionHash": "0x4fcb4c06f81676d6b811f5b867f3ab5d166014e6c1dd982fec037eafdf89c88e",
  "typeInt": 49,
  "value": "0x0"
}
Copy
Copied
FDTransactionResult {
  feePayer: '0x1b71a63903e35371e2fc41c6012effb99b9a2c0f',
  from: '0xa3e4f619c1d5d737a72f1df74e14a57fae5f2867',
  gas: 500000,
  gasPrice: '0x5d21dba00',
  nonce: 1,
  rlp: '0x32f901a4018505d21dba008307a1209424553ed65819df0fc78bb5544c84c8bcff35b89e8094a3e4f619c1d5d737a72f1df74e14a57fae5f2867b8c4e942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c756500000000000000000000000000000000000000000000000000000063f847f8458207f5a054efb6aebcaa643dd7ddbaad25a8e9f4cb2f4a293f4772bdb1ee40d15d436312a02a5d4579df1411e7dd76894b9225e578b90b913062d401e0d8405b4ce57f36df941b71a63903e35371e2fc41c6012effb99b9a2c0ff847f8458207f5a0957bc59cdf4dffa34609f3d24d122aa89137f594eb4ed581988d9e9f92aab583a0402f8280392f8d44ca78daf5687c0798654e5cbd5766b1a280e31bfd879e60a1',
  typeInt: 50,
  input: '0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000',
  signatures: [
    Signature {
      R: '0x54efb6aebcaa643dd7ddbaad25a8e9f4cb2f4a293f4772bdb1ee40d15d436312',
      S: '0x2a5d4579df1411e7dd76894b9225e578b90b913062d401e0d8405b4ce57f36df',
      V: '0x7f5'
    }
  ],
  status: 'Submitted',
  to: '0x24553ed65819df0fc78bb5544c84c8bcff35b89e',
  transactionHash: '0x000a59fd50fee1a22d31cb73715a5222f78fbbdd2b133c6c15e205c6704b7aa7',
  value: '0x0',
  feeRatio: 99
}
Copy
Copied
class FDTransactionResult {
    feePayer: 0x1b71a63903e35371e2fc41c6012effb99b9a2c0f
    from: 0x81ba6c299350719b18dfaec38ba566fbd5cd7202
    gas: 1000000
    gasPrice: 0x5d21dba00
    input: 0xe942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000
    nonce: 947
    rlp: 0x31f901a58203b38505d21dba00830186a09424553ed65819df0fc78bb5544c84c8bcff35b89e809481ba6c299350719b18dfaec38ba566fbd5cd7202b8c4e942b5160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000f847f8458207f5a0f819b77c66829d6b0f8b38992585fe55554c0239570b501893b5e102c1f4535ca027668fbee0f3c1a6d5f9ac609c793e554784ed29c9c77148c89e57c8b05fd2ee941b71a63903e35371e2fc41c6012effb99b9a2c0ff847f8458207f6a0e44a0b4d675784925616730f32b074e9c238a919facfecf1f45af4373761fec8a031735e243b2aa92455f6ac303c6151e8a4782497cfc0dacabd81075d03eabcde
    signatures: [class Signature {
        R: 0xf819b77c66829d6b0f8b38992585fe55554c0239570b501893b5e102c1f4535c
        S: 0x27668fbee0f3c1a6d5f9ac609c793e554784ed29c9c77148c89e57c8b05fd2ee
        V: 0x7f5
    }]
    status: Submitted
    to: 0x24553ed65819df0fc78bb5544c84c8bcff35b89e
    transactionHash: 0x3228d1259dde89bfeae8f33a2ce0e3b1615c413e07345d6679d134792742df2f
    typeInt: 49
    value: 0x0
    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.