How many bits are in a Bitcoin?

0

I need to track an amount of Bitcoins in a database. Is a UINT64 sufficient?

I'd rather not deal with floating point types, and the rounding errors they end with.

goodguys_activate

Posted 2014-08-12T20:49:32.030

Reputation: 11 898

1The title is catchy but nonsensical. I am guessing you are trying to keep track of an amount of bitcoins (e.g. BTC 3.01329) but that is not clear from your wordingNate Eldredge 2014-08-12T21:44:29.797

@NateEldredge it's tagged development, yes.. I want to know that the max value in a Tx is defined to be 64 bits. I made it clearergoodguys_activate 2014-08-12T21:47:16.440

Answers

6

yes, UINT64 is sufficient, which is in fact how the Bitcoin protocol works internally. The conversion factor from UINT64 to BTC is 1.0e8.

Not using floating point numbers is a very good idea indeed.

njaard

Posted 2014-08-12T20:49:32.030

Reputation: 151