Avalanche RPC endpoint दस्तावेज़ | ERPC

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

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

Endpoints

JSON-RPC 2.0 requests को HTTP POST के रूप में यहाँ भेजें:
text
https://edge.erpc.global/ava?api-key=<YOUR_API_KEY>
Subscriptions के लिए, WebSocket पर यहाँ connect करें:
text
wss://edge.erpc.global/ava?api-key=<YOUR_API_KEY>
upstream API का चुनाव JSON-RPC method के सटीक नाम के आधार पर होता है, इसलिए C-Chain, X-Chain, और P-Chain की सभी calls एक ही endpoint पर जाती हैं।

उदाहरण:

यह रहा एक HTTP request का उदाहरण।
bash
curl https://edge.erpc.global/ava?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/ava?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 Requests

प्रति HTTP request 256 तक के JSON-RPC batches C-Chain के EVM methods के लिए समर्थित हैं, और JSON-RPC notifications भी स्वीकार किए जाते हैं। Avalanche के native namespaces — avax.*, avm.*, platform.*, proposervm.*, और info.upgrades — एक-एक करके call किए जाते हैं। batch में हर call को अपने खुद के call के रूप में मीटर किया जाता है।

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

उपयोग को प्रति JSON-RPC call एक फ्लैट दर पर tokens में मीटर किया जाता है — हर Avalanche RPC method के लिए वही दर। HTTP batch में हर entry और WebSocket connection पर भेजा गया हर JSON-RPC call अलग-अलग मीटर किया जाता है। आप मौजूदा प्रति-call token दर Avalanche RPC API संदर्भ में देख सकते हैं।

समर्थित Methods

यह endpoint C-Chain के EVM 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_gasPrice, eth_maxPriorityFeePerGas), call simulation (eth_call, eth_estimateGas), filters (eth_newFilter, eth_getFilterChanges), txpool inspection (txpool_status, txpool_content), C-Chain extensions (eth_getAssetBalance, eth_baseFee), और WebSocket subscriptions (eth_subscribe, eth_unsubscribe) शामिल हैं।
Avalanche के native APIs भी उसी endpoint से मिलते हैं: C-Chain की atomic operations (avax.getAtomicTx, avax.getUTXOs, avax.issueTx), X-Chain (avm.getBalance, avm.getTx, avm.issueTx), P-Chain (platform.getCurrentValidators, platform.getStake, platform.getHeight, platform.issueTx, proposervm.getProposedHeight), और network upgrade timings (info.upgrades)।
Request और response shapes के साथ पूरी method सूची के लिए, Avalanche RPC API संदर्भ देखें।

Response Status Codes

HTTP statusअर्थ
200Upstream JSON-RPC response।
400API key गुम है, या JSON-RPC request अमान्य है।
401Unauthorized API key।
429Rate limited। retry-after header प्रतीक्षा समय seconds में बताता है।
502Upstream RPC request पूरा नहीं हो सका।
503Service अस्थायी रूप से अनुपलब्ध है।
प्रकाशित सूची से बाहर का JSON-RPC method HTTP 400 और JSON-RPC error -32601 (Method not found) के साथ answer किया जाता है, और 256 से अधिक calls वाला batch HTTP 400 के साथ answer किया जाता है।
WebSocket connections ऊपर दिए गए codes के अलावा 101 (protocol upgrade accepted) और 426 (WebSocket Upgrade handshake आवश्यक है) का इस्तेमाल करते हैं।

Avalanche RPC Methods और Documentation

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