Pathfinder currently supports querying the Starknet network for state.

For the full list of available queries, see Pathfinder API.

JSON-RPC API

Use curl or Postman.

curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":"0","method":"METHOD","params":[PARAMS]}' YOUR_CHAINSTACK_ENDPOINT

where

  • METHOD — a supported JSON-RPC API method
  • PARAMS — request parameters if any
  • YOUR_CHAINSTACK_ENDPOINT — your node HTTPS endpoint protected either with the key or password

Starknet.js

1

Install Starknet.js. See Starknet.js guide.

2

Use RpcProvider to connect to your Starknet node and get the latest block:

import { RpcProvider } from 'starknet';
const provider = new RpcProvider({
  nodeUrl: 'YOUR_CHAINSTACK_ENDPOINT',
})
provider.getBlockNumber().then(console.log);

where YOUR_CHAINSTACK_ENDPOINT is your node HTTPS endpoint protected either with the key or password. See also node access details.

Starknet.py

1

Install Starknet.py. See Starknet.py guide.

2

Use FullNodeClient to connect to your Starknet node and retrieve a transaction by hash:

from starknet_py.net.full_node_client import FullNodeClient

from starknet_py.net.networks import MAINNET

node_url = "YOUR_CHAINSTACK_ENDPOINT"
full_node_client = FullNodeClient(node_url=node_url, net=MAINNET)

call_result = full_node_client.get_transaction_sync(tx_hash="0x50c1941ab13ccc5d9785ceda1d0d7a47be01865eecb795a62f4e589ddca0258")

print(call_result)

where YOUR_CHAINSTACK_ENDPOINT is your node HTTPS endpoint protected either with the key or password. See also node access details.

Starkli

Rust-based CLI tool to interact with the Starknet blockchain.

1

Install Starkli. See Starkli Book.

2

In a terminal run commands with the --rpc flag:

starkli block-number --rpc YOUR_CHAINSTACK_ENDPOINT

where YOUR_CHAINSTACK_ENDPOINT is your node HTTPS endpoint protected either with the key or password. See also node access details.

Find more JSON-RPC methods on the Starkli documentation.