> ## Documentation Index
> Fetch the complete documentation index at: https://docs.injective.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Alchemy RPC Setup

> Connect to Injective EVM mainnet and testnet via Alchemy JSON-RPC endpoints.

[Alchemy](https://www.alchemy.com/) provides reliable JSON-RPC endpoints for the Injective EVM. Use this guide to create an Alchemy app and start making requests.

[Injective + Alchemy quick start (1 min) - YouTube](https://youtube.com/embed/Ma3CIvDRSjk?rel=0\&autoplay=1\&cc_load_policy=0)

[*Injective + Alchemy quick start (1 min) - YouTube*](https://youtube.com/watch?v=Ma3CIvDRSjk)

## Prerequisites

* An Alchemy account ([sign up free](https://www.alchemy.com/))
* Basic familiarity with EVM RPC endpoints

## Steps

**1. Create an app**

From the [Alchemy dashboard](https://dashboard.alchemy.com/), create a new app and select **Injective** as the chain. Choose the network:

* **Injective EVM Mainnet**: Chain ID `1776`
* **Injective EVM Testnet**: Chain ID `1439`

**2. Copy your RPC endpoints**

Open your app and copy the HTTPS and WebSocket endpoints:

```bash Mainnet theme={null}
https://inj-mainnet.g.alchemy.com/v2/<YOUR_API_KEY>
wss://inj-mainnet.g.alchemy.com/v2/<YOUR_API_KEY>
```

```bash Testnet theme={null}
https://inj-testnet.g.alchemy.com/v2/<YOUR_API_KEY>
wss://inj-testnet.g.alchemy.com/v2/<YOUR_API_KEY>
```

> [!WARNING]
>
> Keep your API key private, treat it like a password.

**3. Start building**

Use the endpoint with your preferred library:

```ts ethers.js (v6) theme={null}
import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(
  "https://inj-mainnet.g.alchemy.com/v2/<YOUR_API_KEY>"
);

const blockNumber = await provider.getBlockNumber();
console.log("Latest block:", blockNumber);
```

```ts viem theme={null}
import { createPublicClient, http } from "viem";
import { defineChain } from "viem";

const injectiveEVM = defineChain({
  id: 1776,
  name: "Injective EVM",
  nativeCurrency: { name: "Injective", symbol: "INJ", decimals: 18 },
  rpcUrls: {
    default: { http: ["https://inj-mainnet.g.alchemy.com/v2/<YOUR_API_KEY>"] },
  },
});

const client = createPublicClient({
  chain: injectiveEVM,
  transport: http(),
});

const blockNumber = await client.getBlockNumber();
console.log("Latest block:", blockNumber);
```

```bash curl theme={null}
curl https://inj-mainnet.g.alchemy.com/v2/<YOUR_API_KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```

## Next steps

* [EVM network information](https://docs.injective.network/developers-evm/network-information.md) - chain IDs, explorers, and public RPC endpoints
* [Deploy your first EVM smart contract](https://docs.injective.network/developers-evm/smart-contracts.md)
* [Connect your dApp to Injective](https://docs.injective.network/developers-evm/add-injective-to-your-dapp.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.