Skip to content

Instantly share code, notes, and snippets.

@meowsbits
Last active December 7, 2020 17:22
Show Gist options
  • Save meowsbits/2ef1acec43ba09115b38b7d91d87586f to your computer and use it in GitHub Desktop.
Save meowsbits/2ef1acec43ba09115b38b7d91d87586f to your computer and use it in GitHub Desktop.
How to hit geth's JSON RPC over different transports.
#!/usr/bin/env bash
# HTTP
curl -X POST $(curl icanhazip.com/v4):8545 --data '{"jsonrpc":"2.0","method":"trace_transaction","params":["0x552280896083bfe801a1f70c84011d1b4195a2c08d2221f80245380775cd6270"],"id":1}' -H "Content-Type: application/json
http --json POST http://localhost:8545 id:=$(date +%s) method='rpc_discover' params:='[]'
# Websocket
echo rpc.discover | websocat -B 650000 -n1 --jsonrpc ws://localhost:8546
# IPC
echo '{"jsonrpc":"2.0","method":"rpc.discover","params":[],"id":71}' | nc -U -W1 -I653366 /tmp/geth-test.ipc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment