SDKs overview

Alchemy Ethereum provides various Software Development Kits (SDKs) and libraries designed to simplify interaction with the Ethereum blockchain and Alchemy's enhanced infrastructure. These SDKs abstract away the complexities of direct RPC calls, enabling developers to integrate features such as real-time transaction monitoring, NFT data access, and contract interaction with fewer lines of code. The offerings include officially supported SDKs for popular programming languages and a range of community-contributed libraries that extend functionality or provide specialized tools. The primary goal of these SDKs is to accelerate Web3 application development by offering reliable, performant, and developer-friendly interfaces to the Ethereum network via Alchemy's Supernode infrastructure.

Developers leverage these tools to build decentralized applications (dApps), manage digital assets, and access blockchain data efficiently. Alchemy's SDKs are designed to work seamlessly with its core products, including the Supernode for reliable RPC access, the NFT API for comprehensive NFT data, and the Enhanced API for advanced blockchain querying. For a comprehensive overview of the underlying API capabilities, refer to the Alchemy API reference documentation.

Official SDKs by language

Alchemy offers officially maintained SDKs for several programming languages, ensuring direct support and optimized performance when interacting with their platform. These SDKs are regularly updated to reflect new features and improvements in Alchemy's services and the broader Ethereum ecosystem. The official SDKs are the recommended approach for integrating Alchemy into new or existing projects due to their stability, comprehensive feature sets, and official support channels.

The table below outlines the key official SDKs, their respective package names, installation commands, and maturity status.

Language Package Name Installation Command Maturity
JavaScript / TypeScript alchemy-sdk npm install alchemy-sdk or yarn add alchemy-sdk Stable
Python alchemy-py pip install alchemy-py Stable
Go go-alchemy go get github.com/alchemyplatform/go-alchemy Stable

Installation

Installing Alchemy's SDKs typically involves using standard package managers specific to each programming language. Before installation, it is recommended to ensure your development environment has the necessary prerequisites, such as Node.js for JavaScript/TypeScript, Python for alchemy-py, or Go for go-alchemy. After installation, you will need an Alchemy API key to authenticate your requests. This key can be obtained by creating an Alchemy account and setting up an application via the Alchemy dashboard.

JavaScript / TypeScript (alchemy-sdk)

The alchemy-sdk provides a unified interface for interacting with various Alchemy APIs, including the Core Ethereum API, NFT API, and WebSockets for real-time events.

Installation:

npm install alchemy-sdk
# or
yarn add alchemy-sdk

Configuration:

import { Network, Alchemy } from "alchemy-sdk";

const settings = {
  apiKey: "YOUR_ALCHEMY_API_KEY", // Replace with your Alchemy API Key
  network: Network.ETH_MAINNET, // Replace with your network
};

const alchemy = new Alchemy(settings);

Python (alchemy-py)

The alchemy-py library offers Pythonic wrappers for Alchemy's APIs, simplifying blockchain interactions for Python developers.

Installation:

pip install alchemy-py

Configuration:

from alchemy import Alchemy, Network

alchemy = Alchemy(
    api_key="YOUR_ALCHEMY_API_KEY", # Replace with your Alchemy API Key
    network=Network.ETH_MAINNET,    # Replace with your network
)

Go (go-alchemy)

The go-alchemy library provides Go bindings for interacting with Alchemy's infrastructure, suitable for high-performance and concurrent applications.

Installation:

go get github.com/alchemyplatform/go-alchemy

Configuration:

package main

import (
	"fmt"
	"github.com/alchemyplatform/go-alchemy/alchemy"
)

func main() {
	client := alchemy.NewClient("YOUR_ALCHEMY_API_KEY", alchemy.NetworkMainnet)
	// Use client for API calls
	fmt.Println("Alchemy Go client initialized")
}

Quickstart example

This quickstart example demonstrates how to fetch the latest block number using the Alchemy JavaScript/TypeScript SDK. This basic operation verifies connectivity and proper configuration with the Alchemy API.

import { Network, Alchemy } from "alchemy-sdk";

// Configuration for the Alchemy SDK
const settings = {
  apiKey: "YOUR_ALCHEMY_API_KEY", // Replace with your Alchemy API Key
  network: Network.ETH_MAINNET,    // Use mainnet, or select another network like Network.ETH_GOERLI
};

// Create an Alchemy object with the settings
const alchemy = new Alchemy(settings);

async function getLatestBlockNumber() {
  try {
    // Get the latest block number
    const blockNumber = await alchemy.core.getBlockNumber();
    console.log("The latest block number is:", blockNumber);
  } catch (error) {
    console.error("Error fetching block number:", error);
  }
}

// Call the function to execute the API request
getLatestBlockNumber();

To run this example:

  1. Save the code as get-block.js.
  2. Replace "YOUR_ALCHEMY_API_KEY" with your actual Alchemy API key.
  3. Run from your terminal: node get-block.js.

The output will display the current latest block number on the Ethereum Mainnet, similar to: The latest block number is: 17345678.

Community libraries

Beyond the official SDKs, the broader Web3 ecosystem and developer community have contributed various libraries that enhance or complement Alchemy's services. These community-driven tools often provide specialized functionalities, integrations with other frameworks, or alternative language support. While not officially maintained by Alchemy, they can offer valuable resources for specific use cases.

  • Ethers.js: A complete and compact library for interacting with the Ethereum blockchain and its ecosystem. While not an Alchemy-specific SDK, it is widely used in conjunction with Alchemy's RPC endpoints for JavaScript/TypeScript development. Ethers.js focuses on client-side and server-side interactions, including wallet management, transaction signing, and contract interaction. For more details, consult the Ethers.js documentation.
  • Web3.js: Another foundational JavaScript library for interacting with an Ethereum node, often used with Alchemy's Supernode. Web3.js provides a broad range of functionalities for sending transactions, interacting with smart contracts, and managing accounts. It has been a long-standing tool in the Ethereum development landscape. The Web3.js website offers detailed guides.
  • Hardhat: A development environment for compiling, deploying, testing, and debugging Ethereum software. Hardhat can be configured to use Alchemy's RPC endpoints, providing a robust local development experience with access to Alchemy's infrastructure for deployment and testing on public networks. Developers can find extensive information in the Hardhat documentation.
  • Wagmi: A collection of React Hooks for Ethereum. Wagmi simplifies the process of connecting wallets, managing accounts, and interacting with contracts in React applications. It can be configured to use Alchemy as its RPC provider, streamlining the integration of Web3 features into front-end projects. The Wagmi React Hooks guide provides implementation details.
  • Foundry: A blazing fast, portable and modular toolkit for Ethereum application development written in Rust. Foundry includes tools like Forge for testing and interacting with smart contracts, and Cast for making RPC calls. It can readily integrate with Alchemy's endpoints for efficient contract development and testing. Explore the Foundry installation guide for setup instructions.

Developers should evaluate community libraries based on their specific project requirements, community support, and active maintenance status. While these tools offer flexibility and extended capabilities, they may not come with the same level of official support as Alchemy's dedicated SDKs.