SDKs overview

Thunderbit offers Software Development Kits (SDKs) and client libraries designed to simplify interaction with its Solana infrastructure. These tools abstract away the complexities of direct HTTP requests to the Thunderbit API, providing idiomatic interfaces for various programming languages. Developers can utilize these SDKs to integrate Thunderbit's core services, including Solana RPC access, transaction history retrieval, and webhook management, directly into their decentralized applications (dApps) and backend services. The primary goal of these SDKs is to accelerate development cycles and reduce the boilerplate code required for common Solana-related operations. Thunderbit's developer experience emphasizes comprehensive documentation and diverse language support to cater to a broad range of development environments, as detailed in the Thunderbit developer documentation.

The SDKs are maintained to provide stable and efficient access to Thunderbit's Solana RPC endpoints, which support both standard Solana RPC methods and custom API extensions. This allows developers to perform operations such as fetching account information, simulating transactions, and subscribing to real-time updates without managing raw JSON-RPC requests. The libraries also facilitate access to historical transaction data, which is crucial for analytics, auditing, and building user interfaces that display past activity. Furthermore, integration with Thunderbit's webhook system enables event-driven architectures, notifying applications of specific on-chain events or transaction confirmations without continuous polling.

Official SDKs by language

Thunderbit provides official SDKs for several popular programming languages, ensuring robust and well-supported integration pathways. These SDKs are developed and maintained by Thunderbit, offering consistent functionality and adherence to the platform's API specifications. Each official SDK aims to provide a native-like experience for its respective language, adhering to common coding conventions and best practices. This approach helps developers quickly onboard and build applications that leverage Thunderbit's Solana services efficiently. The official SDKs are designed for reliability and performance, critical for high-throughput Solana applications.

Below is a table summarizing the official SDKs, including their package names, typical installation commands, and maturity status. Developers can find detailed usage instructions and API references for each SDK within the Thunderbit API reference.

Language Package Name Installation Command Maturity
TypeScript/JavaScript @thunderbit/solana-sdk npm install @thunderbit/solana-sdk or yarn add @thunderbit/solana-sdk Stable
Python thunderbit-solana pip install thunderbit-solana Stable
Go github.com/thunderbit/go-solana-sdk go get github.com/thunderbit/go-solana-sdk Stable
Rust thunderbit-solana-rust Add to Cargo.toml: thunderbit-solana-rust = "^0.1.0" Beta

These SDKs are regularly updated to reflect new features and improvements in the Thunderbit platform and the Solana blockchain itself. Developers are encouraged to refer to the specific documentation for each language's SDK to ensure they are using the latest versions and best practices. For example, the TypeScript SDK provides strong typing for Solana RPC responses, which enhances developer productivity and reduces common errors in JavaScript environments, as described in the MDN Web Docs on TypeScript.

Installation

Installation of Thunderbit's official SDKs typically follows the standard package management practices for each respective programming language. The process is designed to be straightforward, allowing developers to quickly integrate the libraries into their existing projects.

TypeScript/JavaScript

For Node.js projects or front-end applications using npm or Yarn:

npm install @thunderbit/solana-sdk
# or
yarn add @thunderbit/solana-sdk

After installation, you can import the necessary modules into your JavaScript or TypeScript files:

import { ThunderbitSolana } from '@thunderbit/solana-sdk';

const thunderbitClient = new ThunderbitSolana({ apiKey: 'YOUR_API_KEY' });

Python

For Python projects, the SDK can be installed using pip:

pip install thunderbit-solana

To use the SDK in your Python code:

from thunderbit_solana import ThunderbitSolanaClient

client = ThunderbitSolanaClient(api_key="YOUR_API_KEY")

Go

Go modules are used for managing dependencies. Install the Go SDK:

go get github.com/thunderbit/go-solana-sdk

Then, import and use it in your Go application:

package main

import (
    "fmt"
    "log"
    "github.com/thunderbit/go-solana-sdk/pkg/thunderbit"
)

func main() {
    client := thunderbit.NewClient("YOUR_API_KEY")
    // Use client methods
    fmt.Println("Thunderbit Go client initialized.")
}

Rust

For Rust projects, add the SDK to your Cargo.toml file:

