Bitcoin Forum
June 07, 2024, 06:35:47 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How would incorrect number of decimals be handled?  (Read 539 times)
Realpra (OP)
Hero Member
*****
Offline Offline

Activity: 815
Merit: 1000


View Profile
March 05, 2014, 03:59:59 PM
 #1

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.

Cheap and sexy Bitcoin card/hardware wallet, buy here:
http://BlochsTech.com
OnkelPaul
Legendary
*
Offline Offline

Activity: 1039
Merit: 1004



View Profile
March 05, 2014, 04:02:53 PM
 #2

Amounts in transactions are integer numbers of satoshis. It is impossible to represent 0.5 or 0.1 satoshi.

Onkel Paul

Realpra (OP)
Hero Member
*****
Offline Offline

Activity: 815
Merit: 1000


View Profile
March 05, 2014, 04:48:34 PM
 #3

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)

Cheap and sexy Bitcoin card/hardware wallet, buy here:
http://BlochsTech.com
Ix
Full Member
***
Offline Offline

Activity: 218
Merit: 128


View Profile
March 05, 2014, 10:47:41 PM
 #4

(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.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 05, 2014, 10:57:09 PM
 #5

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.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 05, 2014, 10:59:23 PM
 #6

(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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!