ERPC - Tài liệu Solana RPC nâng cao
Solana RPC Endpoint
Vui lòng thêm API key của bạn vào tham số 'api-key'.
text
https://edge.erpc.global?api-key=<YOUR_API_KEY>https://edge.erpc.global?api-key=<YOUR_API_KEY>Ví dụ:
Đây là ví dụ HTTP request.
bash
curl https://edge.erpc.global?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
"jsonrpc":"2.0","id":1,
"method":"getBlockHeight"
}'curl https://edge.erpc.global?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
"jsonrpc":"2.0","id":1,
"method":"getBlockHeight"
}'Đây là ví dụ WebSocket subscription. Host giống như HTTP.
text
wss://edge.erpc.global?api-key=<YOUR_API_KEY>wss://edge.erpc.global?api-key=<YOUR_API_KEY>bash
# Ví dụ: subscribe cập nhật slot
wscat -c "wss://edge.erpc.global?api-key=<YOUR_API_KEY>"
# Sau khi kết nối, gửi:
{"jsonrpc":"2.0","id":1,"method":"slotSubscribe"}# Ví dụ: subscribe cập nhật slot
wscat -c "wss://edge.erpc.global?api-key=<YOUR_API_KEY>"
# Sau khi kết nối, gửi:
{"jsonrpc":"2.0","id":1,"method":"slotSubscribe"}Bạn có thể lấy và kiểm tra API key trên Discord của Validators DAO: https://discord.gg/C7ZQSrCkYR
Nếu bạn cần độ trễ thấp hơn WebSocket, hãy cân nhắc Geyser gRPC hoặc ShredStream. Bạn có thể thảo luận chi tiết với chúng tôi trên Discord.
Phương thức Solana RPC và tài liệu
Để xem danh sách đầy đủ các phương thức, tham số, và đặc tả subscription, vui lòng tham khảo tài liệu chính thức. Nó bao gồm cả HTTP và WebSocket.