RPC Providers
You need to configure an RPC provider to allow your dapp to fetch data from Starknet.
Starknet React providers are factories that, given a chain, return a Starknet.js
ProviderInterface
object.
Providers
This section provides an alphabetical list of RPC Providers supported by Starknet React.
Public
Starknet React ships with a public provider that you can use for quick demos. For any project that makes more than an handful of requests, you should use one of the providers below.
At the moment, this provider uses the free RPC endpoints provided by:
- Blast API
- Lava
- Nethermind
JSON-RPC
This is generic RPC provider. Use it to connect to private endpoints or to
services not yet supported by Starknet React. The value returned by the rpc
function is passed to the Starknet RpcProvider
constructor.
import { jsonRpcProvider } from "@starknet-react/core";
import { Chain } from "@starknet-react/chains";
function rpc(chain: Chain) {
return {
nodeUrl: `https://{chain.network}.example.org`
}
}
const provider = jsonRpcProvider({ rpc });
Alchemy
Create an Alchemy API key from the dashboard.
import { alchemyProvider } from "@starknet-react/core";
const apiKey = "your-api-key";
const provider = alchemyProvider({ apiKey });
Blast
Create a Bast API key from the dashboard.
import { blastProvider } from "@starknet-react/core";
const apiKey = "your-api-key";
const provider = blastProvider({ apiKey });
Infura
Create an Infura API key from the dashboard.
import { infuraProvider } from "@starknet-react/core";
const apiKey = "your-api-key";
const provider = infuraProvider({ apiKey });
Lava
Create a Lava API key from the dashboard.
import { lavaProvider } from "@starknet-react/core";
const apiKey = "your-api-key";
const provider = lavaProvider({ apiKey });
Nethermind
Create a Nethermind API key from the dashboard.
import { nethermindProvider } from "@starknet-react/core";
const apiKey = "your-api-key";
const provider = nethermindProvider({ apiKey });
Reddio
Create a Reddio API key from the dashboard.
import { reddioProvider } from "@starknet-react/core";
const apiKey = "your-api-key";
const provider = reddioProvider({ apiKey });
Cartridge
Cartridge offers a Starknet RPC provider.
import { cartridgeProvider } from "@starknet-react/core";
const provider = cartridgeProvider();
Slot
Create a Slot project from the CLI.
import { slotProvider } from "@starknet-react/core";
const projectId = "your-project-id";
const provider = slotProvider({ projectId });