1. Select Your Network

Use one of the WebSocket URLs below to connect to your preferred network:

2. Connect Using JavaScript (polkadot.js)

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}`);
});

3. Additional Configurations

For automated scripts, you might include chain ID checks:

if (api.runtimeChain.toString() === 'Agung') {
    console.log("Connected to Agung Testnet");
}

4. Steps to Update Node

  1. Stop the Docker container (retain the Docker volume).

  2. Pull the new Docker image (use the provided link).

  3. Remove -unsafe-rpc-external and -rpc-methods=unsafe from your configuration.

  4. 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
    
    
  5. Wait for synchronization with both the Polkadot Relay Chain and the Krest parachain.