Skip to main content

RPC Protocol & Transports

Rpc Protocol Transports (v0.38.x)

Download OpenAPI specification:Download

Arguments

Arguments which expect strings or byte arrays may be passed as quoted strings, like "abc" or as 0x-prefixed strings, like 0x616263.

URI/HTTP

A REST like interface.

curl https://pio-mainnet-1-rpc.provlabs.com/block?height=5

JSONRPC/HTTP

JSONRPC requests can be POST'd to the root RPC endpoint via HTTP.

curl --header "Content-Type: application/json" --request POST --data '{"method": "block", "params": ["5"], "id": 1}' https://pio-mainnet-1-rpc.provlabs.com

JSONRPC/websockets

JSONRPC requests can be also made via websocket. The websocket endpoint is at /websocket, e.g. https://pio-mainnet-1-rpc.provlabs.com/websocket. Asynchronous RPC functions like event subscribe and unsubscribe are only available via websockets.

For example using the websocat tool, you can subscribe for 'NewBlock` events with the following command:

echo '{ "jsonrpc": "2.0","method": "subscribe","id": 0,"params": {"query": "tm.event='"'NewBlock'"'"} }' | websocat -n -t wss://pio-mainnet-1-rpc.provlabs.com/websocket