Transaction

klay_call

Executes a new message call immediately without creating a transaction on the block chain. It returns data or an error object of JSON RPC if error occurs.
Parameters
Name
Type
Description
callObject
Object
The transaction call object. See the next table for the object's properties.
blockNumber
QUANTITY | TAG
Integer block number, or the string "earliest" or "latest" as in the default block parameter.
callObject has the following properties:
Name
Type
Description
from
20-byte DATA
(optional) The address the transaction is sent from.
to
20-byte DATA
(optional when testing the deployment of a new contract) The address the transaction is directed to.
gas
QUANTITY
(optional) Integer of the gas provided for the transaction execution. klay_call consumes zero gas, but this parameter may be needed by some executions.
gasPrice
QUANTITY
(optional) Integer of the gasPrice used for each paid gas.
value
QUANTITY
(optional) Integer of the value sent with this transaction.
data
DATA
(optional) Hash of the method signature and encoded parameters.
Return Value
Type
Description
DATA
The return value of executed contract.
If you deployed a contract, use klay_getTransactionReceipt to get the contract address.
Error
It returns an error object of JSON RPC if anything goes wrong. For example, an error object with a message "evm: execution reverted" will be generated if a message call is terminated with REVERT opcode.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "klay_call", "params": [{"from": "0x3f71029af4e252b25b9ab999f77182f0cd3bc085", "to": "0x87ac99835e67168d4f9a40580f8f5c33550ba88b", "gas": "0x100000", "gasPrice": "0x5d21dba00", "value": "0x0", "data": "0x8ada066e"}, "latest"], "id": 1}' http://localhost:8551
3
4
// Result
5
{"jsonrpc":"2.0","id":1,"result":"0x000000000000000000000000000000000000000000000000000000000000000a"}
Copied!

klay_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including Klaytn Virtual Machine mechanics and node performance.
Parameters
Name
Type
Description
callObject
Object
The transaction call object. See the next table for the object's properties.
callObject has the following properties:
Name
Type
Description
from
20-byte DATA
(optional) The address the transaction is sent from.
to
20-byte DATA
(optional when testing the deployment of a new contract) The address the transaction is directed to.
gas
QUANTITY
(optional) Integer of the upper gas limit provided for the gas estimation. If no gas limit is specified, the Klaytn node uses the designated gas limit as an upper bound.
gasPrice
QUANTITY
(optional) Integer of the gasPrice used for each paid gas.
value
QUANTITY
(optional) Integer of the value sent with this transaction.
data
DATA
(optional) Hash of the method signature and encoded parameters.
Return Value
Type
Description
QUANTITY
The amount of gas used.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "klay_estimateGas", "params": [{"from": "0x3f71029af4e252b25b9ab999f77182f0cd3bc085", "to": "0x87ac99835e67168d4f9a40580f8f5c33550ba88b", "gas": "0x100000", "gasPrice": "0x5d21dba00", "value": "0x0", "data": "0x8ada066e"}], "id": 1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc": "2.0","id":1,
7
"result": "0x5208" // 21000
8
}
Copied!

klay_estimateComputationCost

Generates and returns an estimate of how much computation cost will be spent to execute the transaction. Klaytn limits the computation cost of a transaction to 100000000 currently not to take too much time by a single transaction. The transaction will not be added to the blockchain like klay_estimateGas.
Parameters
See klay_call parameters, except that all properties are optional. If no gas limit is specified, the Klaytn node uses the default gas limit (uint64 / 2) as an upper bound.
Return Value
Type
Description
QUANTITY
The amount of computation cost used.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_estimateComputationCost","params":[{"from":"0x73718c4980728857f3aa5148e9d1b471efa3a7dd", "to":"0x069942a3ca0dabf495dba872533134205764bc9c", "value":"0x0", "data":"0x2a31efc7000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000003039"}, "latest"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc": "2.0","id":1,
7
"result": "0x1e8b0ad"
8
}
Copied!

