Summary
The SORA API refers to the RPC endpoints and JSON-RPC methods that let applications read and write data on the SORA network. This article explains what the SORA API is, how to connect to it, and how to choose between public and dedicated endpoints for production workloads.
Quick decision guide: which SORA endpoint should you use?
Before you write any code, decide which SORA API endpoint fits your workload. The right choice depends on how much traffic you expect, whether you need historical data, and how sensitive your application is to downtime.
- Prototyping or low-volume dApp: a public endpoint is fine for development and small user bases. You can start with the public RPC URL and switch later if you hit rate limits.
- Production dApp with steady traffic: use a managed RPC service like OnFinality to get dedicated throughput and reliability. Public endpoints can throttle or become unavailable under load.
- Indexers or analytics: you may need archive data or trace support. Check whether the provider offers archive nodes and which methods are enabled.
- High-frequency trading or DeFi bots: latency and WebSocket support matter. A dedicated node gives you consistent performance and allows you to tune the node configuration.
If you are unsure, start with a managed provider that offers a free tier and scale up as your usage grows. OnFinality provides RPC pricing that scales with your needs, and you can see all supported networks on the networks page.
What is the SORA API?
The SORA API is the set of JSON-RPC endpoints that allow applications to interact with the SORA blockchain. SORA is a Polkadot-based network focused on decentralized finance (DeFi) and the creation of a supranational economic system. The API lets you query chain state, submit transactions, and listen for events.
SORA uses the Substrate framework, so its RPC interface is similar to other Polkadot parachains. You can use standard Ethereum-style JSON-RPC methods if you are using the Ethereum compatibility layer, or Substrate-specific methods for deeper chain interaction.
For most developers, the SORA API is the gateway to building wallets, DeFi dashboards, or any application that needs to read or write data on SORA.
SORA chain settings at a glance
Here are the key settings you need to configure your wallet or dApp to connect to SORA:
| Setting | Value |
|---|---|
| Network name | SORA |
| RPC endpoint | Use the public endpoint from the SORA network page or your provider's endpoint |
| Chain ID | Refer to the network configuration (typically 0x2b or similar for Substrate-based chains) |
| Symbol | XOR |
| Block explorer | SORA explorer (external) |
Always verify the chain ID and endpoint from the official network configuration to avoid connecting to a testnet or a malicious endpoint.
How to connect to the SORA API
You can interact with the SORA API using standard JSON-RPC calls. Here is a simple curl example to get the latest block number:
curl -X POST <SORA_RPC_URL> \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"chain_getHeader","params":[],"id":1}'
Replace <SORA_RPC_URL> with the actual endpoint. For JavaScript developers, you can use the polkadot-js/api library to interact with SORA:
const { ApiPromise, WsProvider } = require('@polkadot/api');
const wsProvider = new WsProvider('wss://sora.api.onfinality.io/public-ws');
const api = await ApiPromise.create({ provider: wsProvider });
const lastHeader = await api.rpc.chain.getHeader();
console.log('Last block number:', lastHeader.number.toNumber());
Note: The WebSocket endpoint above is an example. Use the official endpoint from the SORA network page or your provider's documentation.
SORA API methods you will use most
Depending on your application, you will use a mix of Substrate and Ethereum-compatible methods. Here are the most common ones:
- Chain state:
chain_getHeader,chain_getBlock,state_getStorage - Account balance:
state_getBalance(Substrate) oreth_getBalance(Ethereum-compatible) - Transaction submission:
author_submitExtrinsic(Substrate) oreth_sendRawTransaction(Ethereum-compatible) - Events:
chain_subscribeNewHeads(WebSocket) for real-time updates
If you are building a wallet, you will likely use balance and transaction methods. If you are building an indexer, you will need block and storage methods.
Public vs. dedicated SORA API endpoints
Public endpoints are convenient but come with limitations. They are shared among many users, so they can be rate-limited or become slow during peak times. For production applications, a dedicated endpoint offers:
- Consistent performance: no noisy neighbors affecting your request latency.
- Higher rate limits: you can make more requests per second without hitting throttles.
- Custom configuration: you can enable archive data or adjust node settings to match your workload.
OnFinality offers dedicated nodes for SORA and other networks. With a dedicated node, you get your own RPC endpoint that is not shared with other users, giving you more control and reliability.
How to choose a SORA API provider
When evaluating SORA API providers, consider these factors:
| Criterion | What to check | Why it matters |
|---|---|---|
| Throughput | Request per second limits | Prevents throttling during traffic spikes |
| Reliability | Uptime history and redundancy | Ensures your dApp stays online |
| Archive data | Availability of archive nodes | Needed for historical queries and indexers |
| WebSocket support | Real-time event subscriptions | Essential for live updates in wallets and dashboards |
| Pricing model | Free tier, pay-as-you-go, or flat rate | Aligns with your budget and usage pattern |
| Support | Documentation and response times | Helps you resolve issues quickly |
OnFinality is a good option because it offers a free tier, flexible pricing, and a global network of nodes. You can start with the public endpoint and upgrade to a dedicated node as your project grows.
Common pitfalls and how to avoid them
- Using the wrong chain ID: If you connect to the wrong network, transactions will fail. Always double-check the chain ID from the official configuration.
- Ignoring rate limits: Public endpoints have limits. If you exceed them, you will get errors. Use a provider that offers higher limits or a dedicated node.
- Not handling WebSocket reconnections: WebSocket connections can drop. Implement reconnection logic to maintain real-time updates.
- Assuming archive data is available: Not all providers offer archive nodes. If you need historical state, confirm that the provider supports it.
Production readiness checklist
Before launching your dApp, go through this checklist:
- Choose a reliable RPC provider (consider OnFinality)
- Set up monitoring for RPC endpoint health
- Implement retry logic for failed requests
- Use WebSocket for real-time data where needed
- Test with the public endpoint before scaling
- Review RPC pricing to estimate costs
Key Takeaways
- The SORA API is the JSON-RPC interface to the SORA blockchain, used for reading data, submitting transactions, and subscribing to events.
- Public endpoints are fine for development, but production apps should use a managed or dedicated endpoint for reliability and performance.
- Choose a provider based on throughput, archive data, WebSocket support, and pricing.
- Always verify chain settings and handle common pitfalls like rate limits and WebSocket reconnections.
Frequently Asked Questions
What is the SORA API?
The SORA API is the set of JSON-RPC endpoints that allow applications to interact with the SORA blockchain. It includes methods for querying chain state, submitting transactions, and subscribing to events.
How do I get a SORA RPC endpoint?
You can use the public endpoint from the SORA network page or sign up for a managed provider like OnFinality to get a dedicated endpoint.
Does OnFinality support SORA?
Yes, OnFinality supports SORA. You can find the network on the supported networks page and get started with a free API key.
What is the difference between public and dedicated SORA endpoints?
Public endpoints are shared and may have rate limits. Dedicated endpoints are private to your project, offering higher throughput and more consistent performance.
Can I use WebSocket with the SORA API?
Yes, SORA supports WebSocket connections for real-time data. Use the WebSocket endpoint provided by your RPC provider.
How much does it cost to use the SORA API?
Costs vary by provider. OnFinality offers a free tier and transparent pricing that scales with your usage.