0

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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.