Hacker News new | ask | show | jobs
by billman 2178 days ago
Just curious, how would you manage bitcoin fractional shares.
3 comments

Bitcoins are represented as integers. A whole Bitcoin is 100MM satoshis.

Typedef int64_t CAmount;

Static const CAmount COIN = 100000000;

Static const CAmount MAX_MONEY = 21000000 * COIN;

https://github.com/bitcoin/bitcoin/tree/master/src/amount.h

Why would you need fractional bitcoin shares? The smallest unit of bitcoin isn't 1 bitcoin (like with stocks), it's 1 satoshi or 0.00000001 bitcoin.
Arbitrary precision arithmetic.