Docs

Starknet - Cairo-Powered Validity Rollup Documentation

Complete guide to Starknet integration with Dwellir RPC. Learn how to build on Cairo-powered Starknet, access JSON-RPC methods, and deploy scalable dApps with STARK proof security.

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:

Starknet RPC Endpoints
HTTPS
curl -sS -X POST https://api-starknet-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots> \  -H 'Content-Type: application/json' \  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
import { JsonRpcProvider } from 'ethers';const provider = new JsonRpcProvider(  'https://api-starknet-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>');const latest = await provider.getBlockNumber();console.log('block', latest);
import requestsurl = 'https://api-starknet-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>'payload = {  'jsonrpc': '2.0', 'id': 1,  'method': 'eth_blockNumber', 'params': []}resp = requests.post(url, json=payload)print(resp.json())
package mainimport (  "bytes"  "fmt"  "io"  "net/http")func main() {  url := "https://api-starknet-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>"  payload := []byte(`{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}`)  resp, err := http.Post(url, "application/json",    bytes.NewBuffer(payload))  if err != nil { panic(err) }  defer resp.Body.Close()  body, _ := io.ReadAll(resp.Body)  fmt.Println(string(body))}

Installation & Setup

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

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

# Call a contract function (ETH balance)
curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "starknet_call",
    "params": [
      {
        "contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
        "entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
        "calldata": ["0x1234..."]
      },
      "latest"
    ],
    "id": 1
  }'

Network Information

ParameterValueDetails
Chain IDSN_MAIN0x534e5f4d41494e
Block Time~10 secondsSTARK proof batches
Native TokenETHFee token
Account ModelAA NativeSmart contract accounts

Network Details

ParameterValueDetails
Mainnet Chain ID0x534e5f4d41494e (SN_MAIN)
Testnet (Sepolia) Chain ID0x534e5f5345504f4c4941 (SN_SEPOLIA)
Fee TokensETH (primary), STRK (governance, future staking)
FinalityL2 confirmation (~10s), L1 finality (~1-4 hours)
TPS50+ current, 100+ roadmap with parallel execution

API Reference

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

Common Integration Patterns

Account Management

TypeScript
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

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

Contract Calls

TypeScript
// 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