Skip to content

A simple proxy that allows polkadotjs api functionality with non-native support via a restful api

License

Notifications You must be signed in to change notification settings

stake-plus/polkadotjs-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

polkadotjs-proxy

This server acts as a bridge for systems to communicate with Polkadot's WSS endpoints using the pure PolkadotJS API functionality, allowing seamless interaction without the need for native support.

Overview

The polkadotjs-proxy enables communication to the RPC proxy on the specified port. Example JSON command can be found below:

{
    "type": "query",
    "namespace": "system",
    "method": "account",
    "params": ["5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"],
    "network": "wss://rpc.ibp.network/kusama",
    "blockHash": "0xabc123"
}

(Note: Please remove the extra backslashes \ before the backticks around the JSON code block.)

The type, namespace, method, params, network, and blockHash are input variables. This proxy facilitates queries and interactions with the Polkadot nodes.

Dependencies

  • Node.js
  • Express
  • @polkadot/api

Compilation & Launch Instructions

  1. Ensure you have Node.js installed.
  2. Install the necessary npm packages:
npm install
  1. Run the server using the server.js file:
node server.js
  1. Launch using systemd:

    • Create a systemd service file, e.g., /etc/systemd/system/polkadotjs-proxy.service:
[Unit]
Description=PolkadotJS Proxy Server

[Service]
ExecStart=/usr/bin/node /path/to/your/server.js
Restart=always
User=your_username
Group=your_group
Environment=PATH=/usr/bin:/usr/local/bin
WorkingDirectory=/path/to/your/directory

[Install]
WantedBy=multi-user.target
  • Reload systemd:
sudo systemctl daemon-reload
  • Start the service:
sudo systemctl start polkadotjs-proxy
  • (Optional) Enable on boot:
sudo systemctl enable polkadotjs-proxy

Note: Replace /path/to/your/ with the actual path to your server.js file and adjust User and Group as necessary.

About

A simple proxy that allows polkadotjs api functionality with non-native support via a restful api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors