> ## 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.

<iframe className="w-1\/2 aspect-video rounded-xl" src="https://youtube.com/embed/Ma3CIvDRSjk?rel=0&autoplay=1&cc_load_policy=0" title="Injective + Alchemy quick start (1 min) - YouTube" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen frameborder="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

<Steps>
  <Step title="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`
  </Step>

  <Step title="Copy your RPC endpoints">
    Open your app and copy the HTTPS and WebSocket endpoints:

    <CodeGroup>
      ```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>
      ```
    </CodeGroup>

    <Warning>
      Keep your API key private, treat it like a password.
    </Warning>
  </Step>

  <Step title="Start building">
    Use the endpoint with your preferred library:

    <CodeGroup>
      ```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}'
      ```
    </CodeGroup>
  </Step>
</Steps>

## Next steps

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