Logo
RPC Assistant

Phala RPC Endpoints: Chain Settings, Connection Guide, and Developer Resources

Summary

Phala Network is a Polkadot parachain that provides confidential smart contracts using Trusted Execution Environments (TEEs). To interact with Phala, developers need reliable RPC endpoints for reading on-chain data, submitting transactions, and deploying Phat Contracts. This article covers Phala RPC chain settings, how to connect, and what to consider when choosing an RPC provider.

Phala RPC Decision Checklist

Before integrating Phala RPC endpoints, evaluate these key factors:

CriterionWhat to checkWhy it matters
Endpoint typeHTTPS vs WebSocketWebSocket is required for real-time subscriptions (e.g., new blocks, events).
Network supportMainnet only or also testnetTestnet endpoints are essential for development and staging.
Rate limitsRequests per second (RPS) and monthly quotaExceeding limits can cause dropped requests; choose a plan that matches your traffic.
Archive dataFull archive vs pruned stateArchive nodes allow historical queries (e.g., past balances, events). Needed for explorers and analytics.
ReliabilityUptime history, redundancy, failoverProduction apps need consistent availability; look for providers with SLAs and multi-region deployment.
LatencyGeographic proximity and response timesLower latency improves user experience, especially for interactive dApps.
SecurityTLS encryption, authentication, DDoS protectionPrevents data interception and ensures endpoint availability.
Pricing modelPay-as-you-go vs flat monthly feeChoose based on your usage pattern; unpredictable spikes may favor flat-rate plans.

What Is Phala Network?

Phala Network is a Polkadot parachain that brings confidential smart contracts to Web3 using Trusted Execution Environments (TEEs). Its unique architecture combines a public blockchain with secure enclaves, enabling trustless, private, and scalable computation. Developers build Phat Contracts—off-chain programs that can interact with external APIs and blockchains while maintaining data privacy.

To interact with Phala, applications need an RPC endpoint. This endpoint acts as a gateway to the blockchain, allowing you to read on-chain data, submit transactions, and deploy smart contracts. Choosing the right RPC provider is critical for performance, reliability, and cost.

Phala Chain Settings

Phala Network runs on the following chain parameters:

  • Chain ID: 2035 (0x7f3)
  • Native Token: PHA (Phala)
  • Block Time: ~12 seconds (Polkadot relay chain)
  • Consensus: Nominated Proof-of-Stake (NPoS) via Polkadot
  • Network Type: Mainnet (Parachain)

For EVM compatibility, Phala also supports an EVM layer. The chain ID for the EVM side is also 2035.

How to Connect to Phala RPC

You can connect to Phala using standard JSON-RPC calls over HTTPS or WebSocket. Below is an example using curl to get the latest block hash:

curl -X POST https://rpc.phala.network \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"chain_getBlockHash","params":[0],"id":1}'

For WebSocket connections (e.g., with wscat or in JavaScript):

const WebSocket = require('ws');
const ws = new WebSocket('wss://api-phala.dwellir.com/02b83e9c-732e-4b15-b38e-9f24b75e8d66');

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

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

Choosing a Phala RPC Provider

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

  • Public vs Private Endpoints: Public endpoints (like https://rpc.phala.network) are free but often rate-limited and less reliable. For production, a private or dedicated endpoint is recommended.
  • Provider Features: Look for providers that offer dedicated nodes, archive data, WebSocket support, and global load balancing.
  • Pricing: Compare pay-as-you-go vs flat-rate plans. Some providers offer free tiers for low-volume use.

OnFinality provides managed Phala RPC endpoints and dedicated nodes with flexible pricing. You can find more details on the Phala network page and RPC pricing.

Common RPC Methods for Phala

Here are some frequently used JSON-RPC methods when interacting with Phala:

MethodDescription
chain_getBlockHashGet the hash of a block by number
chain_getBlockGet full block details
state_getStorageRead storage values
state_callCall a runtime API
system_healthCheck node health
system_networkStateGet network state

For a complete list, refer to the Substrate RPC documentation.

Troubleshooting Phala RPC Issues

  • Connection refused or timeout: Check if the endpoint URL is correct and your firewall allows outbound connections. Try a different provider.
  • Rate limiting: If you receive HTTP 429 or similar errors, reduce request frequency or upgrade to a plan with higher limits.
  • Inconsistent data: Ensure you are connected to the same network (mainnet vs testnet). Archive nodes may be needed for historical queries.
  • WebSocket disconnects: Implement reconnection logic in your application. Some providers have idle timeouts.

Key Takeaways

  • Phala Network is a Polkadot parachain for confidential smart contracts using TEEs.
  • RPC endpoints are essential for reading on-chain data and submitting transactions.
  • Choose a provider based on reliability, rate limits, archive support, and pricing.
  • OnFinality offers managed Phala RPC and dedicated nodes; see supported networks for details.
  • Always test with a free tier before committing to a paid plan.

Frequently Asked Questions

What is the Phala RPC endpoint? The public RPC endpoint is https://rpc.phala.network. For production, consider a private endpoint from a provider like OnFinality.

Does Phala support WebSocket? Yes, WebSocket endpoints are available for real-time subscriptions. Check with your provider for the specific URL.

What is the chain ID for Phala? The chain ID is 2035 (0x7f3).

How do I get PHA tokens for gas? PHA is the native token. You can acquire it on exchanges or via bridges. See the Phala docs for details.

Can I run my own Phala node? Yes, but it requires significant resources and maintenance. Managed services like OnFinality offer dedicated nodes without the operational overhead.

What is the difference between Phala mainnet and testnet? The testnet (Khala) is used for development and testing. It has its own RPC endpoints and token (tPHA).

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started