<p>I can't answer for all cryptocurrencies, but for bitcoin, you shoud store values as long and not doubles. The unit of account of bitcoin is the satoshi, a hundred millionth of Bitcoin. Since there can only be 21M BTC ever, that's a maximum of 2.1 quadrillion (2.1 * 10^5) satoshis. That number fits in 64 bits.</p>

<p>For Ethereum, you need 256 bits unsigned integers IIRC.</p>

CC BY-SA 3.0
2017-08-25T23:27:54.777Z
2017-08-25T23:27:54.777Z
alcio
<p>I can't find a "cryptocurrency" stack exchange, and I have a question that spans all cryptocurrencies, in particular, how to handle them programatically - one database column to rule them "all"!</p>

<p>I say "all", because it's becoming super-hard to keep track of them all, so I don't expect anybody to know the whole story.</p>

<p>So, we want to store an amount in the database - the implication for BTC is that we should store values from 1e-8 to 1e8 - but what about other cryptocurrencies?</p>

<p>I'm looking for a value which would be enough for all of the current mainstream coins, and if possible (fingers crossed!) a rationale why that value would be enough for at least 90% of any future currencies that might appear?</p>

<development><currencies><alternatives>
Minimum and maximum values of "all" cryptocurrencies?
bbozo
# Minimum and maximum values of "all" cryptocurrencies?

(Asked by: username_0 on 2017-08-25)

I can't find a "cryptocurrency" stack exchange, and I have a question that spans all cryptocurrencies, in particular, how to handle them programatically - one database column to rule them "all"!

I say "all", because it's becoming super-hard to keep track of them all, so I don't expect anybody to know the whole story.

So, we want to store an amount in the database - the implication for BTC is that we should store values from 1e-8 to 1e8 - but what about other cryptocurrencies?

I'm looking for a value which would be enough for all of the current mainstream coins, and if possible (fingers crossed!) a rationale why that value would be enough for at least 90% of any future currencies that might appear?

**Tags:** development, currencies, alternatives


---

## 1 answers

### Answer by username_1 on 2017-08-25. Score: 1

I can't answer for all cryptocurrencies, but for bitcoin, you shoud store values as long and not doubles. The unit of account of bitcoin is the satoshi, a hundred millionth of Bitcoin. Since there can only be 21M BTC ever, that's a maximum of 2.1 quadrillion (2.1 \* 10^5) satoshis. That number fits in 64 bits.

For Ethereum, you need 256 bits unsigned integers IIRC.


---

