Closed dolphinsd closed 5 years ago
No blockchain that knows what it's doing would go anywhere near floating-point arithmetic, because different machines will produce different answers for simple calculations like A + B.
That's why they all have integer quantities for tokens/coins/assets. A Bitcoin contains 10^8 Satoshis, for example. You can only have an integer number of Satoshis.
In BigchainDB, you model an asset with N fungible pieces/parts by generating a CREATE transaction where the initial amount is N.
@ttmc I understand your point. How does blockchain like bitcoin implement partial transfers. For example, I can purchase 0.00001 of the bitcoin?! Another way to rephrase the issue, how would one implement the usecase described on bigchain? thanks for ideas.
0.00001 Bitcoin = (1e-5) * (1e8 Satoshis) = 1e3 Satoshis = 1000 Satoshis, which is not a fraction.
How does one transfer a fraction of an asset. Let say, I have 1 token, and I want to transfer 0.001 to 100 different people? So I am left with 90 tokens. How do I do that?
The docs seems to put integer constraint on amounts:
The output.amount Rule For all outputs, once output.amount has been converted from a string to an integer, it must be between 1 and 9×10^18, inclusive. The reason for the upper bound is to keep amount within what a server can comfortably represent using a 64-bit signed integer, i.e. 9×10^18 is less than 2^63.