Summary
A Starknet endpoint is the URL your application uses to send JSON-RPC requests to the Starknet mainnet or Sepolia testnet. It exposes methods for reading blocks, estimating fees, submitting transactions, and subscribing to events.
Choosing the right endpoint means checking network, RPC version, rate limits, archive data, and WebSocket support. Public endpoints are fine for prototyping; production dapps usually need a private API endpoint or a dedicated node from a provider like OnFinality.
A Starknet endpoint is the URL your application uses to talk to Starknet through JSON-RPC. It is the bridge between your dapp, wallet, or indexing service and the Starknet mainnet or Sepolia network. This page explains what to look for in a Starknet endpoint, how to call it, and how to choose between public, private, and dedicated options.
Starknet endpoint decision checklist
Before wiring an endpoint into your application, compare the options with this checklist.
| Criterion | What to check | Why it matters |
|---|---|---|
| Network | Mainnet or Sepolia? | Hitting the wrong network with signed transactions can be costly or confusing. |
| RPC spec version | Does the provider expose the Starknet JSON-RPC version your SDK expects? | Starknet upgrades RPC specs over time; mismatches cause method not found or schema errors. |
| Access model | Public, API key, or dedicated node? | Public endpoints are convenient but often shared; dedicated infrastructure gives you more control. |
| Rate limits | Requests per second, daily cap, and fair-use policy | High-traffic dapps will hit 429 responses if limits are too low. |
| Archive data | Historical state and trace support | Explorers, analytics, and some DeFi features need archive data. |
| WebSocket support | WSS endpoint for subscriptions | Real-time event streaming requires a WebSocket-capable provider. |
| Latency and geography | Where provider nodes are located | Distance affects response time for interactive dapps and trading tools. |
| Security and privacy | HTTPS, key storage, data logging policies | Endpoints that see your traffic should match your security expectations. |
What is a Starknet endpoint?
Starknet is a layer 2 ZK-rollup on Ethereum. It batches transactions off-chain, generates STARK proofs, and settles them on Ethereum. Applications interact with Starknet through a JSON-RPC API rather than directly querying Ethereum.
A Starknet endpoint is simply the HTTP/HTTPS or WebSocket URL that accepts those JSON-RPC calls. It exposes methods such as starknet_blockNumber, starknet_getBlockWithTxs, and starknet_call. You send a JSON-RPC request to the endpoint, and it returns data about blocks, transactions, events, or contract state.
You need an endpoint whenever you:
- Send transactions from a wallet or dapp.
- Read smart contract state with
starknet_call. - Estimate fees before submitting a transaction.
- Index events or watch for pending transactions.
- Deploy and manage Cairo contracts.
The endpoint itself is not the node. A node runs the Starknet client software, including the consensus and state database. An endpoint provider operates nodes and exposes them to you, so you do not need to run Pathfinder, Juno, or another client yourself.
Starknet mainnet and Sepolia endpoints
Starknet has two environments that matter for most developers:
- Starknet mainnet for production contracts and real assets.
- Starknet Sepolia testnet for development, staging, and testing before mainnet deployment.
The endpoint URL is different for each network. Pick the network-specific URL rather than relying on a generic endpoint that may point to the wrong chain. Most providers label them clearly, for example mainnet and sepolia in the URL path.
A few practical notes:
- Public testnet endpoints are usually fine for early development.
- Mainnet public endpoints may work for quick reads, but they are shared and can be rate-limited.
- For a dedicated setup, choose a managed endpoint that gives you a private URL and predictable limits.
If you want to use OnFinality for Starknet requests, check supported RPC networks for the current endpoint details and network availability.
Public, private, and dedicated endpoints
Public endpoints
Public endpoints are open URLs that anyone can call. They are great for the first five minutes of a project: curl a block number, read a contract, or check testnet behavior. However, they offer no guarantees for availability, rate limits, or data freshness when traffic spikes.
Private API endpoints
Private endpoints require an API key. The provider routes your requests through a dedicated URL and applies plan-specific limits. These are appropriate for staging environments, production dapps, and tools that need a stable auth model. They also let you see usage metrics and debug issues per key.
Dedicated nodes
A dedicated Starknet node gives you infrastructure that is not shared with other customers. You can request archive data, enable additional RPC methods, and tune the node for your workload. This matters for analytics pipelines, block explorers, and applications that make heavy or unusual requests.
OnFinality offers both an RPC API service and dedicated node infrastructure. With a dedicated node, you get your own endpoint instead of competing with other users on a shared pool. Before moving to a dedicated node, review your request volume, archive needs, and WebSocket usage to pick the right setup.
If you only need to test the difference between shared and dedicated infrastructure, compare RPC pricing and the API service options before committing.
Connect to a Starknet endpoint with JSON-RPC
All Starknet endpoints follow the JSON-RPC 2.0 protocol. A basic request includes a method name, optional params, and an id.
Here is a curl example that reads the latest block number:
curl -X POST https://YOUR_STARKNET_RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"starknet_blockNumber","params":[],"id":1}'
If the request succeeds, the response looks like this:
{"jsonrpc":"2.0","result":"0x4a","id":1}
The result is a hexadecimal block number. Most Starknet RPC methods use hex-encoded integers and Cairo strings, so keep that in mind when parsing responses.
In JavaScript, the same call looks like this:
const response = await fetch("https://YOUR_STARKNET_RPC_URL", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
method: "starknet_blockNumber",
params: [],
id: 1
})
});
const data = await response.json();
console.log(data.result);
Use the method list from the official Starknet RPC spec when building production code. Endpoint providers may support different spec versions, so match your SDK version to the endpoint version. If you see Method not found, the endpoint likely runs an older or newer spec than your client expects.
What to evaluate before picking a provider
You can evaluate a provider with a small test script before writing production code. Check the following:
- Network targeting: Is the URL explicitly labeled mainnet or Sepolia?
- RPC version: Which Starknet spec version does the endpoint expose?
- Rate limits: What happens when you exceed the limit? Do you get a 429 or silent throttling?
- Archive support: Can you query historical state without errors?
- WebSocket support: Does the provider offer WSS for subscriptions?
- Failover: Can you switch endpoints if your primary provider goes down?
For a deeper comparison, read how to choose an RPC provider for questions that apply to any chain, not only Starknet.
Common Starknet endpoint pitfalls
- Using the wrong network URL. A Sepolia endpoint and a mainnet endpoint return different data. Double-check before you sign or broadcast anything.
- Forgetting the content type. Starknet JSON-RPC servers reject requests without
Content-Type: application/json. - Assuming all providers support the same methods. Some endpoints expose only the base spec, while others add extra methods. Confirm method availability first.
- Mixing RPC versions. Starknet clients and SDKs target specific spec versions. An endpoint that serves v0.9 may reject a call written for v0.8 or vice versa.
- Ignoring rate limits. Public endpoints return 429 when the shared pool is saturated. Add retry logic and consider a private API key or dedicated node.
- Using an unsupported WebSocket endpoint. Not all providers offer WSS subscriptions. If your app needs event streaming, verify it before launch.
Troubleshooting a Starknet endpoint
Start with a minimal request to isolate the problem:
- Send
starknet_blockNumberto the endpoint. - Check the HTTP status code and JSON-RPC error fields.
- If you get a parser error, confirm the request body is valid JSON.
- If you get
Method not found, confirm the RPC spec version. - If you get a 429, wait before retrying, or move to a higher-tier endpoint.
- If you get empty results, verify that the requested block or contract address exists on the network you are querying.
For long-running services, do not hardcode a single endpoint. Maintain a list of healthy RPC URLs and build failover into your client. This is especially important when using public endpoints that can degrade without warning.
Key Takeaways
- A Starknet endpoint is the JSON-RPC URL that connects your app to Starknet mainnet or Sepolia.
- Public endpoints are useful for prototyping, but production workloads need predictable limits and support.
- Private API endpoints and dedicated nodes give you more control, observability, and stability.
- Verify the network, RPC spec version, archive support, and WebSocket availability before integrating.
- OnFinality can supply RPC and dedicated node infrastructure; see supported RPC networks and RPC pricing for details.
Frequently Asked Questions
What is the default Starknet endpoint? There is no single default endpoint. You need a provider URL or a public endpoint from a node provider. You can find community-maintained lists or use your provider dashboard. For OnFinality, check supported RPC networks for current details.
Is a public Starknet endpoint safe for production? Public endpoints are usually shared and rate-limited. They can work for light reads, but production dapps should use a private endpoint or dedicated node to get predictable performance and avoid dependency on someone else's availability.
What is the difference between mainnet and Sepolia endpoints? Mainnet endpoints interact with Starknet production and real assets. Sepolia endpoints point to the testnet and are used for development. They are separate URLs and return completely different chain state.
Does Starknet support WebSocket endpoints? Some providers offer WebSocket endpoints for real-time subscriptions. Check the provider's documentation before depending on it. If WebSocket is not available, you may need to poll or use a dedicated node.
How do I test a Starknet endpoint quickly?
Send a one-line JSON-RPC request with starknet_blockNumber using curl. If you get a hex block number, the endpoint is reachable and synced.