klay_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position. This API works only on RPC call, not on Javascript console.
Parameters
Type
Description
32-byte DATA
Hash of a block.
QUANTITY
Integer of the transaction index position.
Return Value
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getTransactionByBlockHashAndIndex","params":["0x451cafae98d61b7458b5cef54402830941432278184453e3ca490eb687317e68", "0x0"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x0591ceb74102fc4ed54b66d27e869224d481e9f44170b25ed4a5654675043198",
10
"blockNumber":"0x27",
11
"from":"0xe02837b9d671e0848e599c374416f383f8910e45",
12
"gas":"0xf4240",
13
"gasPrice":"0x5d21dba00",
14
"hash":"0x451cafae98d61b7458b5cef54402830941432278184453e3ca490eb687317e68",
15
"input":"0x",
16
"nonce":"0x1",
17
"senderTxHash":"0x451cafae98d61b7458b5cef54402830941432278184453e3ca490eb687317e68",
18
"signatures":[
19
{
20
"V":"0xfea",
21
"R":"0x1924d0f36e05d368a37b8130b85067f21f0ea1d35b87bf137216cdc3c844c762",
22
"S":"0x31d61be4d5cf677e60ad0fa0214e75c3167509c8d8905d7c6f85979b5f32eead"
23
}
24
],
25
"to":"0x44d827f98430784c8e3401748d8ba92c43df4546",
26
"transactionIndex":"0x0",
27
"type":"TxTypeLegacyTransaction",
28
"typeInt":0,
29
"value":"0xde0b6b3a7640000"
30
}
31
}
Copied!

klay_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position. This API works only on RPC call, not on Javascript console.
Parameters
Type
Description
QUANTITY | TAG
Integer block number, or the string "earliest" or "latest" as in the default block parameter.
QUANTITY
The transaction index position.
Return Value
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getTransactionByBlockNumberAndIndex","params":["0x27", "0x0"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x0591ceb74102fc4ed54b66d27e869224d481e9f44170b25ed4a5654675043198",
10
"blockNumber":"0x27",
11
"from":"0xe02837b9d671e0848e599c374416f383f8910e45",
12
"gas":"0xf4240",
13
"gasPrice":"0x5d21dba00",
14
"hash":"0x451cafae98d61b7458b5cef54402830941432278184453e3ca490eb687317e68",
15
"input":"0x",
16
"nonce":"0x1",
17
"senderTxHash":"0x451cafae98d61b7458b5cef54402830941432278184453e3ca490eb687317e68",
18
"signatures":[
19
{
20
"V":"0xfea",
21
"R":"0x1924d0f36e05d368a37b8130b85067f21f0ea1d35b87bf137216cdc3c844c762",
22
"S":"0x31d61be4d5cf677e60ad0fa0214e75c3167509c8d8905d7c6f85979b5f32eead"
23
}
24
],
25
"to":"0x44d827f98430784c8e3401748d8ba92c43df4546",
26
"transactionIndex":"0x0",
27
"type":"TxTypeLegacyTransaction",
28
"typeInt":0,
29
"value":"0xde0b6b3a7640000"
30
}
31
}
Copied!

klay_getTransactionByHash

