Transaction
Last updated
Last updated
메시지 호출 트랜잭션을 실행합니다. 이 트랜잭션은 노드의 Klaytn 가상머신에서 직접 실행되지만 블록체인에 기록되지 않습니다.
Parameters
Name | Type | Description |
---|---|---|
Return Value
프로미스
는 String
을 반환합니다: 스마트 컨트랙트 함수 리턴값과 같이 호출의 결과로 리턴된 값입니다.
Example
메세지 호출 혹은 트랜잭션을 실행하고 모의 호출/트랜잭션에 사용된 가스를 반환합니다.
Parameters
Return Value
Promise
returns Number
- the used gas for the simulated call/transaction.
Example
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.
Parameters
Return Value
프로미스
는 Number
를 반환합니다 - 사용된 연산 비용(Computation Cost)의 양입니다.
Example
RLP-encoded 트랜잭션인 주어진 rawTransaction
의 모든 값을 디코딩한 트랜잭션 객체를 반환합니다. 레거시 트랜잭션을 제외한 모든 트랜잭션 타입이 트랜잭션 발신자와 트랜잭션 수수료 납부자의 다중 서명을 가질 수 있으므로, 기존에 리턴된 v, r, s 필드들과 payerV, payerR, payerS는 발신자외 트랜잭션 수수료 납부자의 0번째 서명입니다.
참고 caver.klay.decodeTransaction는 v1.0.1-rc.8에서 지원됩니다. 이 기능을 사용하려면 v1.0.1-rc.8 또는 그 이상을 설치하세요.
참고 다중 서명을 지원하기 위해 signatures
및 feePayerSignatures
속성이 caver-js v1.2.0-rc.3 부터 추가되었습니다.
Parameters
Return Value
Example
주어진 트랜잭션 해시에 대응하는 트랜잭션을 반환합니다.
Parameters
Return Value
프로미스
는 객체
를 반환합니다 - 트랜잭션 객체를 반환하거나 또는 해당하는 트랜잭션을 찾을 수 없는 경우 null
을 반환합니다.
Example
주어진 senderTxHash
에 대응하는 트랜잭션의 정보를 반환합니다. 이 API는 --sendertxhashindexing
에 의해 인덱싱 기능이 노드에서 활성화되어 있을 때만 올바른 결과를 반환합니다. isSenderTxHashIndexingEnabled을 사용해 인덱싱 기능이 활성화되었는지 아닌지를 확인합니다.
Parameters
Return Value
Promise
returns Object
- A transaction object, or null
when no transaction was found:
Example
블록 해시 또는 블록 넘버, 그리고 트랜잭션 인덱스 위치를 통해 트랜잭션을 반환합니다.
Parameters
Return Value
객체
- 트랜잭션 객체를 반환하며 자세한 내용은 caver.klay.getTransaction를 참고하십시오.
Examples
Returns the receipt of a transaction by transaction hash.
Parameters
Return Value
프로미스
는 Object
를 반환합니다 - 트랜잭션 영수증 객체를 반환하거나 영수증을 찾을 수 없는 경우 null
을 반환합니다.
Example
주어진 senderTxHash
에 대응하는 트랜잭션의 영수증를 반환합니다.
NOTE: The receipt is not available for pending transactions. Please note that this API returns correct result only if the indexing feature is enabled in the node by --sendertxhashindexing
. isSenderTxHashIndexingEnabled를 호출하여 인덱싱 기능이 활성화되어 있는지 확인할 수 있습니다.
Parameters
Return Value
Promise
returns Object
- A transaction receipt object, or null
when no receipt was found:
Example
caver.klay.accounts.signTransaction
으로 생성된 이미 서명받은 트랜잭션을 보냅니다.
참고 caver.klay.sendSignedTransaction
는 caver-js v1.2.0부터 객체를 파라미터로 받을 수 있습니다. 객체는 반드시 RLP 인코딩된 트랜잭션 문자열을 포함하거나 반드시 서명(트랜잭션 발신자 서명 혹은 트랜잭션 수수료 납부자 서명)을 받았으며 인코딩되지 않은 트랜잭션 객체이어야 합니다. caver.klay.accounts.signTransaction, caver.klay.accounts.feePayerSignTransaction, caver.klay.accounts.getRawTransactionWithSignatures 또는 caver.klay.accounts.combineSignatures의 리턴값으로 받는 객체를 전달해도 됩니다.
Parameters
Return Value
For PromiEvent, the following events are available:
"transactionHash"
returns String
: Is fired right after the transaction is sent and a transaction hash is available.
"receipt"
returns Object
: Is fired when the transaction receipt is available.
"error"
returns Error
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
트랜잭션에 서명합니다. 이 계정은 잠금 해제되어 있어야 합니다.
Parameters
Return Value
Promise
는 Object
를 반환: RLP 인코딩된 트랜잭션입니다. raw
속성은 caver.klay.sendSignedTransaction으로 트랜잭션을 보내는 데 사용될 수 있습니다.
Example
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
callObject
Object
호출 시 from 속성도 선택 사항인 트랜잭션 객체입니다. 인코딩된 함수 호출이 반드시 트랜잭션 객체의 데이터 필드에 주어져야 합니다.
defaultBlock
Number | String
(optional) If you pass this parameter, it will not use the default block set with caver.klay.defaultBlock.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
callObject
Object
A transaction object with the difference that for calls the from property is optional as well. An encoded function call must be set in the data field of the transaction object.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
callObject
Object
A transaction object with the difference that for calls the from property is optional as well. An encoded function call must be set in the data field of the transaction object.
defaultBlock
Number | String
(optional) If you don't pass this parameter, the default block set by caver.klay.defaultBlock will be used.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
rawTransaction
String
RLP 인코딩된 트랜잭션 데이터.
Object
A transaction object. 반환되는 트랜잭션 객체가 가지는 속성은 트랜잭션 타입에 따라 다릅니다. 각 트랜잭션 타입의 속성은 SendTransaction을 참조하세요.
transactionHash
String
트랜잭션 해시.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
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
(optional) Hash of the tx without the fee payer's address and signature. 이 값은 수수료를 위임하지 않은 트랜잭션의 hash
값과 항상 동일합니다.
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.
senderTxHash
String
Hash of a transaction that is signed only by the sender. 이에 대한 자세한 내용은 SenderTxHash를 참고하세요.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
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.
hashStringOrNumber
String
블록 번호 또는 해시. Or the string "genesis"
or "latest"
.
indexNumber
Number
트랜잭션의 인덱스 위치의 정숫값입니다.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
transactionHash
String
The transaction hash
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
blockHash
32-byte String
Hash of the block where this transaction was in.
blockNumber
Number
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
32-byte DATA
(선택사항) 발신자만 서명한 트랜잭션 해시. See SenderTxHash. 이 값은 수수료를 위임하지 않은 트랜잭션의 transactionHash
값과 항상 동일합니다.
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.
status
Boolean
트랜잭션이 성공적으로 실행되면 true
를 반환하며, 만약 Klaytn 가상머신이 트랜잭션을 거부하면 false
를 반환합니다.
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.
senderTxHash
String
Hash of a transaction that is signed only by the sender. See SenderTxHash.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
blockHash
32-byte String
Hash of the block where this transaction was in.
blockNumber
Number
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
32-byte DATA
Hash of a transaction that is signed only by the sender. See SenderTxHash. This value is always the same as transactionHash
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.
status
Boolean
true
if the transaction was successful, false
if the Klaytn Virtual Machine reverted the transaction.
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.
signedTransactionData
String | Object
RLP 인코딩된 서명받은 트랜잭션 문자열, 또는 RLP 인코딩된 서명받은 트랜잭션 문자열을 rawTransaction
속성값안에 가진 객체, 또는 서명(트랜잭션 발신자 서명 혹은 트랜잭션 수수료 납부자 서명)이 첨부된 인코딩되지 않은 트랜잭션 객체이어야 합니다.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
PromiEvent
A promise combined event emitter. Will be resolved when the transaction receipt is available.
transactionObject
Object
서명하려는 트랜잭션 데이터.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.