Pharos 백서

Pharos

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 18쪽 중 11쪽

77160..."} ``` ### eth\_call Executes a message call without creating a transaction. Useful for reading contract state. * Input: * `Object` - Transaction call object (from, to, gas, gasPrice, value, data) * `String` - Block number or tag * Output: `String` - Return data as hexadecimal **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_call", "params": [ { "to": "0x4100000000000000000000000000000000000000", "data": "0x76671808" }, "latest" ], "id": 1 } // Response {"jsonrpc":"2.0","id":1,"result":"0x0000000000000000..."} ``` ### eth\_estimateGas Estimates the gas needed to execute a transaction. * Input: * `Object` - Transaction call object * `String` - Block number or tag (optional) * Output: `String` - Estimated gas as hexadecimal **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_estimateGas", "params": [ { "to": "0x4100000000000000000000000000000000000000", "data": "0x76671808" } ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": "0x9d4b" } ``` ### eth\_createAccessList Creates an EIP-2930 access list for a transaction. > **Note:** This method is still under debugging and may return null values. * Input: * `Object` - Transaction call object * `String` - Block number or tag * Output: `Object` - Access list and estimated gas **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_createAccessList", "params": [ { "to": "0x4100000000000000000000000000000000000000", "data": "0x76671808" }, "latest" ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": { "accessList": [ { "address": "0x0000000000000000000000000000000000000000", "storageKeys": [] }, { "address": "0x0000000000000000000000000000000000000001", "storageKeys": [] }, "..." ], "gasUsed": "0x9d4b" } } ``` ### eth\_getBlockByHash Returns information about a block by its hash. * Input: * `String` - Block hash * `Boolean` - If `true`, returns full transaction objects; if `false`, returns transaction hashes * Output: `Object` - Block information **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getBlockByHash", "params": [ "0xfa15419fc3de49e27f62eff7be1f344a3fd156e332ea9a78337c73a0b2b6573a", false ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "baseFeePerGas": "0x2540be400", "difficulty": "0x0", "extraData": "0x0a0000010000003c...", "gasLimit": "0x3b9aca00", "gasUsed": "0x0", "hash": "0xfa15419fc3de49e2...", "logsBloom": "0x0000000000000000...", "miner": "0x0000000000000000000000000000000000000000", "mixHash": "0x0000000000000000...", "nonce": "0x0000000000000000", "number": "0x2710", "parentHash": "0x1ff0db61e7c714a9...", "receiptsRoot": "0x56e81f171bcc55a6...", "sha3Uncles": "0x1dcc4de8dec75d7a...", "size": "0x257", "stateRoot": "0xc5914a0db9663398...", "timestamp": "0x693c2fd1", "totalDifficulty": "0x0", "transactions": [], "transactionsRoot": "0x56e81f171bcc55a6...", "uncles": [] } } ``` ### eth\_getBlockByNumber Returns information about a block by its number. * Input: * `String` - Block number or tag * `Boolean` - If `true`, returns full transaction objects * Output: `Object` - Block information **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": [ "0x2710", false ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": { "baseFeePerGas": "0x2540be400", "difficulty": "0x0", "extraData": "0x0a0000010000003cc91a139b010000e3b0c44298fc1c149afbf4c8996fb92427...", "gasLimit": "0x3b9aca00", "gasUsed": "0x0", "hash": "0xfa15419fc3de49e2...", "logsBloom": "0x0000000000000000000000000000000000000000000000000000000000000000...", "miner": "0x0000000000000000000000000000000000000000", "mixHash": "0x0000000000000000...", "nonce": "0x0000000000000000", "number": "0x2710", "parentHash": "0x1ff0db61e7c714a9...", "receiptsRoot": "0x56e81f171bcc55a6...", "sha3Uncles": "0x1dcc4de8dec75d7a...", "size": "0x257", "stateRoot": "0xc5914a0db9663398...", "timestamp": "0x693c2fd1", "totalDifficulty": "0x0", "transactions": [], "transactionsRoot": "0x56e81f171bcc55a6...", "uncles": [] } } ``` ### eth\_getBlockReceipts Returns all transaction receipts for a given block. * Input: * `String` - Block number or tag * Output: `Array` - List of transaction receipts **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getBlockReceipts", "params": [ "0x2710" ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": [] } ``` ### eth\_getBlockTransactionCountByHash Returns the number of transactions in a block by block hash. * Input: * `String` - Block hash * Output: `String` - Transaction count as hexadecimal **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": [ "0xfa15419fc3de49e27f62eff7be1f344a3fd156e332ea9a78337c73a0b2b6573a" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": "0x0" } ``` ### eth\_getBlockTransactionCountByNumber Returns the number of transactions in a block by block number. * Input: * `String` - Block number or tag * Output: `String` - Transaction count as hexadecimal **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByNumber", "params": [ "0x2710" ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": "0x0" } ``` ### eth\_getTransactionByHash Returns information about a transaction by its hash. * Input: * `String` - Transaction hash * Output: `Object` - Transaction details **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getTransactionByHash", "params": [ "0xee093bb802e09fe6119e83d7fe35004464a98e69000bcd5672ac73b32172c997" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "blockHash": "0x1d13424e6a78ab6d...", "blockNumber": "0x4ff5de", "chainId": "0x688", "from": "0x7565f60988b83e577cb1a670ce577667311b11ae", "gas": "0x1380a5", "gasPrice": "0x2540be400", "hash": "0xee093bb802e09fe6...", "input": "0x6a76120200000000...", "nonce": "0x66", "r": "0xd7f06b78d1c679b4...", "s": "0x74b4c81773e6d4f0...", "to": "0xcce192445aa8118117e73554773e8be8617f31d0", "transactionIndex": "0x0", "type": "0x0", "v": "0xd34", "value": "0x0" } } ``` ### eth\_getTransactionByBlockHashAndIndex Returns a transaction by block hash and index position. * Input: * `String` - Block hash * `String` - Transaction index (hexadecimal) * Output: `Object` - Transaction details **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getTransactionByBlockHashAndIndex", "params": [ "0x1d13424e6a78ab6d9263e6e5f8c9026588d8ba6d2709127a241fbe53a57fd9d9", "0x0" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "blockHash": "0x1d13424e6a78ab6d...", "blockNumber": "0x4ff5de", "chainId": "0x688", "from": "0x7565f60988b83e577cb1a670ce577667311b11ae", "gas": "0x1380a5", "gasPrice": "0x2540be400", "hash": "0xee093bb802e09fe6...", "input": "0x6a76120200000000...", "nonce": "0x66", "r": "0xd7f06b78d1c679b4...", "s": "0x74b4c81773e6d4f0...", "to": "0xcce192445aa8118117e73554773e8be8617f31d0", "transactionIndex": "0x0", "type": "0x0", "v": "0xd34", "value": "0x0" } } ``` ### eth\_getTransactionByBlockNumberAndIndex Returns a transaction by block number and index position. * Input: * `String` - Block number or tag * `String` - Transaction index (hexadecimal) * Output: `Object` - Transaction details **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getTransactionByBlockNumberAndIndex", "params": [ "0x4ff5de", "0x0" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "blockHash": "0x1d13424e6a78ab6d...", "blockNumber": "0x4ff5de", "chainId": "0x688", "from": "0x7565f60988b83e577cb1a670ce577667311b11ae", "gas": "0x1380a5", "gasPrice": "0x2540be400", "hash": "0xee093bb802e09fe6...", "input": "0x6a76120200000000...", "nonce": "0x66", "r": "0xd7f06b78d1c679b4...", "s": "0x74b4c81773e6d4f0...", "to": "0xcce192445aa8118117e73554773e8be8617f31d0", "transactionIndex": "0x0", "type": "0x0", "v": "0xd34", "value": "0x0" } } ``` ### eth\_getTransactionReceipt Returns the receipt of a transaction by transaction hash. * Input: * `String` - Transaction hash * Output: `Object` - Transaction receipt **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getTransactionReceipt", "params": [ "0xee093bb802e09fe6119e83d7fe35004464a98e69000bcd5672ac73b32172c997" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "blockHash": "0x1d13424e6a78ab6d...", "blockNumber": "0x4ff5de", "contractAddress": null, "cumulativeGasUsed": "0xea376", "effectiveGasPrice": "0x2540be400", "from": "0x7565f60988b83e577cb1a670ce577667311b11ae", "gasUsed": "0xea376", "logs": [ { "address": "...", "blockHash": "...", "blockNumber": "...", "blockTimestamp": "...", "data": "...", "logIndex": "...", "removed": "...", "topics": "...", "transactionHash": "...", "transactionIndex": "..." }, { "address": "...", "blockHash": "...", "blockNumber": "...", "blockTimestamp": "...", "data": "...", "logIndex": "...", "removed": "...", "topics": "...", "transactionHash": "...", "transactionIndex": "..." }, { "address": "...", "blockHash": "...", "blockNumber": "...", "blockTimestamp": "...", "data": "...", "logIndex": "...", "removed": "...", "topics": "...", "transactionHash": "...", "transactionIndex": "..." } ], "logsBloom": "0x0000000040000000...", "status": "0x1", "to": "0xcce192445aa8118117e73554773e8be8617f31d0", "transactionHash": "0xee093bb802e09fe6...", "transactionIndex": "0x0", "type": "0x0" } } ``` ### eth\_getLogs Returns logs matching a given filter object. * Input: * `Object` - Filter parameters (fromBlock, toBlock, address, topics) * Output: `Array` - List of log entries > **Note:** Block range is limited to 100 blocks when rate limiting is enabled, or 10,000 blocks as a fallback cap. **Example:** ```json // Request { "jsonrpc": "2.0", "method": "eth_getLogs", "params": [ { "fromBlock": "0x1", "toBlock": "0x64", "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "topics": [ "0xddf252ad1be2c89b..." ] } ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": [ { "address": "0x742d...f44e", "topics": [ "0xddf252...b3ef", "0x000000...sender", "0x000000...receiver" ], "data": "0x0000000000000000...", "blockNumber": "0x50", "transactionHash": "0xabc123...", "logIndex": "0x0" } ] } ``` ### eth\_subscribe Creates a subscription for real-time events (WebSocket only). * Input: * `String` - Subscription type: `newHeads` or `logs` * `Object` - Filter parameters (for `logs` type only) * Output: `String` - Subscription ID > **Note:** Only available over WebSocket connections. HTTP calls will fail. **Example:** ```json // Request (newHeads subscription) { "jsonrpc": "2.0", "method": "eth_subscribe", "params": ["newHeads"], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": "0x1" } // Subsequent notification { "jsonrpc": "2.0", "method": "eth_subscription", "params": { "subscription": "0x1", "result": { "number": "0x2710", "hash": "0xfa15419fc3de49e2...", "parentHash": "0x1ff0db61e7c714a9...", "timestamp": "0x693c2fd1" } } } ``` ### eth\_unsubscribe Cancels an existing subscription (WebSocket only). * Input: * `String` - Subscription ID * Output: `Boolean` - `true` if successfully unsubscribed **Example:** ```json // Request (WebSocket only) { "jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x1"], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": true } ``` *** ## Network Methods ### net\_version Returns the current network ID. * Input: None * Output: `String` - Network ID **Example:** ```json // Request { "jsonrpc": "2.0", "method": "net_version", "params": [], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": "1672" } ``` ### net\_listening Returns whether the node is actively listening for network connections. * Input: None * Output: `Boolean` - Returns `true` if the node is listening for connections (hardcoded to `true` in current implementation) > **Note:** This method is not available on the public RPC endpoint. ### net\_peerCount Returns the number of connected peers. * Input: None * Output: `String` - Number of peers as hexadecimal > **Note:** This method is not available on the public RPC endpoint. *** ## Web3 Methods ### web3\_clientVersion Returns the current client version. * Input: None * Output: `String` - Client version string **Example:** ```json // Request { "jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": "portal/1.0.0" } ``` ### web3\_sha3 Returns the Keccak-256 hash of the given data. * Input: * `String` - Data to hash (hexadecimal) * Output: `String` - Keccak-256 hash > **Note:** This method is not available on the public RPC endpoint. *** ## Debug Methods ### debug\_traceTransaction Returns the execution trace of a transaction. * Input: * `String` - Transaction hash * `Object` - Tracer options (optional). Currently only `"callTracer"` is supported. * Output: `Object` - Execution trace **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_traceTransaction", "params": [ "0xabc123...", { "tracer": "callTracer" } ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "type": "CALL", "from": "0x...", "to": "0x...", "value": "0x0", "gas": "0x...", "gasUsed": "0x...", "input": "0x...", "output": "0x..." } } ``` ### debug\_traceCall Executes a call and returns the execution trace without creating a transaction. * Input: * `Object` - Transaction call object * `String` - Block number or tag * `Object` - Tracer options (optional). Currently only `"callTracer"` is supported. * Output: `Object` - Execution trace **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_traceCall", "params": [ { "from": "0xfaC0718D882E5f07e1972D617bd430CD72A55D84", "to": "0x4100000000000000000000000000000000000000", "data": "0x76671808" }, "latest", { "tracer": "callTracer" } ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": { "failed": false, "gas": "0x9d4b", "returnValue": { "failed": false, "gas": "0x9d4b", "returnValue": null }, "structLogs": { "depth": 1, "gas": "0x1c97138", "gasCost": "0x3", "memSize": 0, "op": 96, "opName": "PUSH1", "pc": 0, "refund": 0, "stack": [] } } } ``` ### debug\_traceBlockByHash Returns traces for all transactions in a block by block hash. * Input: * `String` - Block hash * `Object` - Tracer options (optional). Currently only `"callTracer"` is supported as the tracer type. * Output: `Array` - Array of execution traces **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_traceBlockByHash", "params": [ "0x1d13424e6a78ab6d9263e6e5f8c9026588d8ba6d2709127a241fbe53a57fd9d9", { "tracer": "callTracer" } ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": [ { "result": { "calls": "...", "from": "...", "gas": "...", "gas_used": "...", "input": "...", "output": "...", "to": "...", "type": "...", "value": "..." }, "txHash": "0xee093bb802e09fe6..." } ] } ``` ### debug\_traceBlockByNumber Returns traces for all transactions in a block by block number. * Input: * `String` - Block number or tag * `Object` - Tracer options (optional). Currently only `"callTracer"` is supported as the tracer type. * Output: `Array` - Array of execution traces **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_traceBlockByNumber", "params": [ "0x4ff5de", { "tracer": "callTracer" } ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": [ { "result": { "calls": "...", "from": "...", "gas": "...", "gas_used": "...", "input": "...", "output": "...", "to": "...", "type": "...", "value": "..." }, "txHash": "0xee093bb802e09fe6..." } ] } ``` ### debug\_getRawBlock Returns the RLP-encoded block data. * Input: * `String` - Block number, block hash, or tag * Output: `String` - RLP-encoded block data **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_getRawBlock", "params": [ "0x2710" ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": "0xf90252f9024da01ff0db61e7c714a91d7e3528c7f659e43b1ddfddb8b20848c8..." } ``` ### debug\_getRawHeader Returns the RLP-encoded block header. * Input: * `String` - Block number, block hash, or tag * Output: `String` - RLP-encoded header data **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_getRawHeader", "params": [ "0x2710" ], "id": 1 } // Response { "id": 1, "jsonrpc": "2.0", "result": "0xf9024fa01ff0db61e7c714a91d7e3528c7f659e43b1ddfddb8b20848c87775af..." } ``` ### debug\_getRawReceipts Returns the raw receipts for a block. * Input: * `String` - Block number, block hash, or tag * Output: `Array` - Raw receipt data **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_getRawReceipts", "params": [ "0x2710" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": [] } ``` ### debug\_getRawTransaction Returns the raw transaction data by hash. * Input: * `String` - Transaction hash * Output: `String` - Raw transaction data **Example:** ```json // Request { "jsonrpc": "2.0", "method": "debug_getRawTransaction", "params": [ "0xee093bb802e09fe6119e83d7fe35004464a98e69000bcd5672ac73b32172c997" ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": "0xf9036d668502540b..." } ``` ### debug\_protocolVersion Returns detailed protocol and version information. * Input: None * Output: `Object` - Version information including: * `binaryVersion` - Node binary version * `currentSpecVersion` - Current spec version * `currentStableBlock` - Current stable block number * `higherSpecVersions` - Available higher spec versions * `protocolVersion` - Protocol version string > **Note:** This method is not available on the public RPC endpoint. *** ## Trace Methods ### trace\_filter Returns traces matching a given filter. * Input: * `Object` - Filter parameters: * `fromBlock` - Start block (hexadecimal) * `toBlock` - End block (hexadecimal) * `fromAddress` - Array of sender addresses (optional) * `toAddress` - Array of receiver addresses (optional) * `count` - Maximum number of traces to return (optional) * `after` - Offset for pagination (optional) * Output: `Array` - Matching traces > **Note:** Block range is limited to 500 blocks. **Example:** ```json // Request { "jsonrpc": "2.0", "method": "trace_filter", "params": [ { "fromBlock": "0x4ff5de", "toBlock": "0x4ff5de" } ], "id": 1 } // Response { "jsonrpc": "2.0", "id": 1, "result": [ { "action": { "callType": "...", "from": "...", "gas": "...", "input": "...", "to": "...", "value": "..." }, "blockHash": "0x1d13424e6a78ab6d...", "blockNumber": "0x4ff5de", "result": { "gas_used": "...", "output": "..." }, "subtraces": "0x1", "traceAddress": [], "transactionHash": "0xee093bb802e09fe6...", "transactionPosition": "0x0", "type": "CALL" } ] } ``` *** ## Transaction Pool Methods ### txpool\_nonceFrom Returns the next nonce for an address from the transaction pool. * Input: * `String` - Address * Output: `String` - Nonce as hexadecimal > **Note:** This method is not available on the public RPC endpoint. *** ## Pharos Extension Methods ### eth\_getAccount Returns account information at a given address (EIP-7587). * Input: * `String` - Address to query * `String` - Block number or tag * Output: `Object` - Account details including balance, nonce, codeHash, and storageRoot **Example:** ```json /
프로젝트로 돌아가기