Returns the information about a transaction requested by transaction hash. This API works only on RPC call, not on Javascript console.
Parameters
Type
Description
32-byte DATA
Hash of a transaction.
Return Value
Object - A transaction object, or null when no transaction was found:
Name
Type
Description
blockHash
32-byte DATA
Hash of the block where this transaction was in. null when it is pending.
blockNumber
QUANTITY
Block number where this transaction was in. null when it is pending.
codeFormat
String
(optional) The code format of smart contract code.
feePayer
20-byte DATA
(optional) Address of the fee payer.
feePayerSignatures
Array
(optional) An array of fee payer's signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
feeRatio
QUANTITY
(optional) Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender.
from
20-byte DATA
Address of the sender.
gas
QUANTITY
Gas provided by the sender.
gasPrice
QUANTITY
Gas price provided by the sender in peb.
hash
32-byte DATA
Hash of the transaction.
humanReadable
Boolean
(optional) true if the address is humanReadable, false if the address is not humanReadable.
key
String
(optional) Key of the newly created account.
input
DATA
(optional) The data sent along with the transaction.
nonce
QUANTITY
The number of transactions made by the sender prior to this one.
senderTxHash
32-byte DATA
Hash of a transaction that is signed only by the sender. See SenderTxHash. This value is always the same as hash for non fee-delegated transactions.
signatures
Array
An array of signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
to
20-byte DATA
Address of the receiver. null when it is a contract creation transaction.
transactionIndex
QUANTITY
Integer of the transaction index position in the block. null when it is pending.
type
String
A string representing the type of the transaction.
typeInt
QUANTITY
An integer representing the type of the transaction.
value
QUANTITY
Value transferred in peb.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getTransactionByHash","params":["0xaca5d9a1ed8b86b1ef61431b2bedfc99a66eaefc3a7e1cffdf9ff53653956a67"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x4d97cf1f686a925ed4f1ad42c635cedb54974fe23a2941c7825e1ed3163c0e41",
10
"blockNumber":"0x7008",
11
"feePayer":"0xa9d2cc2bb853163b6eadfb6f962d72f7e00bc2e6",
12
"feePayerSignatures":[
13
{
14
"V":"0x4e44",
15
"R":"0xa665e17d92e1c671c8b062cecb19790d49138a21854fc15c460c91035b1884e",
16
"S":"0x17165688acc01736f1221a39399e3aac7e1ece14731fcab31631e3e4a59b7441"
17
}
18
],
19
"from":"0xab0833d744a8943fe3c783f9cc70c13cbd70fcf4",
20
"gas":"0xdbba0",
21
"gasPrice":"0x5d21dba00",
22
"hash":"0xaca5d9a1ed8b86b1ef61431b2bedfc99a66eaefc3a7e1cffdf9ff53653956a67",
23
"nonce":"0x26",
24
"senderTxHash":"0x18fe9e1007da7d20aad77778557fb8acc58c80054daba65124c8c843aadd3478",
25
"signatures":[
26
{
27
"V":"0x4e44",
28
"R":"0x1b6bb3d996d903d0528565d13e8d9d122b2220ed09c5baf384114193a6977027",
29
"S":"0x20c506ce9f1bdd42183c40c44f414a3930f339f856e8be3cfcdf5ca0852fd378"
30
}
31
],
32
"to":"0x15a9119104e1bf0ec6d408b3cc188685e4402a2c",
33
"transactionIndex":"0x0",
34
"type":"TxTypeFeeDelegatedValueTransfer",
35
"typeInt":9,
36
"value":"0x1"
37
}
38
}
Copied!

klay_getTransactionBySenderTxHash

Returns the information about a transaction requested by sender transaction hash. This API works only on RPC call, not on Javascript console. Please note that this API returns correct result only if indexing feature is enabled by --sendertxhashindexing. This can be checked by call klay_isSenderTxHashIndexingEnabled.
Parameters
Type
Description
32-byte DATA
Hash of a transaction that is signed only by the sender. See SenderTxHash.
Return Value
Object - A transaction object, or null when no transaction was found:
Name
Type
Description
blockHash
32-byte DATA
Hash of the block where this transaction was in. null when it is pending.
blockNumber
QUANTITY
Block number where this transaction was in. null when it is pending.
codeFormat
String
(optional) The code format of smart contract code.
feePayer
20-byte DATA
Address of the fee payer.
feePayerSignatures
Array
An array of fee payer's signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
feeRatio
QUANTITY
(optional) Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender.
from
20-byte DATA
Address of the sender.
gas
QUANTITY
Gas provided by the sender.
gasPrice
QUANTITY
Gas price provided by the sender in peb.
hash
32-byte DATA
Hash of the transaction.
humanReadable
Boolean
(optional) true if the address is humanReadable, false if the address is not humanReadable.
key
String
(optional) Key of the newly created account.
input
DATA
(optional) The data sent along with the transaction.
nonce
QUANTITY
The number of transactions made by the sender prior to this one.
senderTxHash
32-byte DATA
Hash of a transaction that is signed only by the sender. See SenderTxHash. This value is always the same as hash for non fee-delegated transactions.
signatures
Array
An array of signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
to
20-byte DATA
Address of the receiver. null when it is a contract creation transaction.
transactionIndex
QUANTITY
Integer of the transaction index position in the block. null when it is pending.
type
String
A string representing the type of the transaction.
typeInt
QUANTITY
An integer representing the type of the transaction.
value
QUANTITY
Value transferred in peb.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getTransactionBySenderTxHash","params":["0x18fe9e1007da7d20aad77778557fb8acc58c80054daba65124c8c843aadd3478"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x4d97cf1f686a925ed4f1ad42c635cedb54974fe23a2941c7825e1ed3163c0e41",
10
"blockNumber":"0x7008",
11
"feePayer":"0xa9d2cc2bb853163b6eadfb6f962d72f7e00bc2e6",
12
"feePayerSignatures":[
13
{
14
"V":"0x4e44",
15
"R":"0xa665e17d92e1c671c8b062cecb19790d49138a21854fc15c460c91035b1884e",
16
"S":"0x17165688acc01736f1221a39399e3aac7e1ece14731fcab31631e3e4a59b7441"
17
}
18
],
19
"from":"0xab0833d744a8943fe3c783f9cc70c13cbd70fcf4",
20
"gas":"0xdbba0",
21
"gasPrice":"0x5d21dba00",
22
"hash":"0xaca5d9a1ed8b86b1ef61431b2bedfc99a66eaefc3a7e1cffdf9ff53653956a67",
23
"nonce":"0x26",
24
"senderTxHash":"0x18fe9e1007da7d20aad77778557fb8acc58c80054daba65124c8c843aadd3478",
25
"signatures":[
26
{
27
"V":"0x4e44",
28
"R":"0x1b6bb3d996d903d0528565d13e8d9d122b2220ed09c5baf384114193a6977027",
29
"S":"0x20c506ce9f1bdd42183c40c44f414a3930f339f856e8be3cfcdf5ca0852fd378"
30
}
31
],
32
"to":"0x15a9119104e1bf0ec6d408b3cc188685e4402a2c",
33
"transactionIndex":"0x0",
34
"type":"TxTypeFeeDelegatedValueTransfer",
35
"typeInt":9,
36
"value":"0x1"
37
}
38
}
Copied!

