Quick decision guide: How to connect to peaq mainnet
If you're building on peaq mainnet, your first decision is how to access the network. You have three main options:
- Use a public RPC endpoint – Best for development, testing, and low-traffic applications. Public endpoints are free but may have rate limits and no uptime guarantees.
- Use a managed RPC provider – Best for production applications that need reliable, scalable access. Providers like OnFinality offer dedicated endpoints, higher throughput, and support.
- Run your own node – Best for teams that need full control, data privacy, or custom configurations. Running a node requires infrastructure management and maintenance.
For most production use cases, a managed RPC provider is the right balance of cost, reliability, and effort. OnFinality provides peaq mainnet RPC endpoints as part of its supported networks, with flexible pricing options.
What is peaq mainnet?
peaq mainnet is the production blockchain network of the peaq ecosystem, a Layer 1 built specifically for Decentralized Physical Infrastructure Networks (DePIN). DePIN projects use blockchain to coordinate real-world devices, machines, and sensors, enabling decentralized ownership and operation of physical infrastructure.
peaq mainnet is designed to handle high-throughput, machine-to-machine transactions, with features like role-based permissions, machine IDs, and modular DePIN pallets. It is built on Substrate, the same framework that powers Polkadot and Kusama, giving it a robust and flexible architecture.
For developers, peaq mainnet offers a familiar EVM-compatible environment, meaning you can deploy Solidity smart contracts and use tools like MetaMask, Hardhat, and ethers.js. This lowers the barrier for Ethereum developers to enter the DePIN space.
Key features of peaq mainnet
- DePIN-focused primitives: peaq provides built-in modules for machine identity, roles, and payments, reducing the need for custom smart contract logic.
- EVM compatibility: Deploy Ethereum-style contracts and use standard tooling.
- High throughput: Designed for high-frequency, low-value transactions typical of machine-to-machine interactions.
- Cross-chain interoperability: peaq is part of the Polkadot ecosystem, enabling communication with other parachains.
- Governance and upgrades: Substrate-based chains support on-chain governance and forkless upgrades.
Chain settings at a glance
When connecting to peaq mainnet, you'll need the following network settings for wallets and dApps:
| Setting | Value |
|---|---|
| Network Name | peaq |
| RPC URL | Use the public endpoint from OnFinality: https://peaq.api.onfinality.io/public
|
| Chain ID | 3338 |
| Currency Symbol | PEAQ |
| Block Explorer | https://peaq.subscan.io |
Note: The RPC URL above is the official OnFinality public endpoint. For production, consider using a dedicated endpoint from OnFinality's peaq network page.
How to connect to peaq mainnet
Using MetaMask
- Open MetaMask and click the network dropdown.
- Click "Add Network" and fill in the details from the table above.
- Save and switch to the peaq network.
Using ethers.js (JavaScript)
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://peaq.api.onfinality.io/public");
async function getBlockNumber() {
const blockNumber = await provider.getBlockNumber();
console.log("Current block number:", blockNumber);
}
getBlockNumber();
Using curl (JSON-RPC)
curl -X POST https://peaq.api.onfinality.io/public \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Common RPC methods on peaq mainnet
peaq mainnet supports standard Ethereum JSON-RPC methods, including:
-
eth_blockNumber– Get the latest block number. -
eth_getBalance– Get the balance of an address. -
eth_call– Execute a read-only contract call. -
eth_sendRawTransaction– Broadcast a signed transaction. -
eth_getTransactionReceipt– Get transaction receipt. -
eth_chainId– Get the chain ID.
You can also use WebSocket subscriptions for real-time updates:
const wsProvider = new ethers.WebSocketProvider("wss://peaq.api.onfinality.io/public/ws");
wsProvider.on("block", (blockNumber) => {
console.log("New block:", blockNumber);
});
Choosing the right RPC provider for peaq mainnet
When selecting an RPC provider for peaq mainnet, consider the following factors:
| Factor | What to evaluate | Why it matters |
|---|---|---|
| Reliability | Uptime history, redundant infrastructure | Downtime can break your dApp |
| Scalability | Rate limits, throughput capacity | High traffic may hit limits |
| Data access | Archive data, trace methods | Needed for analytics and debugging |
| Support | Documentation, response times | Faster issue resolution |
| Cost | Pricing model, free tier | Budget alignment |
OnFinality offers a managed RPC service with global infrastructure, automatic failover, and flexible plans. You can start with the free tier and scale as your project grows. Check the RPC pricing page for details.
Troubleshooting common connection issues
-
Incorrect chain ID: Ensure your wallet uses chain ID
3338. - Rate limiting: Public endpoints may throttle requests. Use a dedicated endpoint for production.
- Transaction not confirming: Check gas price and nonce. peaq uses EIP-1559, so set appropriate maxFeePerGas.
- WebSocket disconnects: Implement reconnection logic in your dApp.
Key Takeaways
- peaq mainnet is a Layer 1 blockchain for DePIN, offering EVM compatibility and DePIN-specific features.
- Use the official OnFinality public endpoint for development:
https://peaq.api.onfinality.io/public. - For production, consider a managed RPC provider like OnFinality for reliability and scalability.
- Always verify chain settings (chain ID, symbol) to avoid connection errors.
Frequently Asked Questions
What is the peaq mainnet chain ID?
The chain ID is 3338.
Is peaq mainnet EVM-compatible?
Yes, peaq mainnet supports the Ethereum Virtual Machine, allowing you to deploy Solidity contracts.
How do I get PEAQ tokens for gas?
You can obtain PEAQ tokens from exchanges or through the peaq faucet for testnet. For mainnet, you'll need to purchase or receive PEAQ.
Can I run my own peaq node?
Yes, peaq is a Substrate-based chain, and you can run a full node. However, for most applications, using a managed RPC provider is simpler and more cost-effective.
Where can I find the latest peaq mainnet RPC endpoints?
Visit the peaq network page for the most up-to-date endpoints and information.
Related resources
Originally published at OnFinality.
Top comments (0)