Use one of the WebSocket URLs below to connect to your preferred network:
Agung (Testnet):
wss://wsspc1-qa.agung.peaq.network
Chain ID: 9990
Krest (Canary Network):
wss://krest.api.onfinality.io/public-ws
wss://krest.unitedbloc.com
Chain ID: 2241
Install the @polkadot/api
package if you haven’t:
npm install @polkadot/api
Then, create a connection to the network:
const { ApiPromise, WsProvider } = require('@polkadot/api');
// Select the provider URL for your network
const provider = new WsProvider('wss://wsspc1-qa.agung.peaq.network'); // For Agung Testnet
// Connect to the network
ApiPromise.create({ provider }).then((api) => {
console.log(`Connected to ${api.runtimeVersion.specName} network`);
}).catch((error) => {
console.error(`Connection failed: ${error}`);
});
For automated scripts, you might include chain ID checks:
if (api.runtimeChain.toString() === 'Agung') {
console.log("Connected to Agung Testnet");
}
Stop the Docker container (retain the Docker volume).
Pull the new Docker image (use the provided link).
Remove -unsafe-rpc-external
and -rpc-methods=unsafe
from your configuration.
Run the updated image:
sudo docker run -d -v krest-storage:/chain-data -p 9944:9944 -p 9933:9933 peaq/parachain:krest-v0.0.7 \\\\
--collator \\\\
--parachain-id 2241 \\\\
--chain ./node/src/chain-specs/krest-raw.json \\\\
--base-path chain-data \\\\
--port 30333 \\\\
--rpc-port 9944 \\\\
--rpc-cors=all \\\\
--execution=wasm \\\\
--out-peers 50 \\\\
--in-peers 50
Wait for synchronization with both the Polkadot Relay Chain and the Krest parachain.