klay_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.
NOTE: The receipt is not available for pending transactions.
Parameters
Name
Type
Description
Hash
32-byte DATA
Hash of a transaction.
Return Value
Object - A transaction receipt object, or null when no receipt was found
Name
Type
Description
blockHash
32-byte DATA
Hash of the block where this transaction was in.
blockNumber
QUANTITY
The block number where this transaction was in.
codeFormat
String
(optional) The code format of smart contract code.
contractAddress
DATA
The contract address created, if the transaction was a contract creation, otherwise null.
feePayer
20-byte DATA
(optional) Address of the fee payer.
feePayerSignatures
Array
(optional) An array of fee payer's signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
feeRatio
QUANTITY
(optional) Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender.
from
20-byte DATA
Address of the sender.
gas
QUANTITY
Gas provided by the sender.
gasPrice
QUANTITY
Gas price provided by the sender in peb.
gasUsed
QUANTITY
The amount of gas used by this specific transaction alone.
humanReadable
Boolean
(optional) true if the address is humanReadable, false if the address is not humanReadable.
key
String
(optional) Key of the newly created account.
input
DATA
(optional) The data sent along with the transaction.
logs
Array
Array of log objects, which this transaction generated.
logsBloom
256-byte DATA
Bloom filter for light clients to quickly retrieve related logs.
nonce
QUANTITY
The number of transactions made by the sender prior to this one.
senderTxHash
(optional) 32-byte DATA
Hash of the tx without the fee payer's address and signature. This value is always the same as the value of transactionHash for non fee-delegated transactions.
signature
Array
An array of signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
status
QUANTITY
Either 1 (success) or 0 (failure).
txError
QUANTITY
(optional) detailed error code if status is equal to zero.
to
20-byte DATA
Address of the receiver. null when it is a contract creation transaction.
transactionHash
32-byte DATA
Hash of the transaction.
transactionIndex
QUANTITY
Integer of the transaction index position in the block.
type
String
A string representing the type of the transaction.
typeInt
QUANTITY
An integer representing the type of the transaction.
value
QUANTITY
Value transferred in peb.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getTransactionReceipt","params":["0xaca5d9a1ed8b86b1ef61431b2bedfc99a66eaefc3a7e1cffdf9ff53653956a67"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x4d97cf1f686a925ed4f1ad42c635cedb54974fe23a2941c7825e1ed3163c0e41",
10
"blockNumber":"0x7008",
11
"contractAddress":null,
12
"feePayer":"0xa9d2cc2bb853163b6eadfb6f962d72f7e00bc2e6",
13
"feePayerSignatures":[
14
{
15
"V":"0x4e44",
16
"R":"0xa665e17d92e1c671c8b062cecb19790d49138a21854fc15c460c91035b1884e",
17
"S":"0x17165688acc01736f1221a39399e3aac7e1ece14731fcab31631e3e4a59b7441"
18
}
19
],
20
"from":"0xab0833d744a8943fe3c783f9cc70c13cbd70fcf4",
21
"gas":"0xdbba0",
22
"gasPrice":"0x5d21dba00",
23
"gasUsed":"0x7918",
24
"logs":[],
25
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
26
"nonce":"0x26",
27
"senderTxHash":"0x18fe9e1007da7d20aad77778557fb8acc58c80054daba65124c8c843aadd3478",
28
"signatures":[
29
{
30
"V":"0x4e44",
31
"R":"0x1b6bb3d996d903d0528565d13e8d9d122b2220ed09c5baf384114193a6977027",
32
"S":"0x20c506ce9f1bdd42183c40c44f414a3930f339f856e8be3cfcdf5ca0852fd378"
33
}
34
],
35
"status":"0x1",
36
"to":"0x15a9119104e1bf0ec6d408b3cc188685e4402a2c",
37
"transactionHash":"0xaca5d9a1ed8b86b1ef61431b2bedfc99a66eaefc3a7e1cffdf9ff53653956a67",
38
"transactionIndex":"0x0",
39
"type":"TxTypeFeeDelegatedValueTransfer",
40
"typeInt":9,
41
"value":"0x1"
42
}
43
}
Copied!

klay_getTransactionReceiptBySenderTxHash

