bcalc

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

README.md (1528B)


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