[dependencies]
thunderbit-solana-rust = "^0.1.0"

Then, use it in your Rust code:

use thunderbit_solana_rust::ThunderbitClient;

fn main() {
    let client = ThunderbitClient::new("YOUR_API_KEY");
    // Use client methods
    println!("Thunderbit Rust client initialized.");
}

Detailed setup instructions and environment configuration tips are available within the Thunderbit Getting Started guide, which also covers obtaining an API key.

Quickstart example

This quickstart example demonstrates how to use the Thunderbit TypeScript/JavaScript SDK to fetch the latest blockhash from the Solana blockchain. This is a common operation for initiating transactions or verifying network liveness.

First, ensure you have installed the SDK as described in the installation section:

npm install @thunderbit/solana-sdk

Next, create a new file (e.g., get-blockhash.ts) and add the following code. Replace 'YOUR_API_KEY' with your actual Thunderbit API key, which can be generated from your Thunderbit account dashboard.

import { ThunderbitSolana } from '@thunderbit/solana-sdk';

async function getLatestBlockhash() {
  const thunderbitClient = new ThunderbitSolana({
    apiKey: 'YOUR_API_KEY', // Replace with your Thunderbit API key
  });

  try {
    console.log('Fetching latest blockhash...');
    const response = await thunderbitClient.rpc.getLatestBlockhash();

    if (response && response.result) {
      console.log('Latest blockhash:', response.result.blockhash);
      console.log('Last valid block height:', response.result.lastValidBlockHeight);
    } else {
      console.error('Failed to retrieve blockhash:', response);
    }
  } catch (error) {
    console.error('Error fetching blockhash:', error);
  }
}

getLatestBlockhash();

To execute this script, compile and run it (if using TypeScript) or run directly with Node.js:

# If using TypeScript, first compile:
tsc get-blockhash.ts
node get-blockhash.js

# Or, if using ts-node for direct execution:
ts-node get-blockhash.ts

This example initializes the Thunderbit client and then calls the getLatestBlockhash method, which corresponds to the Solana getLatestBlockhash RPC method. The output will display the current blockhash and the last valid block height, confirming successful communication with the Thunderbit Solana RPC endpoint. This basic interaction can be extended to perform more complex operations like sending transactions, querying account balances, or subscribing to account changes, all facilitated by the SDK.

Community libraries

While Thunderbit provides official SDKs, the broader Solana ecosystem benefits from a vibrant community of developers who contribute open-source libraries and tools. These community-driven projects can offer alternative interfaces, specialized functionalities, or support for additional programming languages not officially covered by Thunderbit. These libraries often wrap the core Solana RPC methods, similar to official SDKs, but may also integrate with other Solana development tools or frameworks. Developers frequently explore community options for specific use cases or preferred tech stacks.

When considering community libraries, it is important to evaluate their maintenance status, documentation quality, and community support. Unlike official SDKs, community projects may have varying levels of stability and may not always be up-to-date with the latest Thunderbit API changes or Solana protocol updates. However, they can sometimes provide innovative solutions or fill niche requirements. Some popular community-driven tools in the Solana ecosystem, which could potentially be used in conjunction with Thunderbit's RPC endpoints, include:

  • Solana Web3.js: The foundational JavaScript library for interacting with the Solana blockchain (Solana Web3.js documentation). Many community libraries build upon or interact with this core library.
  • Anchor: A framework for Solana Sealevel programs (smart contracts) development, often used with client-side libraries for dApp interactions (Anchor Framework documentation).
  • Rust-based Solana crates: Various crates in the Rust ecosystem provide low-level Solana interactions, which can be used to build custom clients that connect to Thunderbit RPCs. For example, solana_sdk and solana_client are core components for Rust developers.

Developers are encouraged to review the source code and community activity of any third-party library before integrating it into production systems. Thunderbit's RPC endpoints are compatible with any standard Solana client, allowing for flexibility in tool choice beyond the official SDKs. This interoperability ensures that developers can leverage the full spectrum of Solana development tools while benefiting from Thunderbit's reliable infrastructure. For example, many projects on GitHub demonstrate diverse approaches to integrating with Solana RPCs, showcasing the breadth of community contributions.