Returns the receipt of a transaction by sender transaction hash.
NOTE: The receipt is not available for pending transactions. Please note that this API returns correct result only if indexing feature is enabled by --sendertxhashindexing. This can be checked by call klay_isSenderTxHashIndexingEnabled.
Parameters
Name
Type
Description
Hash
32-byte DATA
Hash of a transaction before signing of feePayer(senderTransactionHash).
Return Value
Object - A transaction receipt object, or null when no receipt was found
Name
Type
Description
blockHash
32-byte DATA
Hash of the block where this transaction was in.
blockNumber
QUANTITY
The block number where this transaction was in.
codeFormat
String
(optional) The code format of smart contract code.
contractAddress
DATA
The contract address created, if the transaction was a contract creation, otherwise null.
feePayer
20-byte DATA
Address of the fee payer.
feePayerSignatures
Array
An array of fee payer's signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
feeRatio
QUANTITY
(optional) Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender.
from
20-byte DATA
Address of the sender.
gas
QUANTITY
Gas provided by the sender.
gasPrice
QUANTITY
Gas price provided by the sender in peb.
gasUsed
QUANTITY
The amount of gas used by this specific transaction alone.
humanReadable
Boolean
(optional) true if the address is humanReadable, false if the address is not humanReadable.
key
String
(optional) Key of the newly created account.
input
DATA
(optional) The data sent along with the transaction.
logs
Array
Array of log objects, which this transaction generated.
logsBloom
256-byte DATA
Bloom filter for light clients to quickly retrieve related logs.
nonce
QUANTITY
The number of transactions made by the sender prior to this one.
senderTxHash
(optional) 32-byte DATA
Hash of the tx without the fee payer's address and signature. This value is always the same as the value of transactionHash for non fee-delegated transactions.
signature
Array
An array of signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
status
QUANTITY
Either 1 (success) or 0 (failure).
txError
QUANTITY
(optional) detailed error code if status is equal to zero.
to
20-byte DATA
Address of the receiver. null when it is a contract creation transaction.
transactionHash
32-byte DATA
Hash of the transaction.
transactionIndex
QUANTITY
Integer of the transaction index position in the block.
type
String
A string representing the type of the transaction.
typeInt
QUANTITY
An integer representing the type of the transaction.
value
QUANTITY
Value transferred in peb.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getTransactionReceiptBySenderTxHash","params":["0x18fe9e1007da7d20aad77778557fb8acc58c80054daba65124c8c843aadd3478"],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x4d97cf1f686a925ed4f1ad42c635cedb54974fe23a2941c7825e1ed3163c0e41",
10
"blockNumber":"0x7008",
11
"contractAddress":null,
12
"feePayer":"0xa9d2cc2bb853163b6eadfb6f962d72f7e00bc2e6",
13
"feePayerSignatures":[
14
{
15
"V":"0x4e44",
16
"R":"0xa665e17d92e1c671c8b062cecb19790d49138a21854fc15c460c91035b1884e",
17
"S":"0x17165688acc01736f1221a39399e3aac7e1ece14731fcab31631e3e4a59b7441"
18
}
19
],
20
"from":"0xab0833d744a8943fe3c783f9cc70c13cbd70fcf4",
21
"gas":"0xdbba0",
22
"gasPrice":"0x5d21dba00",
23
"gasUsed":"0x7918",
24
"logs":[],
25
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
26
"nonce":"0x26",
27
"senderTxHash":"0x18fe9e1007da7d20aad77778557fb8acc58c80054daba65124c8c843aadd3478",
28
"signatures":[
29
{
30
"V":"0x4e44",
31
"R":"0x1b6bb3d996d903d0528565d13e8d9d122b2220ed09c5baf384114193a6977027",
32
"S":"0x20c506ce9f1bdd42183c40c44f414a3930f339f856e8be3cfcdf5ca0852fd378"
33
}
34
],
35
"status":"0x1",
36
"to":"0x15a9119104e1bf0ec6d408b3cc188685e4402a2c",
37
"transactionHash":"0xaca5d9a1ed8b86b1ef61431b2bedfc99a66eaefc3a7e1cffdf9ff53653956a67",
38
"transactionIndex":"0x0",
39
"type":"TxTypeFeeDelegatedValueTransfer",
40
"typeInt":9,
41
"value":"0x1"
42
}
43
}
Copied!

klay_sendRawTransaction

Creates a new message call transaction or a contract creation for signed transactions.
Parameters
Type
Description
DATA
The signed transaction data.
Return Value
Type
Description
32-byte DATA
The transaction hash or the zero hash if the transaction is not yet available.
If you deployed a contract, use klay_getTransactionReceipt to get the contract address.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_sendRawTransaction","params":[{see above}],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc": "2.0",
7
"id":1,
8
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
9
}
Copied!

klay_sendTransaction

Constructs a transaction with given parameters, signs the transaction with a sender's private key and propagates the transaction to Klaytn network.
NOTE: The address to sign with must be unlocked.
Parameters
The required parameters depend on the transaction type. Check the proper parameters in Working with Klaytn Transaction Types.
Return Value
Type
Description
32-byte DATA
The transaction hash
If you deployed a contract, use klay_getTransactionReceipt to get the contract address.
Example
1
params: [{
2
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
3
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
4
"gas": "0x76c0",
5
"gasPrice": "0x5d21dba00",
6
"value": "0x9184e72a",
7
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
8
}]
Copied!
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_sendTransaction","params":[{see above}],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc": "2.0","id":1,
7
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
8
}
Copied!

