Skip to content

Instantly share code, notes, and snippets.

@jb55
Last active October 23, 2017 16:29
Show Gist options
  • Select an option

  • Save jb55/6d4b498512ecaf9927329ba3e84817f3 to your computer and use it in GitHub Desktop.

Select an option

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

jb55 commented Oct 23, 2017

Copy link
Copy Markdown
Author
feerate     blocks  hours   fee in fiat
0.00141525  2       0.33    2.39740944075
0.00116711  4       0.66    1.97706449913
0.00100671  6       1       1.70534962593
0.00100653  9       1.5     1.70504470899
0.00064965  13      2.16    1.10049605595
0.00055927  14      2.33    0.94739387241
0.00053247  17      2.83    0.9019951280099999
0.00016504  25      4.16    0.27957495432
0.00011115  27      4.5     0.18828621045
0.00006198  34      5.66    0.10499306634
0.00005937  35      5.83    0.10057177071
0.00005106  49      8.16    0.08649477198000001
0.00005105  97      16.16   0.08647783215
0.00004997  98      16.33   0.08464833051000001

@jb55

jb55 commented Oct 23, 2017

Copy link
Copy Markdown
Author

bitcoin-cli settxfee 0.00016504

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