P2prpc is a peer-to-peer network layer designed for blockchain RPC infrastructure.
It links blockchain RPC nodes together using libp2p and provides a client SDK for seamless and fault-tolerant interaction with the network.
Instead of relying on a single RPC endpoint, clients maintain an updated list of node addresses and use them for load balancing, redundancy, and failover—ensuring more reliable blockchain requests and transactions.
-
Peer-to-Peer RPC Node Network Nodes discover and connect to each other through libp2p, forming a decentralized mesh of RPC providers.
-
Dynamic Address Sharing Each node shares its address with peers and clients. Clients continuously keep their list of node addresses updated.
-
Client SDK Applications connect through the SDK, which automatically:
- Keeps track of available RPC nodes.
- Chooses healthy nodes for requests.
- Falls back to other nodes if one becomes unavailable.
-
Fault-Tolerant RPC Access Clients use the distributed node list to avoid single points of failure.
-
Blockchain Agnostic Designed to work with any blockchain that exposes an RPC interface.
- Nodes join the p2prpc network via libp2p.
- Peers exchange their addresses and propagate them throughout the network.
- Clients connect to the SDK, which fetches and maintains the latest peer addresses.
- When a blockchain request or transaction is made:
- The SDK routes it to an available node.
- If one node fails, it retries with another.
- Running redundant blockchain infrastructure without load balancers.
- Building resilient dApps that don’t break when a single RPC provider fails.
- Support for multiple blockchains out-of-the-box
- Node reputation and health monitoring.
npm run buildFirst node:
Configure node appropriately:
nvim ./examples/n1.yamlConfiguration example:
name: "myNode" # Arbitrary name, it would be show on dashboard and logs
httpEndpoint: "http://127.0.0.1:5001" # NOTE: a reverse proxy needed
# to map @httpEndpoint/<chain-id>
# to the running chain address
httpPort: 4001 # NOTE: a reverse proxy needed to map @httpPort to `@httpEndpoint/`
p2pPort: 3101 # port for connection to other nodes through libp2p
isBootstrap: true # (default: false)
localTest: true # (default: false)
bootstrappers: []Then run:
node dist/main.js ./examples/n1.yamlOther nodes:
Configure node appropriately:
nvim ./examples/n2.yaml # the same for n3.yaml and n4.yamlRun nodes:
node dist/main.js ./examples/n2.yamlAfter run, you can find node address in $HOME/.p2pRpc/addresses/<node-name>