# Peaq

> GetBlock provides fast and reliable access to Peaq nodes via JSON-RPC API. Connect to the Peaq network without running your own infrastructure.

Peaq is a Substrate/Polkadot Layer-1 SDK for DePIN (Decentralized Physical Infrastructure Networks) and the machine economy. Its node exposes a rich JSON-RPC surface over a single endpoint: the classic Substrate method families (`system_`, `chain_`, `state_`, `childstate_`, `author_`, `payment_`, `offchain_`, `rpc_methods`), the newer JSON-RPC-spec families (`chainHead_v1_`, `chainSpec_v1_`, `transaction_v1_`, `transactionWatch_v1_`), a full Ethereum-compatible EVM layer via Frontier (`eth_`, `net_`, `web3_`), peaq's own machine-economy pallets (`peaqdid_`, `peaqrbac_`, `peaqstorage_`), and the Zenlink DEX (`zenlinkProtocol_`). The native token is PEAQ (18 decimals; SS58 prefix 42).

## Interfaces

| Interface | Transport | Use it for |
| --- | --- | --- |
| JSON-RPC (HTTP) | JSON-RPC 2.0 over HTTP POST | All request/response methods — Substrate, EVM, peaq pallets, and Zenlink |
| WebSocket (WSS) | JSON-RPC 2.0 over WebSocket | The same methods, plus pub-sub subscriptions (new heads, storage, extrinsic/transaction status, `eth_subscribe`) |

Both interfaces carry the same method set; subscription methods (marked below) require WebSocket. Every call is a POST with a `method` and a `params` array to the single endpoint.

## Interface Endpoints

#### JSON-RPC (HTTP)

```bash
https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/
```

#### WebSocket (WSS)

```bash
wss://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/
```

> **Info:** Replace `<ACCESS-TOKEN>` with the token from the GetBlock dashboard. The peaq node serves the Substrate and EVM method families on the same endpoint; subscription methods require the WebSocket interface.

## Network Information

| Property | Value |
| --- | --- |
| Network Name | peaq |
| Native Currency | PEAQ (18 decimals) |
| SS58 Format | 42 |
| EVM Chain ID | 3338 |
| Framework | Substrate / Polkadot SDK (Layer-1) with Frontier EVM |
| Consensus | Proof-of-Stake (Aura block production + GRANDPA finality) |
| Finality | Deterministic (GRANDPA) |

## Supported Networks

| Network | JSON-RPC (HTTP) | WebSocket (WSS) | Frankfurt, Germany | New York, USA | Singapore, Singapore |
| --- | --- | --- | --- | --- | --- |
| Mainnet | ✅ | ✅ | ❌ | ✅ | ❌ |

## Quickstart

#### Javascript(Axios)

### Setup project

```bash
mkdir peaq-api-quickstart && cd peaq-api-quickstart  && npm init --yes
```

### Install dependency

```bash
npm install axios
```

### Add code

#### index.js

```javascript
const axios = require('axios');

const url = 'https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/';

const payload = {
  jsonrpc: '2.0',
  method: 'eth_blockNumber',
  params: [],
  id: 'getblock.io'
};

axios.post(url, payload, {
  headers: { 'Content-Type': 'application/json' }
})
.then(response => {
  console.log('Latest block:', parseInt(response.data.result, 16));
})
.catch(error => console.error(error));
```

### Run the script

```bash
node index.js
```

### Response

```bash
Latest block: 11,979,753
```

#### Python(Request)

### Setup project

```bash
mkdir peaq-api-quickstart && cd peaq-api-quickstart
python -m venv venv && source venv/bin/activate
```

### Install dependency

```bash
pip install requests
```

### Add code

#### main.py

```python
import requests
import json

url = "https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/"

payload = json.dumps({
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": "getblock.io"
})

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)
```

### Run the script

```bash
python main.py
```

## Support

For technical support and questions:

* Support: [support@getblock.io](mailto:support@getblock.io)

## See Also

* [peaq Documentation](https://docs.peaq.xyz/)
* [Substrate JSON-RPC](https://docs.substrate.io/)
* [Polkadot-JS API](https://polkadot.js.org/docs/)
* [Subscan Explorer (peaq)](https://peaq.subscan.io/)
