Address
304 North Cardinal St.
Dorchester Center, MA 02124

Work Hours
Monday to Friday: 7AM - 7PM
Weekend: 10AM - 5PM

Getting Started with the Alchemy Solana API Toolkit

Web3 development platform Alchemy has launched the Alchemy Solana API Toolkit, a suite of development tools for the Solana blockchain. 

Currently, Alchemy’s core offering is an Ethereum-based node infrastructure, but they have expanded their services for other blockchains such as Flow and Polygon, and now Solana.

We’re really excited that Alchemy will now support Solana. Their launch will give developers greater access to high-quality Solana infrastructure and tooling. 

Raj Gokal, Co-Founder of Solana

Some of the biggest DeFi and NFT projects like 0x, Aave, dYdX, OpenSea, Nifty Gateway, and SuperRare use Alchemy’s offering Supernode to connect to blockchains using a Remote Procedure Call (RPC). 

Supernode, is a distributed system that allows the API to act with the simplicity of a single node, with greater scalability and reliability. The node’s efficiency makes it a powerful choice for developers migrating their products to Web3.

Now, with the Alchemy Solana API, it will be easier than ever to capitalize on one of the fastest growing blockchains, and the high demand for Solana NFTs, games and DeFi apps where fast transactions and low fees are required.

Phantom, the leading Solana-based wallet, confirmed it will be integrating Alchemy. 

This will be a game changer for Phantom and any other Solana developers who choose to start using Alchemy.

Francesco Agosti, CTO and co-founder of Phantom

About Alchemy

Founded by two Stanford grads in 2020, Alchemy built a strong identity in the developer community by building tools that simplify common Web3 tasks like writing transactions and hosting nodes. According to Alchemy Product manager Michael Garland The platform has “tens of thousands” of developers, but he does not specify a number.

Alchemy raised over half a billion dollars in funding, and in February announced it had reached a valuation of $10.2 billion. 

The Alchemy Solana API Toolkit

The Solana kit beta version is now live for users to sign up and is being released in “gated beta”, meaning only certain vetted developers will be able to use it at first, but a company spokesperson said the Solana toolkit will be open to all developers in a matter of weeks.

Alchemy’s Solana endpoint supports most JSON-RPC Solana methods, including full archive data and in the coming weeks will provide Solana endpoints in areas such as DeFi, NFTs and wallet services.

Alchemy’s Solana API endpoints allow dApps to connect to a Solana node and interact with on-chain data, send transactions, and deploy contracts. The API follows a lightweight remote procedure call (JSON-RPC) protocol commonly used to interact with blockchain data.

The Solana API give you access to on-chain data including:

  • Blocks
  • Accounts
  • Nodes
  • Network
  • Staking
  • Transactions
  • Slots
  • Tokens

If you don’t need to make direct API calls, you have the option to configure Solana web3.js library to use your Alchemy custom endpoint URL: 

import * as web3 from '@solana/web3.js';

var connection = new web3.Connection(
    web3.clusterApiUrl('https://solana-mainnet.g.alchemy.com/v2/YOUR_API_KEY'),
    'confirmed',
);

To use the Alchemy Solana API you need to create an “app” in your Alchemy dashboard. You can select devnet or mainnet-beta (For the examples here, I’ve used Devnet).

Alchemy create app dialog

You’ll need to create an API key which gives you an endpoint and Web Sockets URL. You can see these keys at any time in your Alchemy dashboard. Your API key is part of the endpoint URL, but you can whitelist by domain or IP address for added security.

alchemy app api keys

Your app will use a single endpoint, and you pass in the method and any required commands as the body of your request:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getAccountInfo",
    "params": [
        "DGa1B1Au59AD56agtFQLfsGaTmJ33z5abY1MSNaYoBgb",
        {
            "encoding": "base58"
        }
    ]
}

Alchemy’s platform is an end-to-end platform, including a full suite of monitoring and visualization tools in your app dashboard:

Alchemy dashboard

API Documentation

The documentation is good, but it’s new and you may bump into a few issues. For example, the documentation provided for getBalance is:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBalance",
    "params": 
    [
        "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
    ]
}

However, when you make this call you get the following error:

“Invalid params: missing field commitment”

By digging through some of the other calls I was able to find an example for including “commitment”: “processed” as a parameter.

Get Started

Alchemy’s Ethereum API provides robust support for querying NFT data and other APIs, but this is planned for upcoming releases of the Solana API and not available initially.

Alchemy’s mission is to empower Web3 and Solana developers to build the next generation of blockchain apps by making it easier to build and scale applications.

Sign up for early access to the Solana API.

Solana on Alchemy Announcement

Documentation

Leave a Reply