Ethereum RPC क्विकस्टार्ट | ERPC
Ethereum RPC क्विकस्टार्ट
यह गाइड आपको ERPC के साथ शून्य से आपकी पहली Ethereum JSON-RPC प्रतिक्रिया तक ले जाता है।
1. अपनी API key प्राप्त करें
आप अपनी API key ERPC Web Dashboard पर प्राप्त और verify कर सकते हैं: ERPC Web Dashboard
क्या आप पहले से Solana के लिए ERPC इस्तेमाल कर रहे हैं? आप वही RPC key इस्तेमाल कर सकते हैं जो Solana के लिए इस्तेमाल होती है।
2. अपना पहला Request भेजें
अपनी API key
api-key parameter में देकर, JSON-RPC 2.0 request को HTTP POST के रूप में भेजें: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"
}'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"
}'Response में नवीनतम block number hexadecimal में मिलता है:
json
{ "jsonrpc": "2.0", "id": 1, "result": "0x..." }{ "jsonrpc": "2.0", "id": 1, "result": "0x..." }आप
eth_chainId से यह जांच सकते हैं कि endpoint किस chain को serve करता है: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_chainId"
}'curl https://edge.erpc.global/eth?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
"jsonrpc":"2.0","id":1,
"method":"eth_chainId"
}'3. WebSocket पर Subscribe करें
WebSocket endpoint मानक
eth_subscribe subscriptions स्वीकार करता है: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"]}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"]}उपलब्ध subscription types के लिए, नीचे लिंक की गई आधिकारिक Ethereum JSON-RPC documentation देखें।
4. Batch Requests
आप एक ही HTTP request में 256 तक JSON-RPC calls भेज सकते हैं। batch में हर call को अपने खुद के call के रूप में मीटर किया जाता है।
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"},
{"jsonrpc":"2.0","id":2,"method":"eth_gasPrice"}
]'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"},
{"jsonrpc":"2.0","id":2,"method":"eth_gasPrice"}
]'अगले चरण
- Endpoints, मीटरिंग और status codes: Ethereum RPC Endpoint दस्तावेज़
- Request और response shapes के साथ पूरी method सूची: Ethereum RPC API संदर्भ
- आधिकारिक Ethereum JSON-RPC documentation: https://ethereum.org/en/developers/docs/apis/json-rpc/






