DEV Community

Zhuoxin Sun
Zhuoxin Sun

Posted on • Originally published at onfinality.io

Peaq RPC Endpoint: Chain Settings, Faucet, and Debugging

Peaq RPC Decision Checklist

Before choosing a Peaq RPC provider or connecting to the network, consider these key factors:

  • Endpoint Reliability: Does the provider offer redundant nodes and load balancing to minimize downtime?
  • Latency: Are the endpoints geographically distributed to reduce lag for your user base?
  • Rate Limits: What is the allowed requests per second (RPS) and monthly request cap for your plan?
  • WebSocket Support: Does the provider offer WSS endpoints for real-time subscriptions?
  • Archive Data: Do you need historical state access for debugging or analytics?
  • Faucet Access: For testnets, is a reliable faucet available to fund development?
  • Pricing Model: Is it pay-as-you-go or subscription-based? Are there overage fees?

Peaq Network Overview

Peaq is a Layer 1 blockchain built on Substrate, operating as a Polkadot parachain. It is designed specifically for Decentralized Physical Infrastructure Networks (DePIN) and the Machine Economy. Peaq supports dual execution environments: EVM-compatible smart contracts (Solidity) and Substrate pallets (Rust). This allows developers to leverage familiar Ethereum tooling like Hardhat, Foundry, and Web3.js, while also accessing Polkadot's cross-chain messaging (XCM) for interoperability.

Key features of Peaq include:

  • Chain ID: 3338 (0xd0a)
  • Native Token: PEAQ
  • Consensus: Nominated Proof-of-Stake (NPoS) via Polkadot relay chain
  • Block Time: ~12 seconds (depending on network conditions)
  • Explorer: Subscan

Peaq RPC Endpoint and Chain Settings

To connect to the Peaq mainnet, you need the correct RPC endpoint and chain parameters. Below are the official details:

Parameter Value
Network Name peaq
RPC URL https://peaq-rpc.publicnode.com (public, rate-limited)
Chain ID 3338 (0xd0a)
Currency Symbol PEAQ
Block Explorer https://peaq.subscan.io
WebSocket (WSS) wss://peaq-rpc.publicnode.com

For production dApps, consider using a dedicated RPC provider like OnFinality to get higher rate limits, dedicated nodes, and global load balancing.

How to Connect to Peaq RPC

You can interact with the Peaq RPC using standard Ethereum JSON-RPC methods. Below are examples in curl and JavaScript.

curl Example: Get Latest Block Number

curl -X POST https://peaq-rpc.publicnode.com \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Enter fullscreen mode Exit fullscreen mode

JavaScript (Web3.js)

const Web3 = require('web3');
const web3 = new Web3('https://peaq-rpc.publicnode.com');

async function getBlockNumber() {
  const blockNumber = await web3.eth.getBlockNumber();
  console.log('Latest block:', blockNumber);
}
getBlockNumber();
Enter fullscreen mode Exit fullscreen mode

Adding Peaq to MetaMask

  1. Open MetaMask and click the network dropdown.
  2. Click "Add Network" and fill in:
  3. Click Save. You can now interact with Peaq directly from your wallet.

Using the Peaq Faucet

For development on Peaq testnet (if available), you can request test tokens from the Peaq faucet. Check the official Peaq documentation for testnet details and faucet URLs. Note that the faucet may have daily limits and require a social login or captcha.

For mainnet, you can acquire PEAQ tokens from exchanges or bridge from other networks. Ensure you have sufficient funds to cover transaction fees.

Choosing an RPC Provider for Peaq

When selecting an RPC provider for your Peaq dApp, evaluate the following criteria:

Criterion What to check Why it matters
Reliability Uptime SLA, redundant nodes Prevents app downtime and failed transactions
Latency Global server locations, response times Faster block data retrieval improves user experience
Rate Limits Requests per second (RPS), monthly cap Avoids throttling during traffic spikes
WebSocket WSS support for subscriptions Essential for real-time features like order books
Archive Data Access to historical state Needed for analytics, audits, and debugging
Pricing Transparent cost, no surprise overages Aligns with your budget and scale

Major providers like OnFinality offer flexible plans for both shared and dedicated infrastructure. Compare their offerings against your workload requirements.

Common RPC Issues and Debugging

Issue: "Nonce too low" or "Nonce too high"

This occurs when the transaction nonce does not match the sender's current nonce. Ensure your application tracks nonces correctly and resets when a transaction is replaced or dropped.

Issue: "Insufficient funds"

Check your account balance and the gas price. Use eth_getBalance to verify funds:

curl -X POST https://peaq-rpc.publicnode.com \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xYourAddress", "latest"],"id":1}'
Enter fullscreen mode Exit fullscreen mode

Issue: Timeout or Connection Refused

  • Verify the RPC URL is correct.
  • Check if the provider has rate-limited your IP. Consider using a dedicated endpoint.
  • Ensure your firewall allows outbound connections on port 443 (HTTPS).

Issue: Invalid Chain ID

When signing transactions, ensure you use chain ID 3338. Libraries like ethers.js derive it from the provider, but if you hardcode it, double-check.

Key Takeaways

  • Peaq is a Substrate-based Polkadot parachain focused on DePIN and machine economy.
  • The mainnet chain ID is 3338, native token is PEAQ.
  • Use the public RPC at https://peaq-rpc.publicnode.com for testing, but consider a managed provider for production.
  • Always check rate limits and latency when choosing an RPC provider.
  • Leverage the EVM compatibility to use familiar tools like Web3.js, ethers.js, and Hardhat.
  • For real-time applications, ensure your provider supports WebSocket endpoints.

Frequently Asked Questions

Q: What is the Peaq chain ID?
A: The chain ID for Peaq mainnet is 3338 (0xd0a in hexadecimal).

Q: Is Peaq EVM-compatible?
A: Yes, Peaq supports the Ethereum Virtual Machine (EVM), allowing you to deploy Solidity smart contracts.

Q: Where can I get PEAQ test tokens?
A: Check the official Peaq documentation for testnet faucet details. Test tokens are typically available for development purposes.

Q: Can I use Polkadot.js with Peaq?
A: Yes, since Peaq is a Substrate-based parachain, you can use Polkadot.js for Substrate-native interactions.

Q: How do I choose between shared and dedicated RPC?
A: Shared RPC is sufficient for development and low-traffic dApps. For high-throughput production apps, dedicated nodes provide guaranteed resources and lower latency.

Related resources

Originally published at OnFinality.

Top comments (0)