Skip to main content

Getting Starknet RPC

Starknet Public RPCโ€‹

Mainnet ๐ŸŒโ€‹

Service ๐Ÿ”ŒURL ๐Ÿ”—
๐ŸŸข json-rpchttps://rpc.starknet.lava.build

Testnet ๐Ÿงชโ€‹

Service ๐Ÿ”ŒURL ๐Ÿ”—
๐ŸŸข json-rpchttps://rpc.starknet-testnet.lava.build

API Referenceโ€‹

curl -X POST -H "Content-Type: application/json" https://g.w.lavanet.xyz:443/gateway/strk/rpc-http/3dc655f970c930f1d3e78ee71beece18 --data '{"jsonrpc":"2.0","method":"starknet_blockNumber","params":[],"id":1}'

Gatewayโ€‹

To learn more about using the Lava Gateway visit the Getting Started guide

SDKโ€‹

caution

Lava SDK is currently in Alpha. Please observe the documentation on both frontend and backend use before getting started.

Input ๐Ÿ“ฅโ€‹

// Install lavaSDK with the following command:
// npm i @lavanet/lava-sdk
const { LavaSDK } = require("@lavanet/lava-sdk");

async function useStarknet() {
const starknet = await LavaSDK.create({
privateKey: process.env.PRIVATE_KEY, //hide your private key in an environmental variable
chainIds: "STRK",
});

const starknetBlockResponse = await starknet.sendRelay({
method: "starknet_blockNumber",
params: [],
});

console.log(starknetBlockResponse);
}

(async () => {
await useStarknet();
})();

Output ๐Ÿ“คโ€‹

To learn more about our SDK visit the Getting Started guide