Ethereum API Quickstart

How to get started building on Ethereum and using the JSON-RPC API

To use the Ethereum API you'll need to create a free Alchemy account first!

What is the Ethereum API?

The Ethereum API allows applications to connect to an Ethereum node that is part of the Ethereum blockchain. Developers can interact with on-chain data and send different types of transactions to the network by utilizing the endpoints provided by the API. The API follows a JSON-RPC standard. JSON-RPC is a stateless, lightweight, remote procedure call (RPC) protocol that is commonly used when interacting with Ethereum.

Getting Started Instructions

1. Choose a package manager (npm or yarn)

For this guide, we will be using npm or yarn as our package manager to install either alchemy-sdk or any other packages.


To get started with npm, follow the documentation to install Node.js and npm for your operating system:


To get started with yarn, follow these steps:

2. Set up your project (npm or yarn)

mkdir alchemy-ethereum-api
cd alchemy-ethereum-api
npm init --yes
mkdir alchemy-ethereum-api
cd alchemy-ethereum-api
yarn init --yes

3. Install Alchemy-SDK

Run the following command to install the Alchemy SDK with npm and yarn

npm install alchemy-sdk
yarn add alchemy-sdk

4. Make your first request

You are all set now to use Ethereum API and make your first request. For instance, lets make a request to get latest block. Go to index.js and paste the following code snippet into the file.

// Setup: npm install @alch/alchemy-sdk
const { Network, Alchemy } = require("alchemy-sdk");

// Optional Config object, but defaults to demo api-key and eth-mainnet.
const settings = {
  apiKey: "demo", // Replace with your Alchemy API Key.
  network: Network.ETH_MAINNET, // Replace with your network.

const alchemy = new Alchemy(settings);

async function main() {
  const latestBlock = await alchemy.core.getBlockNumber();
  console.log("The latest block number is", latestBlock);


5. Run script

To run the above node script, use cmd node index.js, and you should see the output.

The latest block number is 11043912

You must not stop here! Want to build your first Dapp and use Ethereum APIs?
Head towards Alchemy Tutorials.

For full documentation on the available endpoints for alchemy-sdk, check the github repo: