Tài liệu API thông tin Leader Slot
API thông tin Leader Slot (getLeaderSlots) là gì?
getLeaderSlots là một phương thức Solana RPC mở rộng lấy thông tin lịch trình validator leader từ mạng.
Nếu bạn có credit sử dụng ERPC (API token), bạn có thể sử dụng nó cùng định dạng như một cuộc gọi Solana RPC tiêu chuẩn.API này cung cấp thông tin sau:
- Lịch trình validator leader bắt đầu từ slot được chỉ định
- Khu vực và vị trí địa lý ước tính của mỗi leader
- Số liệu ping tham chiếu (
pingToLeaders)
Endpoint và ví dụ Request Body
text
https://edge.erpc.global?api-key=<YOUR_API_KEY>https://edge.erpc.global?api-key=<YOUR_API_KEY>Chỉ định số slot bắt đầu trong
params.json
{
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSlots",
"params": [368488568]
}{
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSlots",
"params": [368488568]
}Ví dụ (HTTP)
bash
curl https://edge.erpc.global?api-key=<YOUR_API_KEY> \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"id":1,
"method":"getLeaderSlots",
"params":[368488568]
}'curl https://edge.erpc.global?api-key=<YOUR_API_KEY> \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"id":1,
"method":"getLeaderSlots",
"params":[368488568]
}'Ví dụ Response (JSON)
json
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"identity": "DTSUKYHde29PHLy2fBLarsbDdPHQuhZmvjRVuJ2QRC8",
"epoch": 852,
"slot": 368488631,
"ipAddress": "198.73.56.215",
"gossipPort": 8000,
"tpuPort": 8003,
"tpuQuicPort": 8009,
"rpcAddress": null,
"version": "0.708.20306",
"featureSet": "3640012085",
"pingToLeaders": [
{
"city": "Amsterdam",
"region": "North Holland",
"ms": 7.687,
"fromIp": "185.191.118.11",
"country": "NL",
"lat": 52.374,
"lon": 4.8897,
"org": "AS5552 Serverside.com",
"postal": "1012",
"timezone": "Europe/Amsterdam"
}
]
},
{
"identity": "HyperSPG8w4jgdHgmA8ExrhRLL1LBRirRTHDU9FdXJUud",
"epoch": 852,
"slot": 368488632,
"ipAddress": "216.238.85.198",
"gossipPort": 8001,
"tpuPort": 9001,
"tpuQuicPort": 9007,
"rpcAddress": null,
"version": "0.708.20306",
"featureSet": "3640012085",
"pingToLeaders": [
{
"city": "General Lázaro Cárdenas",
"region": "Querétaro",
"ms": 136.96,
"fromIp": "185.191.118.11",
"country": "MX",
"lat": 20.5619,
"lon": -100.2449,
"org": "AS42473 The Constant Company, LLC",
"postal": "76264",
"timezone": "America/Mexico_City"
}
]
},
{
"identity": "HyperSPG8w4jgdHgmA8ExrhRLL1LBRirRTHDU9FdXJUud",
"epoch": 852,
"slot": 368488633,
"ipAddress": "216.238.85.198",
"gossipPort": 8001,
"tpuPort": 9001,
"tpuQuicPort": 9007,
"rpcAddress": null,
"version": "0.708.20306",
"featureSet": "3640012085",
"pingToLeaders": [
{
"city": "General Lázaro Cárdenas",
"region": "Querétaro",
"ms": 136.92,
"fromIp": "185.191.118.11",
"country": "MX",
"lat": 20.5619,
"lon": -100.2449,
"org": "AS42473 The Constant Company, LLC",
"postal": "76264",
"timezone": "America/Mexico_City"
}
]
}
]
}{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"identity": "DTSUKYHde29PHLy2fBLarsbDdPHQuhZmvjRVuJ2QRC8",
"epoch": 852,
"slot": 368488631,
"ipAddress": "198.73.56.215",
"gossipPort": 8000,
"tpuPort": 8003,
"tpuQuicPort": 8009,
"rpcAddress": null,
"version": "0.708.20306",
"featureSet": "3640012085",
"pingToLeaders": [
{
"city": "Amsterdam",
"region": "North Holland",
"ms": 7.687,
"fromIp": "185.191.118.11",
"country": "NL",
"lat": 52.374,
"lon": 4.8897,
"org": "AS5552 Serverside.com",
"postal": "1012",
"timezone": "Europe/Amsterdam"
}
]
},
{
"identity": "HyperSPG8w4jgdHgmA8ExrhRLL1LBRirRTHDU9FdXJUud",
"epoch": 852,
"slot": 368488632,
"ipAddress": "216.238.85.198",
"gossipPort": 8001,
"tpuPort": 9001,
"tpuQuicPort": 9007,
"rpcAddress": null,
"version": "0.708.20306",
"featureSet": "3640012085",
"pingToLeaders": [
{
"city": "General Lázaro Cárdenas",
"region": "Querétaro",
"ms": 136.96,
"fromIp": "185.191.118.11",
"country": "MX",
"lat": 20.5619,
"lon": -100.2449,
"org": "AS42473 The Constant Company, LLC",
"postal": "76264",
"timezone": "America/Mexico_City"
}
]
},
{
"identity": "HyperSPG8w4jgdHgmA8ExrhRLL1LBRirRTHDU9FdXJUud",
"epoch": 852,
"slot": 368488633,
"ipAddress": "216.238.85.198",
"gossipPort": 8001,
"tpuPort": 9001,
"tpuQuicPort": 9007,
"rpcAddress": null,
"version": "0.708.20306",
"featureSet": "3640012085",
"pingToLeaders": [
{
"city": "General Lázaro Cárdenas",
"region": "Querétaro",
"ms": 136.92,
"fromIp": "185.191.118.11",
"country": "MX",
"lat": 20.5619,
"lon": -100.2449,
"org": "AS42473 The Constant Company, LLC",
"postal": "76264",
"timezone": "America/Mexico_City"
}
]
}
]
}Sử dụng Token
Lấy 100 bản ghi leader slot bắt đầu từ slot được chỉ định.
Mỗi request tiêu tốn 420 token.
Tại sao thông tin Leader Slot quan trọng
- Khi leader ở xa về mặt địa lý (ví dụ: >100 ms), việc gửi transaction trực tiếp trở nên không hiệu quả.
- Trong quá trình chuyển đổi leader liên lục địa (ví dụ: FRA → NY), chiến lược chuyển đổi khu vực rất quan trọng.
- Kết hợp lịch trình slot với dữ liệu ping đo được cho phép tối ưu hóa định tuyến và vị trí validator.
Bối cảnh
Một epoch Solana bao gồm khoảng 432.000 slot.
Liên tục ping tất cả validator, lưu trữ, và tổng hợp dữ liệu đòi hỏi hạ tầng chi phí cao.
ERPC tự động hóa quy trình này và cung cấp bản đồ leader slot sẵn sàng sử dụng ngay như một dịch vụ.
Trường hợp sử dụng chiến lược
- Tối ưu phát hiện: Ưu tiên gửi transaction đến leader gần (độ trễ thấp)
- Triển khai đa khu vực: Triển khai ở FRA, NY, TY, v.v., để giảm thiểu khoảng cách chuyển đổi slot
- Trực quan hóa và phân tích: Giám sát tỷ lệ leader và phân bổ độ trễ theo khu vực
Khả dụng
getLeaderSlots khả dụng cho tất cả người dùng ERPC.
API token (credit sử dụng) có thể được phát hành hoặc xác minh trên Discord của Validators DAO.- Discord: https://discord.gg/C7ZQSrCkYR
Tỷ lệ thành công transaction và SWQoS Endpoint
Để cải thiện thêm tỷ lệ thành công và tốc độ thực thi transaction,
chúng tôi khuyến nghị sử dụng SWQoS Endpoint.
SWQoS (Stake-weighted Quality of Service) ưu tiên validator có kết nối stake.
Leader phân bổ khoảng 80% băng thông cho lưu lượng ưu tiên và 20% cho không ưu tiên,
với làn ưu tiên cung cấp khoảng gấp 5 lần thông lượng.
Lập lịch này diễn ra trước khi đánh giá Priority-fee,
nghĩa là vào được làn ưu tiên SWQoS là điều kiện tiên quyết cho hiệu suất độ trễ thấp thực sự.