Ethereum RPC Hızlı Başlangıç | ERPC
Ethereum RPC Hızlı Başlangıç
Bu kılavuz, ERPC ile ilk Ethereum JSON-RPC yanıtınıza sıfırdan ulaşmanızı sağlar.
1. API Key'inizi Alın
API key'inizi ERPC Web Dashboard üzerinden alabilir ve kontrol edebilirsiniz: ERPC Web Dashboard
Solana için zaten ERPC kullanıyor musunuz? Solana ile aynı RPC key'i kullanabilirsiniz.
2. İlk İsteğinizi Gönderin
API key'inizi
api-key parametresinde belirterek bir HTTP POST olarak JSON-RPC 2.0 isteği gönderin: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"
}'Yanıt, en son blok numarasını onaltılık biçimde döndürür:
json
{ "jsonrpc": "2.0", "id": 1, "result": "0x..." }{ "jsonrpc": "2.0", "id": 1, "result": "0x..." }Endpoint'in hangi zinciri sunduğunu
eth_chainId ile kontrol edebilirsiniz: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 Üzerinden Abone Olun
WebSocket endpoint'i standart
eth_subscribe aboneliklerini kabul eder: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"]}Kullanılabilir abonelik türleri için aşağıda bağlantısı verilen resmi Ethereum JSON-RPC dokümantasyonuna bakın.
4. Toplu İstekler
Tek bir HTTP isteğinde 256'ya kadar JSON-RPC çağrısı gönderebilirsiniz. Bir toplu istekteki her çağrı kendi başına bir çağrı olarak ücretlendirilir.
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"}
]'Sonraki Adımlar
- Endpoints, ücretlendirme ve durum kodları: Ethereum RPC Endpoint Dokümantasyonu
- İstek ve yanıt biçimleriyle birlikte tam yöntem listesi: Ethereum RPC API Referansı
- Resmi Ethereum JSON-RPC dokümantasyonu: https://ethereum.org/en/developers/docs/apis/json-rpc/






