⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

Starknet - Build on the Leading Cairo-Powered Validity Rollup

Starknet RPC
With Dwellir, you get access to our global Starknet network which always routes your API requests to the nearest available location, ensuring low latency and the fastest speeds.

Get your API key →

Why Build on Starknet?

Starknet is the leading validity rollup (zk-rollup) that executes Cairo smart contracts with STARK proof security, offering unparalleled scalability while maintaining Ethereum-grade security:

Revolutionary Cairo Performance

  • Native account abstraction - Every account is a programmable smart contract
  • Cairo VM execution - Provable computation with mathematical guarantees
  • Sub-second finality - Fast transaction confirmation with L1 security
  • 99%+ cost reduction compared to Ethereum mainnet

🔒 STARK Proof Security

  • Zero-knowledge proofs - Cryptographically secure state transitions
  • Ethereum settlement - Inherits L1 security with validity proof verification
  • Decentralized proving - Robust network with permissionless participation

🌟 Developer-First Ecosystem

  • Cairo language - Safe, powerful programming language for contracts
  • Rich tooling - starknet.js, starknet.py, Protostar, Scarb, and more
  • Growing DeFi - Leading protocols like Avnu, Ekubo, Nostra, JediSwap
  • Account abstraction native - Flexible wallet experiences out of the box

Quick Start with Starknet

Connect to Starknet in seconds with Dwellir's optimized endpoints:

🔗 RPC Endpoints

Starknet Mainnet (Chain ID: 0x534e5f4d41494e)Live
https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY
✓ Archive Node✓ Trace API✓ Debug API✓ WebSocket

Quick Connect:

curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

Installation & Setup

import { RpcProvider, Contract, Account, CallData } from 'starknet';

// Connect to Starknet mainnet
const provider = new RpcProvider({
nodeUrl: 'https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY'
});

// Verify connection and get network info
const chainId = await provider.getChainId();
console.log('Connected to Starknet chain ID:', chainId);

// Get the latest block
const block = await provider.getBlockWithTxs('latest');
console.log('Latest block number:', block.block_number);
console.log('Block hash:', block.block_hash);

// Query account balance (ETH contract on Starknet)
const ethAddress = '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7';
const accountAddress = '0x1234...'; // Your account address

const { result } = await provider.callContract({
contractAddress: ethAddress,
entrypoint: 'balanceOf',
calldata: CallData.compile([accountAddress])
});

console.log('ETH balance:', result[0]);

Network Information

Chain ID

SN_MAIN

0x534e5f4d41494e

Block Time

~10 seconds

STARK proof batches

Native Token

ETH

Fee token

Account Model

AA Native

Smart contract accounts
Network Details
  • Mainnet Chain ID: 0x534e5f4d41494e (SN_MAIN)
  • Testnet (Sepolia) Chain ID: 0x534e5f5345504f4c4941 (SN_SEPOLIA)
  • Fee Tokens: ETH (primary), STRK (governance, future staking)
  • Finality: L2 confirmation (~10s), L1 finality (~1-4 hours)
  • TPS: 50+ current, 100+ roadmap with parallel execution

JSON-RPC API Reference

Starknet implements its own JSON-RPC namespace (starknet_*) with Cairo-specific functionality. Access all Starknet methods with STARK proof security.

Available JSON-RPC Methods

Blocks & State

Retrieve Starknet blocks, state updates, and counts

+

Contracts & Storage

Inspect contract classes, storage slots, and account state

+

Transactions & Fees

Inspect transaction lifecycle and estimate execution fees

+

Events & Messaging

Monitor emitted events and L1 ↔ L2 messaging flows

+

Network Info

Discover JSON-RPC spec support, chain ID, and sync status

+

Ready to ship Cairo-powered dApps on Starknet?

Get your API key →

Common Integration Patterns

Account Management

import { Account, RpcProvider } from 'starknet';

const provider = new RpcProvider({
nodeUrl: 'https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY'
});

const account = new Account(provider, accountAddress, privateKey);
const nonce = await account.getNonce();

Token Operations

// Get token balance
const { result } = await provider.callContract({
contractAddress: tokenAddress,
entrypoint: 'balanceOf',
calldata: [accountAddress]
});

Contract Calls

// Execute contract function
const call = {
contractAddress: contractAddress,
entrypoint: functionName,
calldata: [param1, param2]
};

const { transaction_hash } = await account.execute(call);

Resources & Tools

Official Resources

Block Explorers

Developer Tools

Ecosystem Projects

Need Help?


Start building on Starknet with Cairo-powered smart contracts using Dwellir's enterprise-grade RPC infrastructure. Get your API key →