klay_sendTransactionAsFeePayer

Constructs a transaction with given parameters, signs the transaction with a fee payer's private key and propagates the transaction to Klaytn network. This API supports only fee delegated type (including partial fee delegated type) transactions.
NOTE: The fee payer address to sign with must be unlocked.
Parameters
The required parameters depend on the transaction type. Check the proper parameters in Working with Klaytn Transaction Types.
Return Value
Type
Description
32-byte DATA
The transaction hash
If you deployed a contract, use klay_getTransactionReceipt to get the contract address.
Example
1
params: [{
2
"typeInt": 18,
3
"from": "0xcd01b2b44584fb143824c1ea0231bebaea826b9d",
4
"to": "0x44711E89b0c23845b5B2ed9D3716BA42b8a3e075",
5
"gas": "0x4a380",
6
"gasPrice": "0x5d21dba00",
7
"nonce": "0x2c",
8
"value": "0xf4",
9
"input": "0xb3f98adc0000000000000000000000000000000000000000000000000000000000000001",
10
"feePayer": "0xcd01b2b44584fb143824c1ea0231bebaea826b9d",
11
"feeRatio": 30,
12
"signatures": [{
13
"V": "0x4e43",
14
"R": "0xd3ff5ca7bdd0120d79e8aa875593d05022fe74ce2b7a0594218d53c0fdca7fa9",
15
"S": "0x2c100e69d2455afc9393e017514063da18b18db6f7e811d0aeaf6002515b58ef"
16
}]
17
}]
Copied!
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_sendTransactionAsFeePayer","params":[{see above}],"id":1}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc": "2.0","id":1,
7
"result": "0x77ec2d910d0b96585373e2d6508f2b2d8c2af7d0060d2012e1cb2f0ee9d74830"
8
}
Copied!

klay_signTransaction

Constructs a transaction with given parameters and signs the transaction with a sender's private key. This method can be used either to generate a sender signature or to make a final raw transaction that is ready to submit to Klaytn network.
NOTE: The address to sign with must be unlocked.
Parameters
The required parameters depend on the transaction type. Check the proper parameters in Working with Klaytn Transaction Types.
Return Value
Type
Description
raw
Signed raw transaction
tx
Transaction object including the sender's signature
Example
1
// Request
2
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"klay_signTransaction", "params":[{"from":"0x77982323172e5b6182539d3522d5a33a944206d4", "to":"0xcd6bfdb523a4d030890d28bf1eb6ef36307c9aaa", "value":"0x10000", "gas":"0x1000000", "nonce":"0x2", "gasprice":"0x25000000000"}],"id":73}' http://localhost:8551
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":73,
8
"result":{
9
"raw":"0xf86c0286025000000000840100000094cd6bfdb523a4d030890d28bf1eb6ef36307c9aaa8301000080820fe8a056d2ddd231c3c111687ab351d339240db18cd721e5aa33c601dd4fc3927fb4d1a03443443392517aa7da082aa0a00b9ee5e3e1ee007d22e57cd9ff55b5ddbf4a64",
10
"tx":{
11
"nonce":"0x2",
12
"gasPrice":"0x5d21dba00",
13
"gas":"0x1000000",
14
"to":"0xcd6bfdb523a4d030890d28bf1eb6ef36307c9aaa",
15
"value":"0x10000",
16
"input":"0x",
17
"v":"0xfe8",
18
"r":"0x56d2ddd231c3c111687ab351d339240db18cd721e5aa33c601dd4fc3927fb4d1",
19
"s":"0x3443443392517aa7da082aa0a00b9ee5e3e1ee007d22e57cd9ff55b5ddbf4a64",
20
"hash":"0xb53cc9128a19c3916c0de1914725b7337bba84666c2556d8682c72ca34c6874c"
21
}
22
}
23
}
Copied!

klay_signTransactionAsFeePayer

