Starknet Starknet JSON RPC API API

The Starknet JSON RPC API API from Starknet — 1 operation(s) for starknet json rpc api.

OpenAPI Specification

starknet-starknet-json-rpc-api-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Starknet JSON-RPC Starknet JSON RPC API API
  version: 0.8.0
  description: 'Starknet is a permissionless Ethereum Layer 2 validity rollup developed

    by StarkWare. Full nodes (Pathfinder, Juno, Papyrus) and infrastructure

    providers (Infura, Alchemy, Blast, Nethermind) implement the versioned

    Starknet JSON-RPC specification. All methods are invoked via a single

    POST endpoint and follow the JSON-RPC 2.0 envelope.


    Methods enumerated from the upstream specification at

    https://github.com/starkware-libs/starknet-specs (starknet_api_openrpc.json).

    '
  contact:
    name: Starknet Specs
    url: https://github.com/starkware-libs/starknet-specs
servers:
- url: https://starknet-mainnet.public.blastapi.io/rpc/v0_8
  description: BlastAPI public Starknet mainnet RPC endpoint
- url: https://starknet-mainnet.g.alchemy.com/v2/{apiKey}
  description: Alchemy Starknet mainnet RPC endpoint
  variables:
    apiKey:
      default: YOUR_API_KEY
- url: https://starknet-mainnet.infura.io/v3/{projectId}
  description: Infura Starknet mainnet RPC endpoint
  variables:
    projectId:
      default: YOUR_PROJECT_ID
tags:
- name: Starknet JSON RPC API
paths:
  /:
    post:
      summary: Starknet JSON-RPC entrypoint
      description: 'Single JSON-RPC endpoint that accepts any of the methods enumerated in

        the public Starknet specification. The `method` field selects the

        operation; `params` carries method-specific arguments.

        '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JsonRpcRequest'
            examples:
              blockNumber:
                summary: Get latest block number
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: starknet_blockNumber
                  params: []
              chainId:
                summary: Get configured chain id
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: starknet_chainId
                  params: []
              call:
                summary: Call a function on a contract
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: starknet_call
                  params:
                    request:
                      contract_address: 0x...
                      entry_point_selector: 0x...
                      calldata: []
                    block_id: latest
      responses:
        '200':
          description: JSON-RPC response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse'
      tags:
      - Starknet JSON RPC API
components:
  schemas:
    JsonRpcRequest:
      type: object
      required:
      - jsonrpc
      - method
      properties:
        jsonrpc:
          type: string
          const: '2.0'
        id:
          oneOf:
          - type: string
          - type: integer
          - type: 'null'
        method:
          type: string
          description: Starknet JSON-RPC method name.
          enum:
          - starknet_specVersion
          - starknet_getBlockWithTxHashes
          - starknet_getBlockWithTxs
          - starknet_getBlockWithReceipts
          - starknet_getStateUpdate
          - starknet_getStorageAt
          - starknet_getTransactionStatus
          - starknet_getMessagesStatus
          - starknet_getTransactionByHash
          - starknet_getTransactionByBlockIdAndIndex
          - starknet_getTransactionReceipt
          - starknet_getClass
          - starknet_getClassHashAt
          - starknet_getClassAt
          - starknet_getBlockTransactionCount
          - starknet_call
          - starknet_estimateFee
          - starknet_estimateMessageFee
          - starknet_blockNumber
          - starknet_blockHashAndNumber
          - starknet_chainId
          - starknet_syncing
          - starknet_getEvents
          - starknet_getNonce
          - starknet_getStorageProof
        params:
          description: Method-specific parameters (array or object).
          oneOf:
          - type: array
          - type: object
    JsonRpcResponse:
      type: object
      required:
      - jsonrpc
      properties:
        jsonrpc:
          type: string
          const: '2.0'
        id:
          oneOf:
          - type: string
          - type: integer
          - type: 'null'
        result:
          description: Method-specific result payload.
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            data: {}