StarkNet (STRK)

Starknet is a permissionless validity (ZK) rollup that settles to Ethereum, executing contracts on the Cairo VM and proving that execution with STARK proofs verified on Ethereum L1. It is not EVM-compatible: contracts are Cairo classes, values are felt252 field elements expressed as hex, and every account is itself a contract under Starknet's native account abstraction. Blocks are addressed by a block_id that is either an object (a block number or block hash) or a tag (latest, pending). The JSON-RPC surface is the standard starknet_* method set: block and state reads, transaction and receipt lookups, contract calls and class/storage reads, event queries, fee estimation, and the invoke/declare/deploy-account write methods.

Key Features

  • Validity Rollup: Execution is proven with STARK proofs and verified on Ethereum L1, inheriting L1 security
  • Cairo VM: Contracts are Cairo classes compiled to Sierra, not EVM bytecode; values are felt252 field elements
  • Native Account Abstraction: Every account is a contract; signature schemes and validation are programmable
  • block_id Addressing: Reads accept a block number, block hash, or the latest / pending tags
  • Dual Fee Tokens: Fees are payable in ETH or STRK; fee amounts carry a unit (WEI or FRI)
  • Two-Stage Finality: Transactions move from ACCEPTED_ON_L2 to ACCEPTED_ON_L1 once settled on Ethereum
  • Classes and Instances: A class is declared once by hash, then deployed to many contract addresses

TECHNICAL DISCLAIMER: AUTHORITATIVE JSON-RPC API SPECIFICATION.

GetBlock's RPC API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. The canonical and normative specification for the Starknet JSON-RPC interface is maintained and published by StarkWare and the Starknet community through the official documentation at docs.starknet.io and the OpenRPC specification in the starknet-specs repository. This resource constitutes the sole authoritative reference for the starknet_ JSON-RPC methods.*

Network Information

PropertyValue
Network NameStarknet
Chain ID0x534e5f4d41494e (SN_MAIN)
Native Fee TokensETH, STRK
Decimals18
Virtual MachineCairo VM (felt252)
Settlement LayerEthereum L1 (STARK validity rollup)
Account ModelNative account abstraction
FinalityL1-backed after proof settlement

Base URL

bashhttps://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

Supported Networks

NetworkChain IDJSON-RPCWSSGraphQLMEV protected (WebSocket)MEV protected (JSON-RPC)Frankfurt, GermanyNew York, USASingapore, Singapore
MainnetSN_MAIN✅❌❌❌❌✅❌❌

Quickstart

  1. Setup project

    bashmkdir starknet-api-quickstart && cd starknet-api-quickstart && npm init --yes
  2. Install dependency

    bashnpm install axios
  3. Add code

    index.js

    javascriptconst axios = require('axios');
    
    const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';
    
    const payload = {
      jsonrpc: '2.0',
      method: 'starknet_blockNumber',
      params: [],
      id: 'getblock.io'
    };
    
    axios.post(url, payload, {
      headers: { 'Content-Type': 'application/json' }
    })
    .then(response => {
      console.log('Latest block:', response.data.result);
    })
    .catch(error => console.error(error));
  4. Run the script

    bashnode index.js
  5. Response

    bash{
        "jsonrpc": "2.0",
        "result": 14293145,
        "id": "getblock.io"
    }
  1. Setup project

    bashmkdir starknet-api-quickstart && cd starknet-api-quickstart
    python -m venv venv && source venv/bin/activate
  2. Install dependency

    bashpip install requests
  3. Add code

    main.py

    pythonimport requests
    import json
    
    url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"
    
    payload = json.dumps({
        "jsonrpc": "2.0",
        "method": "starknet_blockNumber",
        "params": [],
        "id": "getblock.io"
    })
    
    headers = {
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, headers=headers, data=payload)
    print(response.text)
  4. Run the script

    bashpython main.py

Available API Methods

Chain & Client Info

MethodDescription
starknet_specVersionVersion of the Starknet JSON-RPC spec served
starknet_chainIdChain ID of the connected Starknet network
starknet_syncingSync status, or false when fully synced
starknet_blockNumberLatest accepted block number
starknet_blockHashAndNumberLatest block hash and number together

Blocks & State

MethodDescription
starknet_getBlockWithTxHashesBlock header plus transaction hashes
starknet_getBlockWithTxsBlock header plus full transaction bodies
starknet_getBlockWithReceiptsBlock with transactions and their receipts
starknet_getBlockTransactionCountNumber of transactions in a block
starknet_getStateUpdateState diff applied by a block

Transactions

MethodDescription
starknet_getTransactionByHashTransaction body by hash
starknet_getTransactionByBlockIdAndIndexTransaction by block and index
starknet_getTransactionStatusFinality and execution status of a transaction
starknet_getTransactionReceiptExecution receipt of a transaction

Contracts, Accounts & State

MethodDescription
starknet_callCall a contract view function (no transaction)
starknet_getStorageAtRaw storage value at a contract key
starknet_getNonceAccount nonce at a block
starknet_getClassHashAtClass hash deployed at an address
starknet_getClassContract class definition by class hash
starknet_getClassAtContract class deployed at an address
starknet_getEventsFiltered events with pagination

Fee Estimation

MethodDescription
starknet_estimateFeeEstimate the fee for transactions
starknet_estimateMessageFeeEstimate the fee for an L1-to-L2 message

Write API

MethodDescription
starknet_addInvokeTransactionSubmit a signed invoke transaction
starknet_addDeployAccountTransactionDeploy a new account contract
starknet_addDeclareTransactionDeclare a new contract class

Support

For technical support and questions:

See Also