ping gRPC Method - Yellowstone
Please note that this RPC method requires the Yellowstone gRPC add-on enabled on your QuickNode endpoint.
Parameters
This method does not accept any parameters
Returns
status
integer
Loading...
Request
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"time"
pb "yellowstone/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/encoding/gzip"
"google.golang.org/grpc/keepalive"
)
// QuickNode endpoints consist of two crucial components: the endpoint name and the corresponding token
// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde123456789
// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:10000 {10000 is the port number for gRPC}
// token will be : abcde123456789
var (
endpoint = "YOUR_QN_ENDPOINT:10000"
token = "YOUR_TOKEN_NUMBER"
)
func main() {
opts := []grpc.DialOption{
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
grpc.WithKeepaliveParams(kacp),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),
grpc.WithPerRPCCredentials(tokenAuth{token: token}),
}
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
log.Fatalf("Failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewGeyserClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
pingResponse, err := client.Ping(ctx, &pb.PingRequest{})
if err != nil {
log.Fatalf("Failed to get Ping: %v", err)
}
fmt.Printf(" Ping Response: %+v\n", pingResponse)
}import Client, {
CommitmentLevel,
SubscribeRequest,
SubscribeRequestFilterAccountsFilter,
} from "@triton-one/yellowstone-grpc";
// QuickNode endpoints consist of two crucial components: the endpoint name and the corresponding token
// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde123456789
// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:10000 {10000 is the port number for gRPC}
// token will be : abcde123456789
const ENDPOINT = "YOUR_QN_ENDPOINT:10000";
const TOKEN = "YOUR_TOKEN_NUMBER";
async function main() {
const client = new Client(ENDPOINT, TOKEN, {});
const response = await client.ping(1);
console.log(`Response: ${response}`);
}
main()
.catch((err) => {
console.error(err);
process.exit(1);
})Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free