Skip to content
Alchemy Logo

Arc API Quickstart

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

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

Arc is an open Layer 1 blockchain by Circle, purpose-built for stablecoin finance, featuring USDC as the native gas token, sub-second finality, and direct integration with Circle's platform for secure access to liquidity and developer tooling.

The Arc API allows interaction with the Arc network through a set of JSON-RPC methods. Its design is familiar to developers who have worked with Ethereum's JSON-RPC APIs, making it intuitive and straightforward to use.

Select a package manager to manage your project's dependencies. Choose between npm and yarn based on your preference or project requirements.

# Begin with npm by following the npm documentation
# https://docs.npmjs.com/downloading-and-installing-node-js-and-npm

Open your terminal and execute the following commands to create and initialize your project:

mkdir arc-api-quickstart
cd arc-api-quickstart
npm init --yes

This creates a new directory named arc-api-quickstart and initializes a Node.js project within it.

Install Axios, a popular HTTP client, to make API requests:

npm install axios

Create an index.js file in your project directory and paste the following code:

const axios = require('axios');
 
const url = 'https://arc-testnet.g.alchemy.com/v2/your-api-key';
 
const payload = {
  jsonrpc: '2.0',
  id: 1,
  method: 'eth_blockNumber',
  params: []
};
 
axios.post(url, payload)
  .then(response => {
    console.log('Latest Block:', response.data.result);
  })
  .catch(error => {
    console.error(error);
  });

Remember to replace your-api-key with your actual Alchemy API key that you can get from your Alchemy dashboard.

Execute your script to make a request to the Arc network:

node index.js

You should see the latest block information from Arc's network outputted to your console:

Latest Block: 0x...

Congratulations! You've made your first request to the Arc network. You can now explore the various JSON-RPC methods available on Arc and start building your dApps on this innovative platform.

Was this page helpful?