bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 18쪽 중 12쪽
/ Request
{
"jsonrpc": "2.0",
"method": "eth_getAccount",
"params": [
"0xfaC0718D882E5f07e1972D617bd430CD72A55D84",
"latest"
],
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"balance": "0x425F2B5D87BCB400",
"codeHash": "0xc5d2460186f7233c...",
"nonce": "0x2",
"storageRoot": "0x0000000000000000..."
}
}
```
### eth\_getProposerByTxHash
Returns the block proposer for a given transaction.
* Input:
* `String` - Transaction hash
* Output: `Object` - Proposer information
> **Note:** This method is not available on the public RPC endpoint.
### eth\_getProposersByBlockNumber
Returns the list of proposers for a given block.
* Input:
* `String` - Block number or tag
* Output: `Array` - List of proposer addresses
> **Note:** This method is not available on the public RPC endpoint.
***
## Pharos Debug Extensions
These are Pharos-specific debug methods that extend the standard debug namespace.
### debug\_getValidatorInfo
Returns validator information for the consensus layer.
* Input:
* `String` - Block number or tag (optional)
* Output: `Object` - Validator details
**Example:**
```json
// Request
{
"jsonrpc": "2.0",
"method": "debug_getValidatorInfo",
"params": [
"0x2710"
],
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockNumber": "0x2710",
"validatorSet": [
{
"blsKey": "943fd788d6e2d5d7a7520fa92594cd7349169672a4074ea6ad5be564ebd261186c4da4c70a44283f8afc74c1443882a8",
"identityKey": "04837f833999de7d9ede38c540180e2e7c193cc7a91e40c36355ae348c627687ee8f8274a3462728f46deceaa5f9d76c9224577d87dd975e610749a5d9f367bfab",
"staking": "0xD3C21BCECCEDA1000000",
"validatorID": "aa6ddf1a61d8e4dce4b63737de9c188413c489a4b3e080dface9eca672650d62"
},
{
"blsKey": "aa7793ce126340dde2ccaa9c90320e9639006de133629ebf36c21a71a935789def7890446b7181df3e63ba25c8fdffbc",
"identityKey": "042348d764c8679511b696c15e5f65c3e6e96720a80915def4895c92b7a626e1c9e22aad9e01d4204257feaae538c52ebbd74f0b05897c9d36cf5659f5f91a9b6c",
"staking": "0xD3C21BCECCEDA1000000",
"validatorID": "6bdae2537d2ef6508a36b437a28ef7ce7cdfd8581ae81d11f193579896159e62"
},
"..."
]
}
}
```
### debug\_getBlockProof
Returns the block proof data for BLS signature verification. See the [BLS Verification Demo](https://github.com/PharosNetwork/examples/blob/main/block-bls-verification/main.go) for usage examples.
* Input:
* `String` - Block number or tag
* Output: `Object` - Block proof including BLS signatures
**Example:**
```json
// Request
{
"jsonrpc": "2.0",
"method": "debug_getBlockProof",
"params": [
"0x2710"
],
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockNumber": "0x2710",
"blockProofHash": "0xfa15419fc3de49e2...",
"blsAggregatedSignature": "ac312817ac4b5a58695d54da42deedfc581063348a9f2e239e5233684fb43b47d5...",
"signedBlsKeys": [
"8281cd60dbf3e67d84a1dcd88f6f95ecf0309ed2c8226eb61d498e3b4453fe309d818f6f02db16b6c610db7b828ef1b5",
"aa7793ce126340dde2ccaa9c90320e9639006de133629ebf36c21a71a935789def7890446b7181df3e63ba25c8fdffbc",
"943fd788d6e2d5d7a7520fa92594cd7349169672a4074ea6ad5be564ebd261186c4da4c70a44283f8afc74c1443882a8"
]
}
}
```
### debug\_getBlockReadStates
Returns the read state set for a block.
* Input:
* `String` - Block number or tag
* Output: `Object` - Read state data
> **Note:** This method is only available on internal debug endpoints.
### debug\_getBlockWriteStates
Returns the write state set for a block.
* Input:
* `String` - Block number or tag
* Output: `Object` - Write state data
> **Note:** This method is only available on internal debug endpoints.
### debug\_getBlockWriteSetKeys
Returns the write set keys for a block.
* Input:
* `String` - Block number or tag
* Output: `Array` - Write set keys
> **Note:** This method is only available on internal debug endpoints.
***
## PoW Compatibility Methods (Deprecated)
These methods exist for Ethereum compatibility but return placeholder values since Pharos uses PoS consensus.
| Method | Returns | Note |
| ---------------------------------- | ------- | ------------------------------------- |
| eth\_coinbase | `"0x0"` | No mining reward address in PoS |
| eth\_mining | `false` | Validators produce blocks, not miners |
| eth\_hashrate | `"0x0"` | No hashrate in PoS |
| eth\_accounts | `[]` | Node does not manage accounts |
| eth\_pendingTransactions | `[]` | Returns empty array |
| eth\_getCompilers | `[]` | Deprecated |
| eth\_getUncleCountByBlockHash | `null` | Uncles are a PoW concept |
| eth\_getUncleCountByBlockNumber | `null` | Uncles are a PoW concept |
| eth\_getUncleByBlockHashAndIndex | `null` | Uncles are a PoW concept |
| eth\_getUncleByBlockNumberAndIndex | `null` | Uncles are a PoW concept |
***
## Not Implemented Methods
The following methods are declared but not implemented. Calling them returns `METHOD_NOT_FOUND`:
* `eth_batchGetBlockByNumber`
* `eth_batchGetTransactionByHash`
* `eth_batchGetTransactionReceipt`
* `eth_batchGetBlockReceipts`
***
## Notes
* **WebSocket:** `eth_subscribe` and `eth_unsubscribe` require a WebSocket connection. Supported subscription types: `newHeads`, `logs`.
* **Block Tags:** Supported values: `latest`, `earliest`, `pending`, `safe`, `finalized`, or a specific block number in hexadecimal.
* **EIP Support:** EIP-1559 (fee market), EIP-2930 (access lists), EIP-1186 (eth\_getProof) are fully supported.
* **Rate Limiting:** `eth_getLogs` range is limited to 100 blocks (with rate limiting) or 10,000 blocks (fallback). `trace_filter` is limited to 500 blocks.
# eth\_getProof — Storage State Verification (SPV)
## 1. Introduction
Like Ethereum Merkle Proof verification, Pharos provides Simplified Payment Verification (SPV) to allow light clients to verify the existence — or non-existence — of accounts and storage values at a given block height, without possessing the full state.
Pharos implements the storage state trie using a **hexary hash tree** with the **SHA-256** hash algorithm. The trie consists of three node types:
| Node Type | Size (bytes) | Structure |
| ------------ | ------------ | -------------------------------------------------------------------------------------------------- |
| **MSU Root** | 8192 | 256 × 32-byte SHA-256 hashes. The SHA-256 of this node equals the `stateRoot` in the block header. |
| **Internal** | 515 | 3-byte header + 16 × 32-byte child hashes. |
| **Leaf** | 65 | 1-byte type + 32-byte key hash + 32-byte value hash. |
The first-level subtree (MSU Root) contains 256 slots, with each slot representing a shard (partition) of the storage. The actual Merkle proof begins from the second-level subtree. Starting from the second-level subtree, each Internal node value starts with 3 bytes of metadata followed by 16 child node hashes. The hashes of child nodes at the corresponding offset positions in the parent node can be verified recursively, allowing us to determine whether the given root node hash can ultimately be computed, thus justifying the storage data at the specified block height.
<figure><img src="https://3298017099-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNmFp0ycownpuaUNf2xeE%2Fuploads%2Fgit-blob-58f570f3caff6679710dade06c2e035dfbe657d4%2Fspv-storage-trie.png?alt=media" alt=""><figcaption><p>Pharos storage state trie</p></figcaption></figure>
<figure><img src="https://3298017099-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNmFp0ycownpuaUNf2xeE%2Fuploads%2Fgit-blob-e4888bf37553aa6aab58511057b022caaa88efb8%2Fspv-storage-trie-detail.png?alt=media" alt=""><figcaption></figcaption></figure>
For more details of how Pharos implements SPV, you can check [SPV Proof Theory Explanation](/api-and-sdk/eth-getproof/spv-proof-theory)
***
## 2. API Reference
### `eth_getProof`
Returns the account information and Merkle proof for a given account address (and optionally specific storage keys) at a specified block height.
**Parameters:**
| # | Type | Description |
| - | ---------- | ---------------------------------------------------------------------------------------------------------------- |
| 1 | `string` | Account address (20-byte hex, `0x`-prefixed) |
| 2 | `string[]` | Array of storage keys to prove (each 32-byte hex, `0x`-prefixed). Pass `[]` if only the account proof is needed. |
| 3 | `string` | Block number (hex `0x`-prefixed) or block tag (`"latest"`, `"earliest"`) |
**curl Example — account proof only:**
```bash
curl -X POST http://<node-rpc-endpoint> \\
-H "Content-Type: application/json" \\
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getProof",
"params": [
"0x4100000000000000000000000000000000000000",
[],
"latest"
]
}'
```
**curl Example — account proof + storage proof:**
```bash
curl -X POST http://<node-rpc-endpoint> \\
-H "Content-Type: application/json" \\
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getProof",
"params": [
"0x4100000000000000000000000000000000000000",
["0x0000000000000000000000000000000000000000000000000000000000000001"],
"latest"
]
}'
```
***
## 3. Response Format
### Common Fields
| Field | Type | Description |
| -------------- | ---------- | ------------------------------------------------------------------------------------------------------------------ |
| `balance` | `string` | Account balance in hex. `"0x0"` if account does not exist. |
| `nonce` | `string` | Account nonce in hex. `"0x0"` if account does not exist. |
| `codeHash` | `string` | SHA-256 hash of the account's contract code. All-zero if none. |
| `storageHash` | `string` | Root hash of the account's storage trie. |
| `isExist` | `bool` | `true` if the account exists at the given block, `false` otherwise. |
| `accountProof` | `object[]` | Array of proof nodes from MSU Root to the target account. See [Proof Node Format](#proof-node-format). |
| `storageProof` | `object[]` | Array of storage proof entries (one per requested storage key). See [Storage Proof Format](#storage-proof-format). |
| `rawValue` | `string` | Raw RLP-encoded account value (hex). Empty `"0x"` if account does not exist. |
### Proof Node Format
Unlike Ethereum (which returns RLP-encoded hex strings), each Pharos proof node is a JSON object:
```json
{
"proofNode": "0x<hex-encoded binary node data>",
"nextBeginOffset": <int>,
"nextEndOffset": <int>
}
```
* `proofNode`: The hex-encoded binary data of the trie node (MSU Root, Internal, or Leaf).
* `nextBeginOffset` / `nextEndOffset`: The byte offset range within this node's binary data that points to the **next** node in the proof chain. **These offsets are advisory only — a sound verifier MUST independently compute the expected offset from the key and reject the proof on mismatch. See** [**§ Slot Offset Derivation**](#slot-offset-derivation)**.**
### Slot Offset Derivation
For each non-leaf node in the proof chain, the verifier must independently derive the offset of the child hash slot from the queried key. **Trusting the prover-supplied `nextBeginOffset` without this independent derivation breaks non-existence soundness** — an attacker could redirect the chain to traverse a different subtree that genuinely does not contain the key.
There are two distinct cases:
**(1) MSU Root layer (the first node in `accountProof` / `storageProof.proof`)**
The MSU Root is a flat array of 256 × 32-byte slots. The slot index for a given key is the **last byte of the key**, and the byte offset is:
```
msu_slot_index = key[len(key) - 1] // 0..255
expected_offset = msu_slot_index * 32
```
Where `key` is:
* For `accountProof`: the 20-byte account address.
* For `storageProof[i].proof`: `address (20 bytes) || storageKey (32 bytes)` = 52 bytes total.
The verifier MUST assert `proofNode[0].nextBeginOffset == expected_offset` before reading the slot, otherwise reject the proof.
**(2) Internal node layer (every subsequent non-leaf node)**
Internal nodes inside an MSU subtree have a 3-byte header followed by 16 × 32-byte child slots. The slot index is the nibble of `SHA-256(key)` at the corresponding trie depth:
```
key_hash = SHA-256(key)
slot_idx = nibble_at_depth(key_hash, depth) // 0..15
expected_offset = 3 + slot_idx * 32
```
Where `depth` is the layer's position in the proof chain (the first internal node has depth = 0).
The verifier should likewise cross-check `nextBeginOffset == expected_offset` at each internal layer.
### Storage Proof Format
Each entry in `storageProof` has the following structure:
```json
{
"key": "0x<storage-key>",
"value": "0x<storage-value>",
"isExist": true,
"proof": [
{ "proofNode": "0x...", "nextBeginOffset": N, "nextEndOffset": M },
...
]
}
```
***
## 4. Existence Proof
When the queried account (or storage key) **exists**, the response contains a complete proof chain from the MSU Root node down to the Leaf node. The `isExist` field is `true`.
### Example Response (Existence)
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"balance": "0xD3C21BCECCEDA1000000",
"nonce": "0x0",
"codeHash": "0x415b1764c41b466152a1b0830e26f2e60c391b0dfe1e06eacf28522115f9041d",
"storageHash": "0xccc11c21e5f76a72d68abcc8a72d3c50446342e12fd7b8cfe611955ed11baa24",
"isExist": true,
"rawValue": "0xee808ad3c21bcecceda100000080a0415b...",
"accountProof": [
{ "proofNode": "0x<MSU Root: 8192 bytes>", "nextBeginOffset": 1024, "nextEndOffset": 1056 },
{ "proofNode": "0x<Internal node: 515 bytes>", "nextBeginOffset": 35, "nextEndOffset": 67 },
{ "proofNode": "0x<Internal node: 515 bytes>", "nextBeginOffset": 259, "nextEndOffset": 291 },
{ "proofNode": "0x<Leaf node: 65 bytes>", "nextBeginOffset": 0, "nextEndOffset": 0 }
],
"storageProof": [
{
"key": "0x0000000000000000000000000000000000000000000000000000000000000001",
"value": "0x<storage-value>",
"isExist": true,
"proof": [
{ "proofNode": "0x...", "nextBeginOffset": 35, "nextEndOffset": 67 },
...
]
}
]
}
}
```
### Verification Logic (Existence)
1. **Leaf verification**: The last proof node is a Leaf. Verify that `SHA256(key) == leaf.key_hash` and `SHA256(value) == leaf.value_hash`.
2. **Hash chain**: Compute `current_hash = SHA256(leaf_node)`. Walk upward through the proof chain. At each parent, **independently derive the expected slot offset from the key** (see [§ Slot Offset Derivation](#slot-offset-derivation)) — do **not** read offsets blindly from `nextBeginOffset`. Confirm:
* The slot at the key-derived offset in the parent equals `current_hash`.
* The parent's `nextBeginOffset` matches the key-derived offset (cross-check). Then recompute `current_hash = SHA256(parent_node)`.
3. **Root verification**: The hash of the MSU Root node must equal the trusted `stateRoot` from the block header.
***
## 5. Non-existence Proof
When the queried account (or storage key) **does not exist**, the proof chain terminates at an Internal node where the target slot is all-zero (empty). The `isExist` field is `false`.
### Why Additional Sibling Proofs Are Needed
In an existence proof, the Leaf node's key hash and value hash provide a self-contained anchor: the verifier can compute hashes upward through the chain and confirm the root. However, for a non-existence proof, the chain terminates at an Internal node with an empty slot — and an Internal node filled with only zeros would itself hash to zero, which could be trivially forged.
To ensure the Internal node's integrity, the response includes **sibling leftmost leaf proofs** (`siblingLeftmostLeafProofs`). These provide proof paths from the non-empty sibling slots to their leftmost leaf nodes, enabling the verifier to:
1. Independently recompute each sibling slot's hash.
2. Reconstruct the full Internal node (including the empty target slot).
3. Verify the hash chain upward to the `stateRoot`.
This is a deliberate **trade-off**: the proof structure is more complex, but it enables compact storage optimization in the underlying trie engine. The verification semantics are complete — a non-existence proof fully demonstrates that the queried key is absent from the state at the given block height, and is sufficient for all practical use cases such as cross-chain bridge verification.
### `siblingLeftmostLeafProofs` Format
When `isExist` is `false` and the proof terminates at an Internal node with an empty slot, the response includes:
```json
{
"siblingLeftmostLeafProofs": [
{
"slotIndex": 0,
"leftmostLeafKey": "0x<key of the leftmost leaf in slot 0's subtree>",
"proofPath": [
{ "proofNode": "0x<Internal node in slot 0's subtree>", "nextBeginOffset": N, "nextEndOffset": M },
{ "proofNode": "0x<Leaf node>", "nextBeginOffset": 0, "nextEndOffset": 0 }
]
},
{
"slotIndex": 2,
"leftmostLeafKey": "0x<key of the leftmost leaf in slot 2's subtree>",
"proofPath": [
{ "proofNode": "0x<Leaf node>", "nextBeginOffset": 0, "nextEndOffset": 0 }
]
}
]
}
```
Each entry represents a non-empty sibling slot of the terminating Internal node:
| Field | Type | Description |
| ----------------- | ---------- | -------------------------------------------------------------------------------------------------- |
| `slotIndex` | `int` | The slot index (0–15) of the sibling in the parent Internal node. |
| `leftmostLeafKey` | `string` | The key of the leftmost leaf node reachable from this sibling slot. |
| `proofPath` | `object[]` | Proof path from the sibling slot down to the leftmost leaf. Same format as `accountProof` entries. |
### Example Response (Non-existence)
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"balance": "0x0",
"nonce": "0x0",
"codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"storageHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"isExist": false,
"rawValue": "0x",
"accountProof": [
{ "proofNode": "0x<MSU Root: 8192 bytes>", "nextBeginOffset": 1024, "nextEndOffset": 1056 },
{ "proofNode": "0x<Internal node: 515 bytes>", "nextBeginOffset": 259, "nextEndOffset": 291 },
{ "proofNode": "0x<Internal: target slot is all-zero>", "nextBeginOffset": 35, "nextEndOffset": 67 }
],
"siblingLeftmostLeafProofs": [
{
"slotIndex": 0,
"leftmostLeafKey": "0x<sibling leaf key>",
"proofPath": [
{ "proofNode": "0x<Internal>", "nextBeginOffset": 35, "nextEndOffset": 67 },
{ "proofNode": "0x<Leaf>", "nextBeginOffset": 0, "nextEndOffset": 0 }
]
},
{
"slotIndex": 7,
"leftmostLeafKey": "0x<sibling leaf key>",
"proofPath": [
{ "proofNode": "0x<Leaf>", "nextBeginOffset": 0, "nextEndOffset": 0 }
]
}
],
"storageProof": []
}
}
```
### Verification Logic (Non-existence)
1. **Main chain**: Walk the proof chain as usual. **Slot offsets at every layer (including the MSU Root) MUST be derived from the key, not read from `nextBeginOffset`** — see [§ Slot Offset Derivation](#slot-offset-derivation). The last node is an Internal node — verify that the target slot (determined by the key hash nibble at the corresponding depth) is all-zero.
2. **Sibling verification**: For each entry in `siblingLeftmostLeafProofs`:
* Concatenate the main proof chain (excluding the last node) with the sibling's `proofPath`.
* Verify that this combined chain is a valid existence proof for `leftmostLeafKey`. Slot offsets within the combined chain are derived from `leftmostLeafKey`, including the MSU Root slot — which, for honest data, must resolve to the same MSU as the main key.
3. **Root verification**: Confirm the MSU Root node hashes to the trusted `stateRoot`.
> **Why MSU Root slot derivation is load-bearing for non-existence.** The 16-slot semantics of internal nodes are bound to the key via SHA-256 nibbles, so an attacker cannot redirect those hops. The MSU Root layer is the **only** layer not bound to the key by the trie structure itself — if a verifier accepts the prover-supplied `nextBeginOffset` there, an attacker can prove non-existence for any key by pointing the chain at any of the 255 MSU subtrees that genuinely don't contain it (an honest path within the wrong subtree will validate against프로젝트로 돌아가기