Constructs a transaction with given parameters and signs the transaction with a fee payer's private key. This method can be used either to generate a fee payer signature or to make a final raw transaction that is ready to submit to Klaytn network. In case you just want to extract the fee-payer signature, simply take the feePayerSignatures from the result. Note that the raw transaction is not final if the sender's signature is not attached (that is, signatures in tx is empty).
NOTE: The fee payer address to sign with must be unlocked.
Parameters
The required parameters depend on the transaction type. Check the proper parameters in Working with Klaytn Transaction Types.
Return Value
Type
Description
raw
Signed raw transaction
tx
Transaction object including the fee payer's signature
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "klay_signTransactionAsFeePayer", "params": [{"typeInt": 17, "from": "0xcd01b2b44584fb143824c1ea0231bebaea826b9d", "to": "0x44711E89b0c23845b5B2ed9D3716BA42b8a3e075", "gas": "0x76c0", "gasPrice": "0x5d21dba00", "value": "0xf4", "input": "0xb3f98adc0000000000000000000000000000000000000000000000000000000000000001", "feePayer": "0xcd01b2b44584fb143824c1ea0231bebaea826b9d"}], "id": 83}' http://127.0.0.1:8551
3
4
// Result
5
{
6
"id": 83,
7
"jsonrpc": "2.0",
8
"result": {
9
"raw": "0x11f8ba358505d21dba008276c09444711e89b0c23845b5b2ed9d3716ba42b8a3e07581f494cd01b2b44584fb143824c1ea0231bebaea826b9da4b3f98adc0000000000000000000000000000000000000000000000000000000000000001c094cd01b2b44584fb143824c1ea0231bebaea826b9df847f845824e43a0b34470d1bb588a6afe8f170333ca147e805727aa1911353ed544c31ad4863beca020322c2727091ff79458a87a424b53a4b08cc3d7d485e002e8bf0add13974507",
10
"tx": {
11
"feePayer": "0xcd01b2b44584fb143824c1ea0231bebaea826b9d",
12
"feePayerSignatures": [
13
{
14
"R": "0xb34470d1bb588a6afe8f170333ca147e805727aa1911353ed544c31ad4863bec",
15
"S": "0x20322c2727091ff79458a87a424b53a4b08cc3d7d485e002e8bf0add13974507",
16
"V": "0x4e43"
17
}
18
],
19
"from": "0xcd01b2b44584fb143824c1ea0231bebaea826b9d",
20
"gas": "0x76c0",
21
"gasPrice": "0x5d21dba00",
22
"hash": "0x9e76f754b884d7853814a39c0e51fcefcef6f55b872f00ddad9724c9638128b3",
23
"input": "0xb3f98adc0000000000000000000000000000000000000000000000000000000000000001",
24
"nonce": "0x35",
25
"signatures": [],
26
"to": "0x44711e89b0c23845b5b2ed9d3716ba42b8a3e075",
27
"type": "TxTypeFeeDelegatedValueTransferMemo",
28
"typeInt": 17,
29
"value": "0xf4"
30
}
31
}
32
}
Copied!

txError: Detailed Information of Transaction Failures

Klaytn provides a field txError in the transaction receipt to give developers more information about the reason for the failed transaction execution. This field exists only if the transaction execution is failed. To save storage and network bandwidth, txError contains an integer value. The below table shows the meaning of the value in txError.
Error Code
Description
0x02
VM error occurs while running smart contract
0x03
max call depth exceeded
0x04
contract address collision
0x05
contract creation code storage out of gas
0x06
evm: max code size exceeded
0x07
out of gas
0x08
evm: write protection
0x09
evm: execution reverted
0x0a
reached the opcode computation cost limit (100000000) for tx
0x0b
account already exists
0x0c
not a program account (e.g., an account having code and storage)
0x0d
Human-readable address is not supported now
0x0e
fee ratio is out of range [1, 99]
0x0f
AccountKeyFail is not updatable
0x10
different account key type
0x11
AccountKeyNil cannot be initialized to an account
0x12
public key is not on curve
0x13
key weight is zero
0x14
key is not serializable
0x15
duplicated key
0x16
weighted sum overflow
0x17
unsatisfiable threshold. Weighted sum of keys is less than the threshold.