Solana API Overview

Overview of Alchemy methods for building on Solana
Don't have an API key?

Build faster with production-ready APIs, smart wallets and rollup infrastructure across 70+ chains. Create your free Alchemy API key and get started today.

Send Your First Request on Alchemy

Let’s use @solana/web3.js package to set up a Connection with Alchemy and get the latest slot on Solana!

npm install --save @solana/web3.js

Create Connection to Alchemy

1import { Connection } from "@solana/web3.js";
2
3const connection = new Connection(
4 "https://solana-devnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY",
5 "confirmed"
6);
7
8const slot = await connection.getSlot();
9console.log("Current slot:", slot);

Now that you’ve set up a connection to Alchemy, you can continue with some basics:

Create a Wallet

1import { Keypair } from "@solana/web3.js";
2
3const wallet = Keypair.generate();
4console.log("Public Key:", wallet.publicKey.toBase58());

Check Wallet Balance

1const balance = await connection.getBalance(wallet.publicKey);
2console.log("Balance:", balance / 1e9, "SOL");

Fetch Account Info

1const info = await connection.getAccountInfo(wallet.publicKey);
2console.log(info);

Find Solana Methods by Category

CU Calculator

Want to estimate your Solana Compute Units (CUs) before running transactions?
Try the CU Calculator now: Open CU Calculator →

Solana Tutorials

You must not stop here! Check out the following tutorials to learn how to build with Solana: