/bcalc

A simple calculator that understands Bitcoin units

Primary LanguageCOtherNOASSERTION

bcalc

Build Status

A simple calculator that understands Bitcoin Units

Examples

Basic example

$ bcalc 1 msat + 2 sats + 3 bits in msats
302001 msats

BTC to satoshis

$ bcalc 0.02 BTC
2000000 sats

satoshis to millisatoshis (for payment channels), also dont print unit

$ bcalc --no-unit 100 sat in msats
100000

mBTC + bits to BTC

$ bcalc 100 mBTC + 20 bits in btc
0.10002 BTC

Division

$ bcalc 1 BTC / 100 in bits
10000 bits

Multiplication

$ bcalc '10 mbtc * 30 in bits'
300000 bits

Fiat currencies

$ bcalc --price 20000 30 usd in bits
1500 bits

$ bcalc --price 16000 780 bits in fiat
12.48 usd

The Bitcoin pizzas

$ bcalc --price 0.0041 41 usd in btc
10000 BTC

Install

If on Ubuntu, check you have the prerequisites to build this package

$ sudo apt-get install build-essential bison flex

Build and install

$ make install

If you run into errors because your user doesn't have write access to /usr/local/bin then

$ sudo make install

Units

  • BTC,
  • mBTC (milli-bitcoin),
  • bits (μBTC, micro-bitcoin),
  • finney,
  • satoshi (sat),
  • millisatoshi (msat),