Alchemy API

Enterprise Grade API for Ethereum

Jumpstart your Ethereum development with Alchemy!
Instead of running your own nodes and building your own architecture,
just plug into our API and get back to focusing on developing
your application.

Get Started

Getting Started

Quick start guide to Alchemy: fast, reliable, and scalable tools built for blockchain developers

Introduction to Alchemy: fast, reliable, and scalable tools built for blockchain developers

Alchemy products and features

Alchemy has a full suite of products built to accelerate blockchain development. Our tools make it easier for blockchain developers to focus on their applications and users, rather than blockchain interfacing.

Alchemy's full line of products continues to grow, but includes:

1. Ethereum infrastructure provider: we provide a blockchain gateway that you can use the same way you'd use your own node (plus Alchemy is extremely fast, reliable, and scalable)

2. Developer API: we built new methods around the standard JSON-RPC API

3. Developer tools: we built tools to help developers debug, see request logs from backend and frontend, and view aggregate metrics

4. Monitoring/Alerts: we built real-time monitoring and alert tools to help developers catch bugs and deliver a seamless experience to users

5. User Analytics: we built an analytics platform to track user activity and product trends

6. Apps/Games: we provide and support public APIs so developers can build on top of your app/game

How to get started with Alchemy

1. Create an Alchemy key
2. Make a request
3. Set up Alchemy as your client
a. Switch to Alchemy for existing project
b. Create new projects with Alchemy

1. Create an Alchemy key

To use Alchemy's products, you need an API key to authenticate your requests.

You can create API keys from the dashboard. To make a new key, navigate to "Create App". Fill in details and get your new keys. You can see apps you previously made and those made by your team here. Pull existing keys by clicking on "View Key" for any app.

You can also pull existing API keys by hovering over "Apps" and selecting one. You can "View Key" here, as well as "Edit App" to whitelist specific domains, see several developer tools, and view analytics.

If you do not have access to Alchemy, send a message to [email protected] and we can get an account created for you!

2. Make a request

Interact with Alchemy's Ethereum infrastructure provider using JSON-RPC shell scripts.

For manual requests, we recommend interacting with the JSON-RPC via POST requests. Simply pass in the Content-Type: application/json header and your query as the POST body with the following fields:

  • jsonrpc: The JSON-RPC version—currently, only 2.0 is supported.
  • method: The ETH API method. See API reference.
  • params: A list of parameters to pass to the method.
  • id: The ID of your request. Will be returned by the response so you can keep track of which request a response belongs to.

Here is an example you can run in the command line:

curl https://eth-mainnet.alchemyapi.io/jsonrpc/demo \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'

Results:

{ "id": 73,
  "jsonrpc": "2.0",
  "result": "0x09184e72a000" // 10000000000000 }

3a. Switch provider to Alchemy using existing scripts

If you have existing scripts, change your node provider to an Alchemy URL with your API key.

Go Ethereum implementation: If you are running your own local node using Go, you can change your host from:

geth attach rpc:http://host:8545

to Alchemy's infrastructure:

geth --rpc --rpccorsdomain https://eth-mainnet.alchemyapi.io/jsonrpc/demo

JavaScript implementation: If you are running your own local node using Web3 in JavaScript, simply change your Provider from your local address like "http://localhost:8545" to the Alchemy URL "https://eth-mainnet.alchemyapi.io/jsonrpc/demo" but swap out demo for your API key.

For example, if you are using a locally hosted node, you might have in your script:

// Import the Web3 library at the top of your file
const Web3 = require('web3');

// ... (the rest of your code)

// Connect to the network and save it as "web3" using your local node as provider
const web3 = new Web3("http://localhost:8545");

Swap to:

// Import the Web3 library at the top of your file
const Web3 = require('web3');

// ... (the rest of your code)

// Connect to the network and save it as "web3" using Alchemy as your provider
const web3 = new Web3("https://eth-mainnet.alchemyapi.io/jsonrpc/demo");

In short, replace the path to your existing provider with "https://eth-mainnet.alchemyapi.io/jsonrpc/demo".

3b. Create a new project with AlchemyWeb3.js as the client

Alchemy Web3

We recommend using AlchemyWeb3.js for an enhanced Web3 JavaScript library, which we built as an extended version of web3.js that also includes Alchemy enhanced API. For more information, please refer to Alchemy Web3 repository.

Before you install, make sure you are in the desired directory as AlchemyWeb3.js will install in the current directory.

To install AlchemyWeb3.js, run in the command line:

With Yarn:

yarn add @alch/alchemy-web3

With NPM:

npm install @alch/alchemy-web3

To interact with Alchemy's node infrastructure, run in NodeJS or other JavaScript environment:

import { createAlchemyWeb3 } from "@alch/alchemy-web3";
const web3 = createAlchemyWeb3("https://eth-mainnet.alchemyapi.io/jsonrpc/demo",);

Now try running a Web3 request:

web3.eth.getBlockNumber().then(console.log);

Results:

> web3.eth.getBlockNumber().then(console.log);
Promise { <pending> }
> 8079923

Other Options:

Web3

You may use other instantiations of the Web3 client and use the Alchemy URL of your choosing with a one-line configuration change.

These scripts need to be run in a node context or saved in a file, not run from the command line.

// JavaScript: web3.js
// You would need to install web3.js first with "npm install web3"
const Web3 = require('web3');
const web3 = new Web3("https://eth-mainnet.alchemyapi.io/jsonrpc/your-api-key");
// Python: web3.py
web3 = Web3(Web3.HTTPProvider("https://eth-mainnet.alchemyapi.io/jsonrpc/your-api-key"));
// Java: web3j
Web3j web3 = Web3j.build(new HttpService("https://eth-mainnet.alchemyapi.io/jsonrpc/your-api-key"));

Ethers.js

Simply replace your provider with a JSON-RPC provider pointing to Alchemy.

// Ethers.js
const url = "https://eth-mainnet.alchemyapi.io/json/your-api-key";
const customHttpProvider = new ethers.providers.JsonRpcProvider(url);

See the official documentation for quick start guides and more information:

Questions or comments

Alchemy is here for you! Reach out to the Alchemy team with any questions or feedback at [email protected].

Updated 24 days ago

Getting Started


Quick start guide to Alchemy: fast, reliable, and scalable tools built for blockchain developers

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.