# eth

`eth` namespace는 계정, 블록, 트랜잭션, 네트워크 또는 노드의 환경설정, 필터 등과 관련한 함수를 제공합니다.

이제 Klaytn은 [이더리움의 JSON-RPC API](https://eth.wiki/json-rpc/API)의 네임스페이스 `eth`를 지원합니다. 이더리움의 API 응답 본문과 일치하도록 일부 반환 값이 조정되었음을 참고하시기 바랍니다.

또한 클레이튼과 이더리움의 근본적인 설계 차이로 인해 클레이튼의 데이터 구조(트랜잭션, 블록, 트랜잭션 영수증)는 `eth` 네임스페이스 API를 통해 완전하게 지원되지 않습니다.

본 문서에 있는 [이더리움과의 차이점 개요](#differences_overview_from_ethereum)를 확인하세요.

**참고**: `eth` 네임스페이스 API들은 Klaytn v1.8.0. 부터 지원됩니다.

아래 목록에 API 함수들이 나열되어 있습니다. 아래의 모든 `eth` 네임스페이스 API들은 Klaytn에서 지원됩니다.

### [계정(Account)](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/account) <a href="#account" id="account"></a>

* [eth\_accounts](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/account#eth_accounts)
* [eth\_getBalance](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/account#eth_getbalance)
* [eth\_getCode](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/account#eth_getcode)
* [eth\_getTransactionCount](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/account#eth_gettransactioncount)
* [eth\_sign](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/account#eth_sign)

### [블록(Block)](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/block) <a href="#block" id="block"></a>

* [eth\_blockNumber](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_blocknumber)
* [eth\_getHeaderByNumber](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getheaderbynumber)
* [eth\_getHeaderByHash](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getheaderbyhash)
* [eth\_getBlockByNumber](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getblockbynumber)
* [eth\_getBlockByHash](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getblockbyhash)
* [eth\_getUncleByBlockHashAndIndex](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getunclebyblockhashandindex)
* [eth\_getUncleByBlockNumberAndIndex](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getunclebyblocknumberandindex)
* [eth\_getBlockTransactionCountByNumber](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getblocktransactioncountbynumber)
* [eth\_getBlockTransactionCountByHash](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getblocktransactioncountbyhash)
* [eth\_getUncleCountByBlockNumber](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getunclecountbyblocknumber)
* [eth\_getUncleCountByBlockHash](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getunclecountbyblockhash)
* [eth\_getStorageAt](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_getstorageat)
* [eth\_mining](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_mining)
* [eth\_syncing](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/block#eth_syncing)

### [트랜잭션(Transaction)](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/transaction) <a href="#transaction" id="transaction"></a>

* [eth\_call](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_call)
* [eth\_estimateGas](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_estimategas)
* [eth\_getTransactionByBlockHashAndIndex](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_gettransactionbyblockhashandindex)
* [eth\_getTransactionByBlockNumberAndIndex](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_gettransactionbyblocknumberandindex)
* [eth\_getTransactionByHash](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_gettransactionbyhash)
* [eth\_getTransactionReceipt](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_gettransactionreceipt)
* [eth\_sendRawTransaction](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_sendrawtransaction)
* [eth\_sendTransaction](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_sendtransaction)
* [eth\_signTransaction](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_signtransaction)
* [eth\_fillTransaction](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_filltransaction)
* [eth\_pendingTransactions](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_pendingtransactions)
* [eth\_resend](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/transaction#eth_resend)

### [환경설정(Configuration)](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/config) <a href="#configuration" id="configuration"></a>

* [eth\_coinbase](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/config#eth_coinbase)
* [eth\_etherbase](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/config#eth_etherbase)
* [eth\_chainId](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/config#eth_chainid)
* [eth\_gasPrice](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/config#eth_gasprice)

### [필터(Filter)](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/filter) <a href="#filter" id="filter"></a>

* [eth\_getFilterChanges](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_getfilterchanges)
* [eth\_getFilterLogs](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_getfilterlogs)
* [eth\_getLogs](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_getlogs)
* [eth\_newBlockFilter](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_newblockfilter)
* [eth\_newFilter](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_newfilter)
* [eth\_newPendingTransactionFilter](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_newpendingtransactionfilter)
* [eth\_subscribe](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_subscribe)
* [eth\_uninstallFilter](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_uninstallfilter)
* [eth\_unsubscribe](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/filter#eth_unsubscribe)

### [Gas](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/gas) <a href="#gas" id="gas"></a>

* [eth\_feeHistory](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/gas#eth_feehistory)
* [eth\_maxPriorityFeePerGas](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/gas#eth_maxpriorityfeepergas)

### [기타(Miscellaneous)](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/misc) <a href="#miscellaneous" id="miscellaneous"></a>

* [eth\_hashrate](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/misc#eth_hashrate)
* [eth\_getWork](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/misc#eth_getwork)
* [eth\_submitWork](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/misc#eth_submitwork)
* [eth\_submitHashrate](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/misc#eth_submithashrate)

## 이더리움과의 차이점 개요 <a href="#differences_overview_from_ethereum" id="differences_overview_from_ethereum"></a>

> eth 네임스페이스 API를 제공할 때 클레이튼과 이더리움의 차이점에 대해 더 자세히 설명하는 [주의](https://archive-ko.docs.klaytn.foundation/content/dapp/json-rpc/api-references/eth/caution) 장을 확인하시기 바랍니다.

### 블록 <a href="#block" id="block"></a>

관련된 APIs: [eth\_getHeaderByNumber](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/block/README.md#eth_getHeaderByNumber), [eth\_getHeaderByHash](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/block/README.md#eth_getHeaderByHash), [eth\_getBlockByHash](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/block/README.md#eth_getBlockByHash), [eth\_getBlockByNumber](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/block/README.md#eth_getBlockByNumber), [eth\_getUncleByBlockHashAndIndex](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/block/README.md#eth_getUncleByBlockHashAndIndex), [eth\_getUncleByBlockNumberAndIndex](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/block/README.md#eth_getUncleByBlockNumberAndIndex).

| 필드              | 설명                                                                                                                                                                                                                                                                                                                     |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| baseFeePerGas   | Klaytn은 baseFeePerGas 스킴을 가지고 있지 않기 때문에, 해당 필드는 항상 `0x0` 값을 가집니다.                                                                                                                                                                                                                                                      |
| difficulty      | Klaytn 헤더에서 해당 필드는 `blockScore`에 해당하며, `0x1`로 값이 고정되어 있습니다. 이는 Klaytn의 합의 메커니즘이 작업증명을 기반으로 하지 않기 때문에, 블록 난이도라는 기술적 개념이 Klaytn 코어에 적용되지 않기 때문입니다.                                                                                                                                                                       |
| extraData       | 해당 필드는 빈 값을 나타내며 항상 `0x`를 값으로 가집니다. 클레이튼의 `extraData`에는 검증자 주소, 검증자 서명, 제안자 서명 등의 합의 데이터가 포함되어 있기 때문에, `eth` 네임스페이스 API에는 적용되지 않습니다.                                                                                                                                                                                   |
| gasLimit        | Klaytn은 GasLimit이 없기 때문에 해당 필드는 임의의 숫자인 `0xe8d4a50fff`(=`999999999999` in decimal)를 값으로 가집니다. 이 수치는 [이더리움의 블록 가스 한도](https://ethereum.org/en/developers/docs/gas/#block-size)보다 30배 높은 수치입니다. 더 자세한 내용은 [계산 비용](https://archive-ko.docs.klaytn.foundation/content/klaytn/design/computation/computation-cost)을 참조하십시오. |
| miner           | 해당 필드는 블록 제안자의 주소를 반환합니다. 클레이튼의 [합의 메커니즘](https://archive-ko.docs.klaytn.foundation/content/klaytn/design/consensus-mechanism)은 [PBFT](https://archive-ko.docs.klaytn.foundation/klaytn/design/consensus-mechanism#pbft-practical-byzantine-fault-tolerance)이기 때문에, 채굴자 대신 블록 제안자를 가집니다.                               |
| mixHash         | Klaytn의 합의 메커니즘은 PoW기반이 아니기 때문에, 해당 필드는 항상 zeroHash(`0x00...`)를 값으로 가집니다.                                                                                                                                                                                                                                              |
| nonce           | Klaytn의 합의 메커니즘은 PoW기반이 아니기 때문에, 해당 필드는 항상 zeroNonce(`0x00...`)를 값으로 가집니다.                                                                                                                                                                                                                                             |
| sha3Uncles      | Klaytn은 엉클블록이 없기 때문에, 해당 필드는 항상 빈 블록 헤더를 포함하는 목록의 RLP-encoded 바이트의 Keccak256해시인 `0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347`를 값으로 가집니다.                                                                                                                                                        |
| totalDifficulty | 쿼리 블록까지 체인의 총 난이도입니다.                                                                                                                                                                                                                                                                                                  |
| uncles          | Klaytn core에는 엉클블록에 관한 기술적 개념이 없기 때문에, 해당 필드는 항상 `[]`을 값으로 가집니다.                                                                                                                                                                                                                                                       |

여기서 다루지 않은 필드는 이더리움의 블록 필드에 고정됩니다.

### 트랜잭션(Transaction) <a href="#transaction" id="transaction"></a>

관련된 APIs: [eth\_getTransactionByHash](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/transaction/README.md#eth_getTransactionByHash), [eth\_getTransactionByBlockHashAndIndex](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/transaction/README.md#eth_getTransactionByBlockHashAndIndex), [eth\_getTransactionByBlockNumberAndIndex](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/transaction/README.md#eth_getTransactionByBlockNumberAndIndex), [eth\_pendingTransactions](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/transaction/README.md#eth_pendingTransactions).

> 클레이튼과 이더리움의 근본적인 설계 차이로 인해 클레이튼 트랜잭션은 `eth` 네임스페이스 API를 통해 완전하게 지원되지 않습니다.

| 필드       | 설명                                                                                                                                                  |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| gasPrice | Klaytn의 맥락에서는 [단가](https://archive-ko.docs.klaytn.foundation/klaytn/design/transaction-fees#unit-price)로도 알려져 있으며, 해당 값은 거버넌스 프로세스를 통해 시스템에서 결정됩니다. |
| 형식       | Klaytn에서 `type` 은 트랜잭션 타입을 문자열로 반환하지만 (예: `"LegacyTransaction"`), 이더리움과 일치하도록 16진수로 변환되었습니다 (예: `0x0`). Klaytn에서만 유효한 트랜잭션 유형은 항상 `0x0`를 반환합니다.     |

Klaytn 트랜잭션은 프로토콜 수준에서도 멀티시그(이더리움 트랜잭션은 서명 필드(= v, r, s)가 하나만 있음)를 지원하기 때문에 둘 이상의 서명을 가질 수 있습니다. 이러한 맥락에서 서명(v, r, s)과 관련된 필드는 `tx.signatures[0].V`, `tx.signatures[0].R`, `tx.signatures[0].S`와 일치합니다.

여기서 다루지 않은 필드는 이더리움의 트랜잭션 필드에 고정됩니다.

### Transaction Receipt <a href="#transaction_receipt" id="transaction_receipt"></a>

관련된 APIs: [eth\_getTransactionReceipt](https://github.com/klaytn/klaytn-docs-ko/blob/main/docs/dapp/json-rpc/api-references/eth/transaction/README.md#eth_getTransactionReceipt).

> 클레이튼과 이더리움의 근본적인 설계 차이로 인해 이더리움 네임스페이스 API를 통해 클레이튼 트랜잭션 영수증을 완전하게 지원할 수 없습니다.

| 필드                | 설명                                                                                                                                                                                 |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| effectiveGasPrice | Klaytn은 고정된 가스 가격 정책을 사용하므로, gasPrice 값을 반환합니다. gasPrice([단가](https://archive-ko.docs.klaytn.foundation/klaytn/design/transaction-fees#unit-price)라고도 함)는 거버넌스에 의해 시스템에 설정되어 있습니다. |
| transactionIndex  | 거의 이더리움과 동일하지만, 이더리움과 다르게 Klaytn은 트랜잭션이 보류 중인 상태에서 그대로 정수를 반환합니다.                                                                                                                  |

여기서 다루지 않은 필드는 이더리움의 권장 필드인 트랜잭션 영수증을 따릅니다.
