Skip to content

Instantly share code, notes, and snippets.

@jb55
Last active October 23, 2017 16:29
Show Gist options
  • Save jb55/6d4b498512ecaf9927329ba3e84817f3 to your computer and use it in GitHub Desktop.
Save jb55/6d4b498512ecaf9927329ba3e84817f3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
getprice () {
# replace with your preferred exchange
curl -sL 'https://api.quadrigacx.com/v2/ticker' | jq -r .last
}
n=${1:-100}
size=${2:-226}
price=${3:-$(getprice)}
for x in $(seq 1 $n)
do
bitcoin-cli estimatesmartfee $x
done \
| sed -e 's,\(0.[0-9]\+\),"\1",g' \
| jq -r "[.feerate, .blocks, (((.blocks * 10)/60)*100 | floor)/100, (.feerate | tonumber | ((. * $size)/1000) * $price) ] | @tsv" \
| sort -n -u -t$'\t' -k1,1 \
| tac \
| column -t -s $'\t'
@jb55
Copy link
Author

jb55 commented Oct 23, 2017

bitcoin-cli settxfee 0.00016504

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment