Bitcoin Forum
May 10, 2024, 11:53:35 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Poll
Question: Which sub-cent solution should be merged?
Neither, I am opposed to both sub-cents and TBC - 3 (30%)
RPC v0 without rounding - 1 (10%)
RPC v1 - 2 (20%)
Both - 1 (10%)
Other - 3 (30%)
Total Voters: 10

Pages: [1]
  Print  
Author Topic: Subcent Payments; RPC ver 0 vs 1  (Read 1415 times)
Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
January 28, 2011, 08:20:38 PM
Last edit: January 28, 2011, 08:38:47 PM by Luke-Jr
 #1

I'm creating this thread to discuss two branches I have, titled RPCv0SubcentInputs and 'neutral'.

RPCv0SubcentInputs merely removes the code which rounds RPC inputs to centi-BitCoins. This breaks compatibility slightly, specifically with any code that assumes the RPC inputs will be rounded. There is also a possibility that if the system's FPU cannot accurately represent the fraction, the input might be interpreted slightly differently than it should be. For example, 0.1 BTC cannot be represented as a binary floating-point number.

"Neutral" bumps the BitCoin RPC version from 0 to 1, prepending (over-the-wire only) methods with "bitcoin.<version number>.", and removes (in principle) all the methods which were marked as "deprecated" in the source. Instead of using floating-point Decimal BitCoin values (BTC), int64 raw/base Bitcoin values are used for all inputs/outputs. This achieves 1) better efficiency, especially on systems without a FPU, 2) no possible floating point precision issues, and 3) low-level is now unit-neutral (BTC vs TBC vs etc). By default, for backward compatibility, the command line arguments default to version 0. To make version 1 calls, prepend the commandline with -rpcversion=1

There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715342015
Hero Member
*
Offline Offline

Posts: 1715342015

View Profile Personal Message (Offline)

Ignore
1715342015
Reply with quote  #2

1715342015
Report to moderator
tcatm
Sr. Member
****
qt
Offline Offline

Activity: 337
Merit: 265


View Profile
January 28, 2011, 08:35:52 PM
 #2

Maybe we can use the same exponent-style encoding we invented for the URI Scheme for manual user input on the commandline and use raw int64 in JSON? It's too easy to append 9 zeros instead of 8 on a keyboard.

RPC results should then return raw int64 values.
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
January 29, 2011, 01:42:13 AM
 #3

Can you back up and describe what problems your patches solve?

Here are the problems I care about:

+ If a user receives 1.000001 bitcoins, there is currently no way to transfer the entire amount somewhere else using either the GUI or the RPC.

+ If a user receives 1.000001 bitcoins, the GUI will tell them they have 1.00.

I don't care about systems without a FPU-- are there any such systems that bitcoin actually runs on?

I don't care about BTC vs TBC.

How often do you get the chance to work on a potentially world-changing project?
Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
January 29, 2011, 03:27:12 PM
 #4

Can you back up and describe what problems your patches solve?

Here are the problems I care about:

+ If a user receives 1.000001 bitcoins, there is currently no way to transfer the entire amount somewhere else using either the GUI or the RPC.

+ If a user receives 1.000001 bitcoins, the GUI will tell them they have 1.00.

I don't care about systems without a FPU-- are there any such systems that bitcoin actually runs on?

I don't care about BTC vs TBC.
The GUI sucks, so I am fine pretending it doesn't exist.

Both solutions fix the other problem you do care about, except possibly that the .000001 fraction is not representable accurately by binary floats.

It's fine if you don't personally care about no-FPU or TBC, but please don't actively fight/interfere with progress. Wink

(FWIW, many older ARM do /not/ have a FPU, and even with systems that do have a FPU, integer is usually faster)

Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
January 29, 2011, 03:28:43 PM
 #5

Whoever voted "Other" could please offer another solution? Tongue

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!