While this TypeScript guide demonstrates Yellowstone gRPC integration, we strongly recommend using Rust or Go for production environments processing high-volume transaction streams.
Node.js's single-threaded runtime can struggle with the high data throughput that Solana/Yellowstone gRPC can deliver, potentially causing slow subscriber issues and memory pressure. Compiled languages like Rust and Go offer significantly better performance for processing large volumes of streaming data.
If you're building systems that need to process all transactions from busy programs or track multiple programs simultaneously, consider implementing your solution in a compiled language instead.
Check out our Rust Documentation or Go Documentation for a high-performance alternative.
Overview
TypeScript is a strongly-typed superset of JavaScript, offering improved developer experience and tooling support. This document provides a step-by-step process for setting up a TypeScript environment for interacting with Yellowstone gRPC, including setting up a project, configuring dependencies, and implementing authentication mechanisms.
Authentication Required for TypeScript
Creates a client in order to communicate with a Yellowstone plugin. It uses an endpoint URL and an authentication token for secure access.
import { Client } from '@rpcpool/yellowstone-grpc';
// For HTTP Provider URL: https://example-guide-demo.solana-mainnet.quiknode.pro/123456789/
const ENDPOINT = 'https://example-guide-demo.solana-mainnet.quiknode.pro:10000';
const TOKEN = '123456789';
const client = new Client(ENDPOINT, TOKEN, {});
To learn how to split your Solana Yellowstone enabled URL into endpoint
and token
, refer to this section - Endpoint and Token Configuration
Setting up TypeScript
To run our TypeScript code examples, you'll need to have Node.js installed, as TypeScript is built on top of JavaScript. Ensure you also have TypeScript installed globally by running:
npm install -g typescript
Install Yellowstone gRPC Node Package
npm install @triton-one/yellowstone-grpc
Additional Resources
For more information about working with Yellowstone and the Geyser Plugin in TypeScript, refer to the Yellowstone TypeScript Guide. This guide provides an in-depth overview of setting up gRPC endpoints, managing authentication tokens, and understanding key concepts like commitment levels.
We ❤️ Feedback!
If you have any feedback or questions about this documentation, let us know. We'd love to hear from you!