Author

Topic: How would incorrect number of decimals be handled? (Read 563 times)

donator
Activity: 1218
Merit: 1079
Gerald Davis
(Say we keep it as integer but 0 becomes = 0.001 satohis (since few will have even 1 btc by then)
OR we switch to some non-int format like string... impossible to know)

A string is just a sequence of 8 bit values--same as an integer, it's all about how you interpret it. While it is easy to say you can increase the divisibility of bitcoin, it would involve a consensus on reinterpreting the value of "1" as not meaning "a satoshi" but "something less than a satoshi". This will be very difficult to do if there is a proliferation of embedded devices. Alternatively, a maximum transaction amount could be set (something far beyond any probable transaction size), and then anything above that is less than an original satoshi. It still requires reinterpretation, but it does not explicitly break backwards compatibility.

Bitcoin supports versioning of tx and blocks.  If there are future breaking changes they would be new versions.   ver1 transactions and ver2 blocks (the current right now) will never have a breaking change.  It is possible that at some point in the future ver 1 transactions and ver 2 blocks will no longer be supported but they will remain EXACTLY as they are now until the day (block) they are no longer supported.  Bitcoin is a network of consensus it simply can't work any other way.
donator
Activity: 1218
Merit: 1079
Gerald Davis
Amounts in transactions are integer numbers of satoshis. It is impossible to represent 0.5 or 0.1 satoshi.

Onkel Paul
Hmm yes you have a point, even if it changed and my device could be told I would have to guess the exact format used in the future 10-20 years in advance.

(Say we keep it as integer but 0 becomes = 0.001 satohis (since few will have even 1 btc by then)
OR we switch to some non-int format like string... impossible to know)

Transaction and block formats supporting versioning.

The current version for transactions is ver 1.   When creating a tx the wallet has to specifically set the version number.   If the the tx format was changed it would have a new version.   If the change was backwards compatible then ver1 transactions would still be valid (i.e. wallets can create either version 1 or version 2 addresses).  If the change was not backwards compatible then a version 1 transaction would simply be invalid and dropped by the network (i.e. after block X only ver2 transactions are valid).

In the former your device would continue to work although it could not take advantage of the newer ver2 transactions.  In the later scenario your device would be obsolete if it couldn't be reprogrammed.


The scary thing is you don't already know this.   This (and knowing that the network records values in integers as satoshis) is kinda Bitcoin Developer 101 level stuff.
Ix
full member
Activity: 218
Merit: 128
(Say we keep it as integer but 0 becomes = 0.001 satohis (since few will have even 1 btc by then)
OR we switch to some non-int format like string... impossible to know)

A string is just a sequence of 8 bit values--same as an integer, it's all about how you interpret it. While it is easy to say you can increase the divisibility of bitcoin, it would involve a consensus on reinterpreting the value of "1" as not meaning "a satoshi" but "something less than a satoshi". This will be very difficult to do if there is a proliferation of embedded devices. Alternatively, a maximum transaction amount could be set (something far beyond any probable transaction size), and then anything above that is less than an original satoshi. It still requires reinterpretation, but it does not explicitly break backwards compatibility.
hero member
Activity: 815
Merit: 1000
Amounts in transactions are integer numbers of satoshis. It is impossible to represent 0.5 or 0.1 satoshi.

Onkel Paul
Hmm yes you have a point, even if it changed and my device could be told I would have to guess the exact format used in the future 10-20 years in advance.

(Say we keep it as integer but 0 becomes = 0.001 satohis (since few will have even 1 btc by then)
OR we switch to some non-int format like string... impossible to know)
legendary
Activity: 1039
Merit: 1005
Amounts in transactions are integer numbers of satoshis. It is impossible to represent 0.5 or 0.1 satoshi.

Onkel Paul
hero member
Activity: 815
Merit: 1000
What I mean exactly is that right now Bitcoin has 8 decimals going from 1 bitcoins to 1 satoshis or 0.000 0001 bitcoins.

In the future especially, for nano-payments between automatic software using payment tunnels, we will likely add more decimals.

My question is: If a client or device made a mistake today and say sent 0.1 satoshis (assuming this was NOT treated as dust/ignored) which would happen:
(or more realistic maybe: 1.000 0000 1 btc)

1. TX is invalid and simply ignored/could NEVER be in a valid block?
2. TX is valid, amount below satoshis/"rounding error" becomes a miners fee?
3. Amount is lost, goes through as a 0 btc TX (or 1.000 0000 in realistic example).
4. Something else?

Thanks in advance.

Why:
I'm programming a device, similar to say a Trezor, that cannot be reprogrammed later and cannot access the internet on its own.
The device could trust information about decimal places from an untrusted source, but I am just wondering if this could backfire.
Jump to: