-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbcalc.1
153 lines (120 loc) · 2.18 KB
/
bcalc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
.de dT
.ds Dt \\$2
..
.dT Time-stamp: "2019-05-27"
.TH BCALC 1 \*(Dt "bcalc" "User Commands"
.SH NAME
bcalc \- A simple calculator that understands Bitcoin units
.SH SYNOPSIS
.B bcalc
[\fI\,OPTION\/\fR]... [\fI\,EXPRS\/\fR]...
.SH DESCRIPTION
bcalc accepts calculator-like commands over stdin or as arguments. See EXAMPLES.
.SS UNITS
.TS
tab(;);
ln.
BTC;100 000 000 sats
mBTC (milli-bitcoin);100 000 sats
bits (μBTC, micro-bitcoin);100 sats
finney;10 sats
satoshi (sat);1 sat
millisatoshi (msat);0.001 sat
.TE
.SS Basic form
<expr> [to <UNIT>]
.SS
Plural insensitivity
.TP
Units can be suffixed with s without any issues: 10 sat, 10 sats, etc
.SS
Number spacing
.TP
Numbers can have spaces/commas between them for readibility:
bcalc 1 000 000 sats to mbtc
.br
bcalc 10,000 sats to btc
.SH OPTIONS
.TP
.BR \-\-P ", " \-\^\-price
An arbitrary fiat price, used for fiat conversions
.TP
.BR \-\-n ", " \-\^\-no\-unit
Only output the numeric value without the unit
.SH EXAMPLES
.SS
Basic example
.br
bcalc 1 msat + 2 sats + 3 bits to msats
.br
302001 msats
.SS
BTC to satoshis
.br
bcalc 0.02 BTC
.br
2000000 sats
.SS
satoshis to millisatoshis (for payment channels)
Notice that --no-unit,-n hides the unit here
.br
bcalc --no-unit 100 sat to msats
.br
100000
.SS
mBTC + bits to BTC
.br
bcalc 100 mBTC + 20 bits to btc
.br
0.10002 BTC
.SS
Division
.br
bcalc 1 BTC / 100 to bits
.br
10000 bits
.SS
Multiplication
Notice you may need to quote or escape the '*' here
.br
bcalc '10 mbtc * 30 to bits'
.br
300000 bits
.SS
Fiat currencies
.br
bcalc --price 20000 30 usd to bits
.br
1500 bits
.br
bcalc --price 16000 780 bits to fiat
.br
12.48 usd
.SS
The Bitcoin pizzas
.br
bcalc --price 0.0041 41 usd to btc
.br
10000 BTC
.SS
Chain analysis
.br
bitcoin-iterate -q --output=%oa --start 0 --end 80000 | sed 's,$, sats to btc,g' | bcalc | sort | uniq -c | sort -nr | head -n5
.br
84634 50 BTC
.br
9778 0.01 BTC
.br
7829 0.05 BTC
.br
3064 5 BTC
.br
1326 0.02 BTC
.SH BUGS
Precision issues with BTC -> m/sat conversions such as: bcalc 0.1284502 btc
.br
See https://github.com/jb55/bcalc/issues/2
.SH AUTHOR
William Casarin <jb55@jb55.com>
.br
Support my Bitcoin projects: bc1qthsruffh3qcn69hux2tcq87x95x8rmu4fdu9sm