Convert among different units of measure for Bitcoin.

convert_btc(x, from = "BTC", to = "bits")

satoshi(x)

bits(x)

mbtc(x)

Arguments

x

a numeric value.

from

the units of x.

to

new units.

Value

numeric value.

Details

This complete conversion function, convert_btc, converts a value x among the following units: BTC, mBTC, bits and satoshi. These are the recommended ways of specifying the from and to arguments, though BTC and mBTC may be passed as btc and mbtc, respectively. BTC may also be written out as Bitcoin/bitcoin and will also be internally converted to BTC.

Three shorthand functions, mBTC, bits and satoshi, are also available if you forget the conversion. These assume the input is Bitcoin and multiply your value straight to mBTC, bits or satoshi, respectively. See examples.

Examples

convert_btc(1, "BTC", "mBTC")
#> [1] 1000
convert_btc(1, "BTC", "bits")
#> [1] 1000000
convert_btc(1, "BTC", "satoshi")
#> [1] 100000000
convert_btc(0.001, "mBTC", "bits")
#> [1] 1
convert_btc(1, "mBTC", "bitcoin")
#> [1] 0.001
convert_btc(100, "satoshi", "bits")
#> [1] 1
satoshi(1e-8)
#> [1] 1
bits(1e-6)
#> [1] 1
mbtc(0.001)
#> [1] 1