Solana API Quickstart

Quickstart guide for building on Solana

How to get access to Alchemy's Solana API?

Create a free account to start using Alchemy's Solana API today!

Getting Started with the Solana API

  1. Get access to your Solana API key! During our beta roll-out, we'll email you an API key that you can use
  2. Download solana-web3.js
  3. Configure solana-web3.js to use Alchemy:
const solanaWeb3 = require('@solana/web3.js');

const establishConnection = async () =>{
 rpc="https://solana-mainnet.g.alchemy.com/v2/<API-KEY>";
 connection = new solanaWeb3.Connection(rpc, 'confirmed');
 console.log('Cluster Connected:', connection);
}

establishConnection();

Now, you can use solana-web3.js normally!

What is the Solana API?

The Solana API allows decentralized applications to connect to a Solana node that is part of the Solana blockchain. Developers can interact with on-chain data, send transactions, and deploy contracts by leveraging Alchemy's API endpoints. The API follows a JSON-RPC standard, a lightweight, remote procedure call (RPC) protocol that is commonly used when interacting with blockchain data.

Types of Requests in the Solana API

Getting Blocks

Retrieves information from a particular block in the blockchain.

Account Information

Returns information regarding an address's stored on-chain data.

Node Information

Returns information regarding node configurations.

Network Inflation Information

Returns inflation/staking information for the Solana blockchain.

Network Information

Returns aggregate network information.

Transaction Information

Handles transaction-based Solana interactions

Slot Information

Returns slot (the period of time for which each leader ingests transactions and produces a block) information

Token Information

Returns balance/account information

(In-Progress) Methods

  • getTokenLargestAccounts
  • getTokenAccountsByDelegate

Supported Websocket Subscriptions:

📘

Note

At the moment, ONLY finalized commitments are supported for WebSocket streams.

(In-Progress) Websocket Subscriptions

  • accountSubscribe
  • accountUnsubscribe
  • logsSubscribe
  • logsUnsubscribe
  • programSubscribe
  • programUnsubscribe
  • slotsUpdatesSubscribe
  • slotsUpdatesUnsubscribe
  • rootSubscribe
  • rootUnsubscribe
  • voteSubscribe
  • subscribe