Alchemy SDK Quickstart
The easiest way to connect your dApp to the blockchain and get the power of Alchemy’s infrastructure. Just download, write two lines of code, and go.
The Alchemy SDK is the most comprehensive, stable, and powerful Javascript SDK available today to interact with the blockchain.
It supports the exact same syntax and functionality of the Ethers.js AlchemyProvider and WebSocketProvider, making it a 1:1 mapping for anyone using the Ethers.js Provider. However, it adds a significant amount of improved functionality on top of Ethers, such as easy access to Alchemy’s Enhanced and NFT APIs, robust WebSockets, and quality-of life improvements such as automated retries.
The SDK leverages Alchemy’s hardened node infrastructure, guaranteeing best-in-class node reliability, scalability, and data correctness, and is undergoing active development by Alchemy’s engineers.
Getting started
Check out the full Github repo here:
GitHub - alchemyplatform/alchemy-sdk-js: The easiest way to connect your dApp to the blockchain.
1. Install the SDK:
2. After installing the app, you can then import and use the SDK:
The public “demo” API key may be rate limited based on traffic. To create your own API key, sign up for an Alchemy account here and use the key created on your dashboard for the first app.
The Alchemy
object returned by new Alchemy()
provides access to the Alchemy API. An optional config object can be passed in when initializing to set your API key, change the network, or specify the max number of retries.
3. Make requests using the Alchemy SDK:
The Alchemy SDK currently supports five different namespaces, including:
core
: All commonly-used Ethers.js Provider methods and Alchemy Enhanced API methodsnft
: All Alchemy NFT API methodsws
: All WebSockets methodstransact
: All Alchemy Transaction API methodsnotify
: CRUD endpoints for modifying Alchemy Notify Webhooks
If you are already using Ethers.js, you should be simply able to replace the Ethers.js Provider object with alchemy.core
and it should just work.
The Alchemy SDK also supports a number of Ethers.js objects that streamline the development process:
Utils
: Equivalent toethers.utils
, this provides a number of common Ethers.js utility methods for developers.Contract
: An abstraction for smart contract code deployed to the blockchain.ContractFactory
: Allows developers to build aContract
object.Wallet
: An implementation ofSigner
that can sign transactions and messages using a private key as a standard Externally Owned Account.
Alchemy SDK Example Requests
Getting the NFTs owned by an address
Getting all the owners of the BAYC NFT
Get all outbound transfers to a provided address
Questions & Feedback
We’d love your thoughts on what would improve your web3 dev process the most! If you have 5 minutes, tell us what you want at our Feature Request feedback form and we’d love to build it for you:
If you have any questions, issues, or feedback, please file an issue on GitHub, or drop us a message on our Discord channel for the SDK.
This guide provides you with the code examples to get started with all of the Alchemy SDK. Check out our Web3 Tutorials Overview to learn more about building with Alchemy.