Ethereum RPC endpoint दस्तावेज़

Ethereum RPC endpoint दस्तावेज़

ERPC को अपने Ethereum RPC endpoint के रूप में HTTP JSON-RPC requests और WebSocket subscriptions के लिए इस्तेमाल करें। Ethereum RPC हमारे Global Edge Blockchain Infrastructure के भीतर ERPC के RPC APIs का हिस्सा है, और API key को ERPC Web Dashboard से मैनेज किया जा सकता है।
आप वही RPC key इस्तेमाल कर सकते हैं जो Solana के लिए इस्तेमाल होती है।
कृपया अपनी API key को 'api-key' parameter में जोड़ें।

Endpoint पते

JSON-RPC 2.0 requests को HTTP POST के रूप में यहाँ भेजें:
endpoint
https://edge.erpc.global/eth?api-key=<YOUR_API_KEY>
Subscriptions के लिए, WebSocket पर यहाँ connect करें:
endpoint
wss://edge.erpc.global/eth?api-key=<YOUR_API_KEY>

उदाहरण:

यह रहा एक HTTP request का उदाहरण।
bash
curl https://edge.erpc.global/eth?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","id":1,
  "method":"eth_blockNumber"
}'
यह रहा एक WebSocket subscription का उदाहरण।
bash
wscat -c "wss://edge.erpc.global/eth?api-key=<YOUR_API_KEY>"
# After connected, send:
{"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
आप अपनी API key ERPC Web Dashboard पर प्राप्त और verify कर सकते हैं: ERPC Web Dashboard

Batch अनुरोध

प्रति HTTP request अधिकतम 256 calls वाले JSON-RPC batches समर्थित हैं, और JSON-RPC notifications भी स्वीकार किए जाते हैं। batch में हर call को अपने खुद के call के रूप में मीटर किया जाता है।

उपयोग मीटरिंग

हर call पर उतने tokens लगते हैं जितने उसके method के लिए तय हैं। HTTP batch के अंदर का हो या WebSocket connection पर भेजा गया, हर call अलग से एक बार गिना जाता है। WebSocket पर आपको मिलने वाली हर subscription सूचना के लिए भी tokens लगते हैं। Dashboard का API उपयोग page हर token को एक credit के रूप में दिखाता है।
HTTP और WebSocket पर भेजे गए हर call पर इतने tokens लगते हैं:
Methodप्रति call tokens
नीचे दिए गए 46 methods42
नीचे दिए गए 18 methods81
eth_getLogs, eth_getFilterLogs, eth_sendRawTransaction, eth_callMany, eth_simulateV1, txpool_status, txpool_inspect, txpool_contentFrom, debug_getRawReceipts84
नीचे दिए गए 17 methods162
trace_callMany, txpool_content168
trace_replayBlockTransactions, trace_replayTransaction324
ऊपर की rows में न आने वाले सभी methods81, 162 या 324
अनुमान लगाते समय "81, 162 या 324" वाली row के किसी भी method के हर call पर 324 tokens मानें — यानी तीनों में से सबसे बड़ा मान।
इन methods में प्रति call 42 tokens लगते हैं:
  • eth_* (41): eth_accounts, eth_baseFee, eth_blobBaseFee, eth_blockNumber, eth_call, eth_capabilities, eth_chainId, eth_createAccessList, eth_estimateGas, eth_feeHistory, eth_gasPrice, eth_getAccount, eth_getBalance, eth_getBlockByHash, eth_getBlockByNumber, eth_getBlockReceipts, eth_getBlockTransactionCountByHash, eth_getBlockTransactionCountByNumber, eth_getCode, eth_getFilterChanges, eth_getProof, eth_getRawTransactionByHash, eth_getStorageAt, eth_getTransactionByBlockHashAndIndex, eth_getTransactionByBlockNumberAndIndex, eth_getTransactionByHash, eth_getTransactionBySenderAndNonce, eth_getTransactionCount, eth_getTransactionReceipt, eth_getUncleCountByBlockHash, eth_getUncleCountByBlockNumber, eth_maxPriorityFeePerGas, eth_newBlockFilter, eth_newFilter, eth_newPendingTransactionFilter, eth_signTransaction, eth_submitWork, eth_subscribe, eth_syncing, eth_uninstallFilter, eth_unsubscribe
  • net_* (3): net_listening, net_peerCount, net_version
  • web3_* (2): web3_clientVersion, web3_sha3
इन methods में प्रति call 81 tokens लगते हैं:
  • eth_* (18): eth_cancelPrivateTransaction, eth_coinbase, eth_getHeaderByNumber, eth_getRawTransactionByBlockHashAndIndex, eth_getRawTransactionByBlockNumberAndIndex, eth_getUncleByBlockHashAndIndex, eth_getUncleByBlockNumberAndIndex, eth_getUserOperationReceipt, eth_getWork, eth_hashrate, eth_mining, eth_pendingTransactions, eth_protocolVersion, eth_sendPrivateTransaction, eth_sendTransaction, eth_sign, eth_submitHashRate, eth_submitHashrate
इन methods में प्रति call 162 tokens लगते हैं:
  • debug_* (11): debug_gcStats, debug_getBadBlocks, debug_getBlockReceipts, debug_getTrieFlushInterval, debug_storageRangeAt, debug_traceBlock, debug_traceBlockByHash, debug_traceBlockByNumber, debug_traceCall, debug_traceCallMany, debug_traceTransaction
  • trace_* (6): trace_block, trace_call, trace_filter, trace_get, trace_rawTransaction, trace_transaction
WebSocket (wss://edge.erpc.global/eth) पर आपको मिलने वाली हर subscription सूचना पर 42 tokens लगते हैं। Subscription सूचना वह eth_subscription message है जो server तब भेजता है जब आप eth_subscribe से subscribe कर चुके होते हैं।
Connection पर भेजे गए ऐसे हर message पर भी 42 tokens लगते हैं जिसे JSON-RPC call के रूप में पढ़ा नहीं जा सकता।
आप मौजूदा प्रति-call token दर Ethereum RPC API संदर्भ में देख सकते हैं।

समर्थित Methods

यह endpoint मानक Ethereum JSON-RPC method families को कवर करता है — eth_*, net_*, txpool_*, और web3_* — जिसमें account और block reads (eth_getBalance, eth_getBlockByNumber, eth_getLogs), transaction flow (eth_sendRawTransaction, eth_getTransactionReceipt), fee data (eth_feeHistory, eth_maxPriorityFeePerGas), call simulation (eth_call, eth_callMany, eth_simulateV1), state proofs (eth_getProof), filters (eth_newFilter, eth_getFilterChanges), txpool inspection (txpool_status, txpool_content), और WebSocket subscriptions (eth_subscribe, eth_unsubscribe) शामिल हैं।
Request और response shapes के साथ पूरी method सूची के लिए, Ethereum RPC API संदर्भ देखें।

Response के status codes

HTTP स्थितिअर्थ
200Upstream JSON-RPC response।
400API key गुम है, या JSON-RPC request अमान्य है।
401Unauthorized API key।
429Rate limited। retry-after header प्रतीक्षा समय seconds में बताता है।
502Upstream RPC request पूरा नहीं हो सका।
503Service अस्थायी रूप से अनुपलब्ध है।
WebSocket connections ऊपर दिए गए codes के अलावा 101 (protocol upgrade accepted) का इस्तेमाल करते हैं।

Ethereum RPC Methods और Documentation

Standard methods, parameters और subscription specifications की पूरी सूची के लिए official documentation देखें। इसमें HTTP और WebSocket दोनों का उपयोग शामिल है।