bcalc

cli bitcoin unit calculator
git clone git://jb55.com/bcalc
Log | Files | Refs | README | LICENSE

README.md (1437B)


      1 
      2 # bcalc
      3 
      4   A simple calculator that understands Bitcoin Units
      5 
      6 ## Examples
      7 
      8   Basic example
      9 
     10     $ bcalc 1 msat + 2 sats + 3 bits to msats
     11     302001 msats
     12 
     13   BTC to satoshis
     14 
     15     $ bcalc 0.02 BTC
     16     2000000 sats
     17 
     18   satoshis to millisatoshis (for payment channels), also dont print unit
     19 
     20     $ bcalc --no-unit 100 sat to msats
     21     100000
     22 
     23   mBTC + bits to BTC
     24 
     25     $ bcalc 100 mBTC + 20 bits to btc
     26     0.10002 BTC
     27 
     28   Division
     29 
     30     $ bcalc 1 BTC / 100 to bits
     31     10000 bits
     32 
     33   Multiplication
     34 
     35     $ bcalc '10 mbtc * 30 to bits'
     36     300000 bits
     37 
     38   Fiat currencies
     39 
     40     $ bcalc --price 20000 30 usd to bits
     41     1500 bits
     42 
     43     $ bcalc --price 16000 780 bits to fiat
     44     12.48 usd
     45 
     46   The Bitcoin pizzas
     47 
     48     $ bcalc --price 0.0041 41 usd to btc
     49     10000 BTC
     50     
     51   Chain analysis
     52   
     53     $ bitcoin-iterate -q --output=%oa --start 0 --end 80000 | sed 's,$, sats to btc,g' | bcalc | sort | uniq -c | sort -nr | head -n5
     54     84634	50 BTC
     55     9778	0.01 BTC
     56     7829	0.05 BTC
     57     3064	5 BTC
     58     1326	0.02 BTC
     59 
     60 
     61 ## Install
     62 
     63   If on Ubuntu, check you have the prerequisites to build this package
     64 
     65     $ sudo apt-get install build-essential bison flex
     66 
     67   Build and install
     68 
     69     $ make install
     70 
     71   If you run into errors because your user doesn't have write access to /usr/local/bin then
     72 
     73     $ sudo make install
     74 
     75 ## Units
     76 
     77   - BTC,
     78   - mBTC (milli-bitcoin),
     79   - bits (╬╝BTC, micro-bitcoin),
     80   - finney,
     81   - satoshi (sat),
     82   - millisatoshi (msat),