DEV Community

OnFinality
OnFinality

Posted on Originally published at onfinality.io

Frequency RPC: Connect to Frequency Parachain

Quick Recommendation: How to Connect to Frequency RPC

If you are building a decentralized social application on Frequency, you need a reliable RPC endpoint to interact with the chain. The quickest way to start is to use a managed RPC service like OnFinality, which provides public and private endpoints for the Frequency parachain. For production workloads, consider a dedicated node to ensure consistent performance and avoid rate limits.

  • For testing and development: Use the public RPC endpoint provided by OnFinality.
  • For production dApps: Evaluate a dedicated node or a private RPC endpoint to handle higher traffic and maintain uptime.
  • For high-frequency queries: Use WebSocket subscriptions for real-time updates instead of polling.

What Is Frequency and Why Use Its RPC?

Frequency is a Polkadot parachain built specifically for decentralized social networks. It uses the Decentralized Social Networking Protocol (DSNP) to enable user-controlled identity and data portability across applications. Developers building social dApps on Frequency need to interact with the chain through RPC calls to read state, submit transactions, and subscribe to events.

The Frequency RPC allows you to query chain data, send extrinsics, and listen for updates. Understanding the available methods and how to structure your requests is essential for building efficient applications.

Chain Settings and Endpoint Reference

Before connecting, you need the correct chain configuration. Here are the key details for the Frequency parachain:

Parameter Value
Network Name Frequency Parachain
Chain ID 2091
RPC Endpoint (HTTPS) https://rpc.frequency-polkadot.onfinality.io
WebSocket Endpoint wss://rpc.frequency-polkadot.onfinality.io
Explorer https://frequency.subscan.io

These settings are used in wallet configurations and dApp development. Always verify the latest endpoint from the Frequency network page as they may change.

Making Your First RPC Call

To test your connection, you can use a simple curl command to fetch the latest block number:

curl -H "Content-Type: application/json" \
  -d '{"id":1, "jsonrpc":"2.0", "method":"chain_getHeader", "params":[]}' \
  https://rpc.frequency-polkadot.onfinality.io
Enter fullscreen mode Exit fullscreen mode

The response will include the block number, hash, and parent hash. This confirms your endpoint is working.

Common RPC Methods for Frequency

Frequency supports standard Substrate RPC methods, plus some specific to its pallets. Here are the most useful ones:

  • chain_getBlock – Fetch a block by hash or number.
  • chain_getFinalizedHead – Get the latest finalized block hash.
  • state_getStorage – Read a storage value.
  • system_accountNextIndex – Get the next nonce for an account.
  • author_submitExtrinsic – Submit a signed transaction.

For social features, you may use methods related to DSNP, such as msa and messages pallets. Check the Frequency documentation for the full list.

Using WebSocket for Real-Time Updates

For applications that need live updates, such as new messages or account changes, WebSocket subscriptions are more efficient than polling. Here is an example using the wss endpoint:

const WebSocket = require('ws');
const ws = new WebSocket('wss://rpc.frequency-polkadot.onfinality.io');

ws.on('open', function open() {
  ws.send(JSON.stringify({
    id: 1,
    jsonrpc: '2.0',
    method: 'chain_subscribeNewHeads',
    params: []
  }));
});

ws.on('message', function incoming(data) {
  console.log(data.toString());
});
Enter fullscreen mode Exit fullscreen mode

This subscription will push new block headers as they are produced.

Choosing the Right RPC Infrastructure

When selecting an RPC provider for Frequency, consider the following:

  • Public vs. Private: Public endpoints are fine for development but may have rate limits. Private endpoints offer higher throughput and reliability.
  • Dedicated Nodes: For production, a dedicated node gives you full control over resources and avoids noisy neighbors.
  • Archive Data: If you need historical state, ensure your provider offers archive nodes.
  • Geographic Distribution: Choose a provider with global coverage to reduce latency.

OnFinality offers both public and dedicated node options for Frequency. You can compare plans on the RPC pricing page and see all supported networks on the networks page.

Troubleshooting Common Issues

  • Connection Timeouts: If you experience timeouts, check your network firewall and ensure the endpoint is reachable. Try using a different transport (HTTPS vs WSS).
  • Rate Limiting: Public endpoints may throttle requests. If you hit limits, consider upgrading to a private endpoint or dedicated node.
  • Nonce Errors: When submitting transactions, ensure you use the correct nonce. Use system_accountNextIndex to fetch the next nonce.
  • Block Not Found: If you request a block that doesn't exist, verify the block number or hash.

Key Takeaways

  • Frequency is a Polkadot parachain for decentralized social apps, using DSNP.
  • Use the official RPC endpoint for testing, and consider dedicated nodes for production.
  • WebSocket subscriptions are ideal for real-time updates.
  • Always verify chain settings from the network page.
  • Choose a provider that offers the right balance of performance, reliability, and cost.

Frequently Asked Questions

What is the Frequency RPC endpoint?

The public HTTPS endpoint is https://rpc.frequency-polkadot.onfinality.io. For WebSocket, use wss://rpc.frequency-polkadot.onfinality.io.

Is Frequency a standalone blockchain?

No, Frequency is a parachain on Polkadot, benefiting from shared security and interoperability.

Can I use Frequency RPC for free?

Yes, public endpoints are available for development and testing. For production, you may need a paid plan.

How do I get a dedicated Frequency node?

You can request a dedicated node through OnFinality's dedicated node service.

What is DSNP?

DSNP (Decentralized Social Networking Protocol) is a protocol for social networking that gives users control over their identity and data, implemented on Frequency.

Related resources

Originally published at OnFinality.

Top comments (0)