Transaction
eth_call
Executes a new message call immediately, without creating a transaction on the block chain. The eth_call method can be used to query internal contract state, to execute validations coded into a contract or even to test what the effect of a transaction would be without running it live.
Parameters
Name | Type | Description |
---|---|---|
callObject | Object | 트랜잭션 호출 객체입니다. 객체 속성은 다음의 표를 참고해주세요. |
blockNumberOrTag | QUANTITY | TAG | Integer or hexadecimal block number, or the string |
stateOverrideSet | Object | The state override set is an optional address-to-state mapping, where each entry specifies some state to be ephemerally overridden prior to executing the call. |
callObject
에는 다음의 속성이 있습니다.
Name | Type | Description |
---|---|---|
from | 20-byte DATA | (optional) Address the transaction is simulated to have been sent from. The |
to | 20-byte DATA | (optional) Address the transaction is sent to. |
gas | QUANTITY | (optional) Maximum gas allowance for the code execution to avoid infinite loops. Defaults to 2^63 or whatever value the node operator specified via --rpc.gascap. |
gasPrice | QUANTITY | (optional) Number of |
value | QUANTITY | (optional) Amount of |
input | DATA | (optional) Hash of the method signature and encoded parameter. It replaces |
Example - callObject
stateOverrideSet
has the following properties:
Name | Type | Description |
---|---|---|
balance | 수량 | (optional) Fake balance to set for the account before executing the call. |
nonce | Quantity | (optional) Fake nonce to set for the account before executing the call. |
code | DATA | (optional) Fake EVM bytecode to inject into the account before executing the call. |
상태(State) | Object | (optional) Fake key-value mapping to override all slots in the account storage before executing the call. |
stateDiff | Object | (optional) Fake key-value mapping to override individual slots in the account storage before executing the call. |
The goal of the state override set is manyfold:
It can be used by DApps to reduce the amount of contract code needed to be deployed on chain. Code that simply returns internal state or does pre-defined validations can be kept off chain and fed to the node on-demand.
It can be used for smart contract analysis by extending the code deployed on chain with custom methods and invoking them. This avoids having to download and reconstruct the entire state in a sandbox to run custom code against.
It can be used to debug smart contracts in an already deployed large suite of contracts by selectively overriding some code or state and seeing how execution changes. Specialized tooling will probably be necessary.
Example - stateOverrideSet
Example
To test call in meaningful way, you need to setup test environment like below.
Deploy KIP-7 Contract to test call or you can use it with already deployed one.
We will use KIP-7 contract function
totalSupply
to check whether call is working or not in this example.To call
totalSupply
you should know about its function signature which is0x18160ddd
.
In this example:
The address of KIP-7 contract:
0xbE3892d33620bE5aca8c75D39e7401871194d290
(You should use an existing contract address.)The address of caller:
0xca7a99380131e6c76cfa622396347107aeedca2d
Example - StateOverrides
Following the example above, let's test call using state overrides feature.
We will replace the bytecode of
0xbE3892d33620bE5aca8c75D39e7401871194d290
which is the address of KIP-7 contract already deployed above (Check the above example).The bytecode to be replaced is
6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e64cec114604e5780636057361d146076575b600080fd5b348015605957600080fd5b50606060a0565b6040518082815260200191505060405180910390f35b348015608157600080fd5b50609e6004803603810190808035906020019092919050505060a9565b005b60008054905090565b80600081905550505600a165627a7a723058207783dba41884f73679e167576362b7277f88458815141651f48ca38c25b498f80029
.The original source code of this bytecode is below.
Now let's override the state of 0xbE3892d33620bE5aca8c75D39e7401871194d290
(KIP-7 contract) with another contract's byte code (Storage contract) and call retrieve
(function signature: 0x2e64cec1
) of Storage contract.
eth_estimateGas
트랜잭션 실행을 완료하는 데에 필요한 가스양의 추정치를 생성하여 반환합니다. 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 EVM 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) Address the transaction is simulated to have been sent from. The |
to | 20-byte DATA | (optional) Address the transaction is sent to. |
gas | QUANTITY | (optional) Maximum gas allowance for the code execution to avoid infinite loops. Defaults to 2^63 or whatever value the node operator specified via --rpc.gascap. |
gasPrice | QUANTITY | (optional) Number of |
value | QUANTITY | (optional) Amount of |
input | DATA | (optional) Hash of the method signature and encoded parameter. It replaces |
Example - callObject
Return Value
Type | Description |
---|---|
QUANTITY | 사용된 가스양입니다. |
Example
eth_getTransactionByBlockHashAndIndex
블록 해시와 트랜잭션 인덱스 위치로 조회한 트랜잭션의 정보를 반환합니다.
Please check the Caution-Transaction before using this API.
Parameters
Type | Description |
---|---|
32-byte DATA | Hash of a block. |
QUANTITY | 트랜잭션의 인덱스 위치의 정숫값입니다. |
Return Value
Example
To see examples of various transaction types, check eth_getTransactionByHash
eth_getTransactionByBlockNumberAndIndex
블록 번호와 트랜잭션 인덱스 위치로 조회한 트랜잭션의 정보를 반환합니다.
Please check the Caution-Transaction before using this API.
Parameters
Type | Description |
---|---|
QUANTITY | TAG | 정수 또는 16진수 형태의 블록 번호 또는 기본 블록 매개변수에서와 같이 |
QUANTITY | 트랜잭션의 인덱스 위치입니다. |
Return Value
Example
To see examples of various transaction types, check eth_getTransactionByHash
eth_getTransactionByHash
트랜잭션 해시로 조회한 트랜잭션의 정보를 반환합니다.
Please check the Caution-Transaction before using this API.
Parameters
Type | Description |
---|---|
32-byte DATA | 트랜잭션 해시입니다. |
Return Value
Fields of transaction can be different based on transaction types. Currently, there are three types of transactions in Ethereum(Legacy, AccessList , DynamicFee).
객체
- 트랜잭션 객체를 반환하거나 또는 해당하는 트랜잭션을 찾을 수 없는 경우 null
을 반환합니다.
Legacy Transaction
Name | Type | Description |
---|---|---|
blockHash | 32-byte DATA | 트랜잭션이 담긴 블록의 해시입니다. 보류 중인 상태이면 |
blockNumber | QUANTITY | 트랜잭션이 담긴 블록의 번호입니다. |
from | 20-byte DATA | 트랜잭션 발신자의 주소입니다. |
gas | QUANTITY | 트랜잭션 발신자에 의해 설정된 가스양입니다. |
gasPrice | QUANTITY | peb에서 트랜잭션 발신자에 의해 설정된 가스 가격입니다. |
hash | 32-byte DATA | 트랜잭션의 해시입니다. |
input | DATA | 트랜잭션과 함께 전송된 데이터입니다. |
nonce | QUANTITY | 트랜잭션 발신자가 이 트랜잭션 이전까지 전송했던 트랜잭션의 개수입니다. |
to | 20-byte DATA | 트랜잭션 수신자의 주소입니다. 컨트랙트 생성 트랜잭션이면 |
value | QUANTITY | Integer of values sent with this transaction. |
transactionIndex | QUANTITY | 블록 내 트랜잭션의 인덱스 위치의 정숫값입니다. |
type | QUANTITY | 트랜잭션의 유형을 나타내는 정수입니다. |
v | QUANTITY | ECDSA 리커버리 id. |
r | 32-byte DATA | ECDSA 서명 r. |
s | 32-byte DATA | ECDSA 서명 s. |
Example - Legacy Transaction
AccessList Transaction
Name | Type | Description |
---|---|---|
blockHash | 32-byte DATA | Hash of the block where this transaction was in. |
blockNumber | QUANTITY | Block number where this transaction was in. |
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. |
input | DATA | The data sent along with the transaction. |
nonce | QUANTITY | The number of transactions made by the sender prior to this one. |
to | 20-byte DATA | Address of the receiver. |
value | QUANTITY | Integer of values sent with this transaction. |
transactionIndex | QUANTITY | Integer of the transaction index position in the block. |
type | QUANTITY | An integer representing the type of the transaction. |
accessList | Array | An array of accessList. |
chainId | QUANTITY | Chain id set on the requested node. |
v | QUANTITY | ECDSA recovery id. |
r | 32-byte DATA | ECDSA signature r. |
s | 32-byte DATA | ECDSA signature s. |
Example - AccessList Transaction
DynamicFee Transaction
Name | Type | Description |
---|---|---|
blockHash | 32-byte DATA | Hash of the block where this transaction was in. |
blockNumber | QUANTITY | Block number where this transaction was in. |
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. |
maxFeePerGas | QUANTITY | A maximum amount to pay for the transaction to execute. |
maxPriorityFeePerGas | QUANTITY | Gas tip cap for dynamic fee transaction in peb. |
hash | 32-byte DATA | Hash of the transaction. |
input | DATA | The data sent along with the transaction. |
nonce | QUANTITY | The number of transactions made by the sender prior to this one. |
to | 20-byte DATA | Address of the receiver. |
value | QUANTITY | Integer of values sent with this transaction. |
transactionIndex | QUANTITY | Integer of the transaction index position in the block. |
type | QUANTITY | An integer representing the type of the transaction. |
accessList | Array | An array of accessList. |
chainId | QUANTITY | Chain id set on the requested node. |
v | QUANTITY | ECDSA recovery id. |
r | 32-byte DATA | ECDSA signature r. |
s | 32-byte DATA | ECDSA signature s. |
Example - DynamicFee Transaction
eth_getTransactionReceipt
트랜잭션 해시로 조회한 트랜잭션의 영수증을 반환합니다.
참고: 보류 상태의 트랜잭션은 영수증을 확인할 수 없습니다.
Please check the Caution-TransactionReceipt before using this API.
Parameters
Name | Type | Description |
---|---|---|
해시 | 32-byte DATA | Hash of a transaction. |
Return Value
객체
- 트랜잭션 영수증 객체를 반환하거나 또는 해당하는 트랜잭션 영수증을 찾을 수 없는 경우 null
을 반환합니다.
Name | Type | Description |
---|---|---|
blockHash | 32-byte DATA | Hash of the block where this transaction was in. |
blockNumber | QUANTITY | 트랜잭션이 담긴 블록의 번호입니다. |
contractAddress | DATA | 컨트랙트 생성 트랜잭션이면 생성된 컨트랙트의 주소를 반환합니다. 컨트랙트 생성 트랜잭션이 아닌 경우 |
cumulativeGasUsed | QUANTITY | The total amount of gas used when this transaction was executed in the block. |
effectiveGasPrice | QUANTITY | The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas). |
from | 20-byte DATA | Address of the sender. |
logs | Array | 이 트랜잭션이 발생시킨 로그 객체들의 배열입니다. |
logsBloom | 256-byte DATA | 라이트 클라이언트가 관련된 로그를 빠르게 검색할 수 있도록 하는 블룸필터입니다. |
status | QUANTITY |
|
to | 20-byte DATA | Address of the receiver. |
transactionHash | 32-byte DATA | Hash of the transaction. |
transactionIndex | QUANTITY | Integer of the transaction index position in the block. |
type | QUANTITY | An integer representing the type of the transaction. |
Example
eth_sendRawTransaction
새 메시지 호출 트랜잭션을 생성하거나 또는 서명된 트랜잭션을 입력으로 받으면 컨트랙트를 생성합니다.
Parameters
Type | Description |
---|---|
DATA | 서명된 트랜잭션 데이터입니다. |
Return Value
Type | Description |
---|---|
32-byte DATA | 트랜잭션 해시를 반환하거나 또는 해당 트랜잭션을 아직 사용할 수 없는 경우 0 해시를 반환합니다. |
If you deployed a contract, use eth_getTransactionReceipt to get the contract address.
Example
eth_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:
Name | Type | Description |
---|---|---|
transactionArgs | Object | An object of transaction arguments. See the table below for the object's properties. |
transactionArgs
has the following properties:
Name | Type | Description |
---|---|---|
from | 20-byte DATA | 트랜잭션 발신자의 주소입니다. |
to | 20-byte DATA | (not required when creating a new contract) The address to which the transaction is directed. |
gas | QUANTITY | (optional) The integer of the gas provided for the transaction's execution. 사용하지 않은 가스는 돌려받습니다. |
maxFeePerGas | QUANTITY | (optional) The maximum amount to pay for the transaction's execution. |
maxPriorityFeePerGas | QUANTITY | (optional) Gas tip cap for dynamic fee transaction in peb. |
input | DATA | (optional) The hash of the method signature and the encoded parameter. It replaces |
value | QUANTITY | (optional) The integer of values sent with this transaction. |
nonce | QUANTITY | (optional) The integer of a nonce. |
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 eth_getTransactionReceipt to get the contract address.
Example
eth_signTransaction
Signs a transaction that can be submitted to the network at a later time using with eth_sendRawTransaction.
NOTE: The address to sign with must be unlocked.
Parameters:
Name | Type | Description |
---|---|---|
transactionArgs | Object | An object of transaction arguments. See the table below for the object's properties. |
transactionArgs
has the following properties:
Name | Type | Description |
---|---|---|
from | 20-byte DATA | The address from which the transaction is sent. |
to | 20-byte DATA | (not required when creating a new contract) The address to which the transaction is directed. |
gas | QUANTITY | The integer of the gas provided for the transaction's execution. It will return unused gas. |
maxFeePerGas | QUANTITY | The maximum amount to pay for the transaction's execution. |
maxPriorityFeePerGas | QUANTITY | Gas tip cap for dynamic fee transaction in peb. |
input | DATA | (optional) The hash of the method signature and the encoded parameter. It replaces |
value | QUANTITY | (optional) The integer of values sent with this transaction. |
nonce | QUANTITY | The integer of a nonce. |
Return Value
Object
- The signed transaction object.
Name | Type | Description |
---|---|---|
raw | DATA | A |
tx | Object | 트랜잭션 객체. See the next table for the object's properties. |
tx
has the following properties:
Name | Type | Description |
---|---|---|
type | QUANTITY | An integer representing the type of the transaction. |
nonce | QUANTITY | The block number where this transaction was in. |
gasPrice | QUANTITY | Gas price provided by the sender in peb. |
maxFeePerGas | QUANTITY | A maximum amount to pay for the transaction to execute. |
maxPriorityFeePerGas | QUANTITY | Gas tip cap for dynamic fee transaction in peb. |
gas | QUANTITY | Gas provided by the sender. |
value | QUANTITY | Integer of values sent with this transaction. |
v | QUANTITY | ECDSA recovery id. |
r | 32-byte DATA | ECDSA signature r. |
s | 32-byte DATA | ECDSA signature s. |
chainId | QUANTITY | Chain id set on the requested node. |
accessList | Array | An array of accessList. |
hash | 32-byte DATA | Hash of the transaction. |
Example
eth_fillTransaction
Fills the defaults (nonce, gas, gasPrice or 1559 fields) on a given unsigned transaction, and returns it to the caller for further processing (signing + broadcast).
Parameters:
Parameters are same with eth_sendTransaction. See eth_sendtransaction.
Return value
See eth_signTransaction.
Example
eth_pendingTransactions
Returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
Parameters:
None
Return value
Name | Type | Description |
---|---|---|
pendingTransactions | Array | An array of transactions. For the returned transaction object, See eth_signTransaction |
Example
eth_resend
Resends a transaction.
It will remove the given transaction from the pool and reinsert it with the new gas price and limit.
NOTE: The address to sign with must be unlocked.
Parameters:
Name | Type | Description |
---|---|---|
transactionArgs | Object | An object of transaction arguments. See the table below for the object's properties. |
gas price | QUANTITY | Integer of the gasPrice to change |
gas | QUANTITY | (optional) Integer of the gas to change |
transactionArgs
has the following properties:
Name | Type | Description |
---|---|---|
from | 20-byte DATA | The address from which the transaction is sent. |
to | 20-byte DATA | The address to which the transaction is directed. |
gas | QUANTITY | (optional) The integer of the gas provided for the transaction's execution. It will return unused gas. |
maxFeePerGas | QUANTITY | (optional) The maximum amount to pay for the transaction's execution. |
maxPriorityFeePerGas | QUANTITY | (optional) Gas tip cap for dynamic fee transaction in peb. |
input | DATA | (optional) The hash of the method signature and the encoded parameter. It replaces |
value | QUANTITY | (optional) The integer of values sent with this transaction. |
nonce | QUANTITY | (optional) The integer of a nonce. |
Return Value
Type | Description |
---|---|
32-byte DATA | The transaction hash |
Example
Last updated