peaq
peaq is the layer-1 blockchain powering the Machine Economy, comprising decentralized physical infrastructure networks (DePIN) and Machine Real-World Assets (RWAs). peaq is leading a global infrastructure revolution, empowering people to own and earn from the physical infrastructure they use. It is home to 50 DePINs in 21 industries and to the 1,750,000+ devices, vehicles, machines, and robots (Machine RWAs) that run on them.
Network Endpoints
You can connect to peaq network via WSS or RPC endpoints.
- WSS
- RPC
https://peaq.api.onfinality.io/public
https://peaq-rpc.publicnode.com
https://peaq-rpc.dwellir.com
Quickstart
Web3.js library
First, copy the public network endpoint from above (you can also use your own endpoint). Next, create a Web3 instance with your endpoint using Web3.js library and configure the provider to connect to peaq (both RPC and WSS protocols supported):
const Web3 = require('web3'); // Import Web3 library
.
// Create a local Web3 instance and set peaq as the provider
const web3 = new Web3("RPC-API-ENDPOINT-HERE"); // Replace with your RPC URL
Ethers.js library
Similar to Web.js instruction above you'll need an endpoint. For the Ethers.js library, define the provider by using ethers.JsonRpcProvider(providerURL) and setting the provider URL to peaq:
const ethers = require('ethers'); // Import Ethers.js library
// Define the provider using ethers.JsonRpcProvider(providerURL, {object}) and set the provider URL to peaq
const provider = new ethers.JsonRpcProvider("RPC-API-ENDPOINT-HERE"); // Replace with your RPC URL
Chain ID
peaq chain ID is 3338, or 0xd0a in hex.