API Reference

Starknet API FAQ

What is Starknet?

Starknet is a permissionless, decentralized zero-knowledge rollup (ZK rollup) for Ethereum, operating as a Layer 2 (L2) blockchain. Similar to other Layer 2 chains, it enables decentralized applications (dApps) running on it to benefit from the increased scalability and reduced transaction costs without compromising on Ethereum’s security and composability. Starknet leverages the power of STARK (Scalable Transparent Argument of Knowledge) technology which is a safe and scalable cryptographic proof system.

Starknet contracts and the Starknet OS are written in Cairo, a Rust-inspired, custom-built and specialized programming language. This means that Starknet is not EVM-compatible and requires its own set of tools to develop or interact with it.

What is Starknet API?

Starknet API is a set of interfaces that enable developers to connect to the Starknet node and interact with the Starknet network, including accessing the blocks, transactions, events, invoking and managing contracts and so on. Starknet API follows the JSON RPC 2.0 specification and the node accepts requests via HTTP and WebSocket.

Note: Only HTTP requests are supported as of now.

How to get started with Starknet API?

For access to the Starknet node server, please setup the account and get an API endpoint as explained in the Quickstart guide.

For the client side, you can use any HTTP client library or tool to send requests to the Starknet API endpoint. For instance, you can use curl or Postman to send direct HTTP requests. However, for convenience purposes, it's strongly recommended using the officially provided Starknet SDKs. Please refer to Starknet's Tools & resources page for SDKs available in different languages.

Note that when interacting with the API, there might be a need to concern about the API version which is explained below.

What are the Starknet API versions?

There are currently 3 API versions + 1 extension namespace supported by the Starknet node we're running now: v0.4, v0.5.1, v0.6, v0.7 and the Pathfinder extension v0.1.

You can access these versions or the extension namespace via one of the endpoints listed below:

Note that the root endpoint https://api.zan.top/node/v1/starknet/mainnet/{apiKey} is equivalent to v0.5.1 and the binding is subject to change to a newer version in the future as the breaking change is made in the node implementation. If you want to avoid the impact of this change, it's recommended to use an endpoint with a specific version.

A complete list of the supported methods of the versions is available in the next section.

What are the supported methods of the Starknet API?

Methods/Versionsv0.4v0.5.1v0.6v0.7pathfinder/v0.1
=== Node API ==================
starknet_blockNumber✅️N/A
starknet_blockHashAndNumber✅️N/A
starknet_call✅️N/A
starknet_chainId✅️N/A
starknet_estimateFee✅️N/A
starknet_estimateMessageFee✅️N/A
starknet_getBlockTransactionCount✅️N/A
starknet_getBlockWithReceipts✅️N/A
starknet_getBlockWithTxHashes✅️N/A
starknet_getBlockWithTxs✅️N/A
starknet_getClass✅️N/A
starknet_getClassAt✅️N/A
starknet_getClassHashAt✅️N/A
starknet_getEvents✅️N/A
starknet_getNonce✅️N/A
starknet_getStateUpdate✅️N/A
starknet_getStorageAt✅️N/A
starknet_getTransactionByBlockIdAndIndex✅️N/A
starknet_getTransactionByHash✅️N/A
starknet_getTransactionReceipt✅️N/A
starknet_getTransactionStatus✅️N/A
starknet_pendingTransactionsN/A
starknet_specVersion✅️N/A
starknet_syncing✅️N/A
=== Write API ==================
starknet_addDeclareTransaction✅️N/A
starknet_addDeployAccountTransaction✅️N/A
starknet_addInvokeTransaction✅️N/A
=== Trace API ==================
starknet_traceTransaction✅️N/A
starknet_simulateTransactions✅️N/A
starknet_traceBlockTransactions✅️N/A
=== Pathfinder Extensions ==================
pathfinder_version
pathfinder_getProof✅️
pathfinder_getTransactionStatus

For the detailed usage of the methods, please choose a corresponding method subpage on the left.