Skip to content

Instantly share code, notes, and snippets.

@csknk
Created August 25, 2023 17:08
Show Gist options
  • Save csknk/a8761a820439b37ef9ed818e32e04f23 to your computer and use it in GitHub Desktop.
Save csknk/a8761a820439b37ef9ed818e32e04f23 to your computer and use it in GitHub Desktop.
Basic script to run against Bitcoin bitcoind server on LAN
#!/usr/bin/env bash
# Basic script to run against Bitcoin bitcoind server on LAN
# Ref: Bitcoin Core getchaintips RPC command: https://bitcoincore.org/en/doc/0.21.0/rpc/blockchain/getchaintips
set -eou pipefail
IFS=$'\n\t'
# Set variables ----
user=XXXXXX
password=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
node_ip=192.168.0.XXX
# End --------------
port=8332
data=$(
cat <<-EOF
{
"jsonrpc": "1.0",
"id": "curltest",
"method": "getchaintips"
}
EOF
)
# Add -vvvv for verbose output/debugging
curl \
-vvvv \
--user "${user}:${password}" \
--data-binary "$data" \
-H 'content-type: text/plain;' \
"${node_ip}:${port}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment