Rational numbers are the superset of the fixed point approach we’re suggesting. They would be a great and clean solution, even more so if we had to deal with exchange between currencies. They would be a significant differentiator in the crowded crypto space.
I just don’t think they would provide enough extra value compared to how much trouble coding them would be, which would still be incomparably easier than getting outside devs learn and use them.
The difference between then and now is that the chatty transaction issue has gone - we are just moving balances about, rather than individual coins. This makes the argument against having lots of small denominations moot - with no overhead, why not have them?
you have not demonstrated any benefit of storing a balance as 2 1/2 words or even attempted to explain why, just say its better for “reasons”
Balances remove completely the notion of separate data objects for each coin or that any coin is different to any other.
Balances are just that one value representing the quantity of something. Why do you want 2???
renaming types as plurals may be worth while but does not change things
Yes we understand that you can abstract it in a form for the APIs that would work
But this issue is the base storage of the balance and the opening up of avenues for bugs now or later on within the backend.
Saying Bitcoin wanted 52 bit so float in java-script could be used is disingenuous really since Bitcoin core is not java-script. And Bitcoin was interested only in a wallet for java-script. SAFE is a millions times more than Bitcoin in functionality and SAFEcoin as well as Bitcoin does not need to use float in java-script as java-script still has integers. And likely to be 128 bit integers in future anyhow.
250 pico “utilising 2 extra bit” is false economy - see below
250 pico will make safecoin look like it is “stupid” . And no as soon as you put it into the code people will look at that and not the front end and put safecoin into the kiddies basket of crypto coin. It will hinder safecoin adoption. It will be known by technical people in the world once they look at safecoin and what it is. We are then talking of multi millions of people who include reviewers and commentators.
There is no benefit to using the 2 extra bits. If you have split storage and try and save the 2 bits then in fact you could end up using more bits in the typical Node.
by doing the ALU work in code (operating on 2 x u32 instead of one u64) you need additional code for the addition/subtraction handling under/overflow and error handling.
this additional code is stored on disk and takes up main memory while running. This additional code base is likely to be more than the 2 bits of many thousand coin balances stored by that Node.
Thus it is false economy to try and utilise those 2 bits and the increase resistance to accepting safecoin
By having one u64 for the 2^32 coins down to nanos will save you code base because
you can actually have it as a signed balance
use signed addition/subtraction
no need for error checking on the addition/subtraction since the result cannot over/underflow the operation.
Thus only negative and too large result testing is needed
tl;dr
one word fixed point for balance is industry standard after learning the pitfalls
one word saves code base
one word allows signed balance since nano safecoin fits in 63 bits
allows reduce error checking over unsigned and large reduction over split addition/subtraction
250 nano is taking safecoin away from decimal and makes it undesirable to financial, technical people, reviewers, commentators
There has been no benefits to a split balance expressed beyond doing it for “reasons”
This is so important - there has been no reasons beyond circular and unstated “reasons” And this comes across as hand waving it away and thinking we are not capable of understanding
Just to be clear we would expect no less. Also for the API Just have the ONE type of coin and that is nanosafecoin and leave it up to the front end to work with it and keep it simple in the front/back ends and the API
It is the core code that we are talking of here and that is why the RFC is put out there so we can discuss the core code too and so world wide experience can be brought to bear on the code base.
There’s only the “Number” type in javascript which is a “double-precision 64-bit binary format IEEE 754-2008 values as specified in the IEEE Standard for Floating-Point Arithmetic”
but yes you can represent integers
“Note that all the positive and negative integers whose magnitude is no greater than 2^53 are representable in the Number”
So there’s an unfortunately practical incentive to keeping total units less than 2^53 because greater than that will introduce issues in basically all javascripts (should we even care about those heathens?!).
Useful disambiguation from this stackoverflow comment - “Yes there are integer values, but there is no integer Type, only Number. Implementation details, such as how they are stored, is not part of the language specification”
I think Fraser will particularly enjoy the last sentence there about ‘implementation details’.
I only rave on these tiny specifics because they do matter. Addition with computers is weird.
The question of the smallest value being micro or nano is pretty much a mute point since we might as well use the maximum decimal that reasonably fits (250 pico is not decimal and so is out of the question since its financial not sensors/protocol/etc) Remember that Bitcoin never expected to be over 10K USD @JoeSmithJr FYI we for instance never refer to our 1 cent as a penny even though I grew up with pound/shillings/pence . Australia is not the only country to never refer to any coin as penny.
Now there has been a bit of talk in the past when talking of tipping that “micro tipping” capability is essential for an economy without advertising revenue. This is not micro as in micro coin but micro $$$ and micro safecoin loses that capability once the coin gets higher than one dollar. And nano safecoin loses that capability once it hits 1000 dollars.
Pretty obvious we need nano safecoin. Its more of a question if anyone ever thinks we need less than one nano safecoin
Point taken but the point is still a front end issue and java-script is still not limited to 2^53
And there are more languages than java-script that can be used for wallets.
@mav, @anon86652309 To design the back end based on one (non-essential) front end language is not good. And java-script has many workarounds anyhow. (Bash script could implement a wallet real easy using 64 bit integers too utilising the CLI)
The back end affects everything and using best practices is more important than pandering to one front-end language.
The back end safety (bug avenues) and code size is way more important. Cheaper in total bit count to “waste the ONE bit” per coin balance, have one variable and save on the Kbytes of additional code base to handle the under/overflows and additional error handling that has to be installed in every Node.
Also the program in memory would need the extra code base for split balances.
Yes this should work, except it should be 4,294,967,295,000,000,000
Indeed, and @neo, Fraser’s point seems valid. If we are trying to design the API to minimise the chances of devs messing up financial calculations, I wouldn’t dismiss a very popular language even if it is only used by heathens (like myself ).
I understand Fraser not wanting to waste bits (the reason he gave for picos ‘under the hood’) and he’s managed to avoid this without making users of the API susceptible to committing programming errors. I haven’t understood the reason for using a split value and at the same time I don’t think it is necessarily an issue (again because I it is under the hood),.
The 52 bit point seems much more relevant to me.
Given @neo’s point about helping devs write reliable code, what this says to me is that it would be wise to do a quick survey of popular and up and coming languages, and see if there are any other bit lengths and issues we should factor into this decision.
At the same time I’m not convinced that we should see the ‘how many pennies needed to represent all of the world’s wealth’ calculation as more than a guide to the upper limit needed for divisibility. I just think that we can deal with extra divisibility later if we need to.
What’s clear though [cough] is that getting this community involved and is all tugging on these issues the way we have is valuable, and it’s a great strength of this project - both the quality and passion of this community, and MaidSafe’s ability and willingness to encourage and make use of it. This is such a great project!
Yes but it wastes more bits in all the code to do the operations to handle under/overflow and adding/subtracting 2 parts and error checking than all the 2 bits of all the coin balances. Each node only has a certain number of coin balances. Say 10,000 balances for the Node is only 4.5Kbytes
BUT the code is now 3+Kbytes longerwith error checking and extra code to handle two sets of operations and conceptualising it for the API. This is stored on disk and takes up memory in the main memory while the Node is running. Thus 6Kbytes is used up.
So all this saving bits results in a net increase in the needed bits used.
False economy
When using 250 pico makes SAFEcoin the laughing stock of the financial and crypto world then what benefit is it?
As you said this is only the API and seems to be passing strings anyhow. So where is the issue?
My big issue is the use of 2 1/2 words to store a conceptually single value which can be stored as a single value saving a significant of code and conversions for the API whichever form it takes.
Since the API is string then java script can do as it pleases. To limit the capability because a java-script programmer is incapable of handling it is the tail wagging the dog. We are creating something to change the world. Not conform to the lowest common factor.
Also as I showed above, if safecoin exceeds 1$ then micro tipping/transactions are not possible. The lowest value will be greater than 1 micro $
I gave a few reasons above why it is
The big point people miss about front end code is that if a mistake is made then it affects only that APP. If you cripple the back end with 52 bits only then nothing can expand it or if you make a mistake emulating the ALU to handle 2 1/2 words and the exceptions. If you introduce storage in the back end that leads to extra code/nett size larger and has many times the avenues for bugs to be introduced then is it wise?
Let the front ends use nano and deal with it.
Now for your 52/53 bit, front ends that do any maths like multiplication/division using float then they will get the wrong answers in an absolute sense many times. Whereas handling fixed point would not without bad programming.
This doesn’t make sense to me when considering the importance of avoiding programming errors. I think we can be pragmatic while changing the world. Let’s at least look at the likely impact of programmers - in various languages - trying to manipulate Safecoin based on the API we provide.
Edit: I now understand your point that your main concern is the back end. I’ll have to think about that - seems both matter, but you are right that the back end is more important.
Also as I showed above, if safecoin exceeds 1$ then micro tipping/transactions are not possible. The lowest value will be greater than 1 micro $
I might have missed this. Are you saying tipping won’t work in units of a millionth of a dollar?
To cripple the capability in an attempt to make bad programmers good programmers when they are converting to display a value has no end to what you can do. Where do you draw the line? Should the core code do all the maths so that we don’t have a bad programmer make a mistake in the front end?
My opinion on this is give the front end programmer something workable. Nano safecoin is more than workable. They are likely using packages & libraries anyhow and I’m sure google has a maths package that handles 64bit numbers. Otherwise someone can create a safecoin library for java-script to solve all the problems. 53/52 bit float is only really good if you add/subtract within well defined limits. Mult/divs can easily result in inaccurate values where integer will be exact in the financial sense. Any fiat multicurrency is not affecting safecoin since the conversion to safecoin occurs after all the multi-currency conversion happens.
We cannot tailor the back end to solve all the potential front end errors. Just provide workable values and let the front-end programmers use their skills and/or libraries. A poor programmer will stuff up even any API result.
Yes both matter but we cannot fix bad front end programmers. Just supply them useful reasonable values and they can work from there and use libraries if needed. But a poorly designed back end affects everybody and the bug avenues means that any update could “silently” stuff everything up and trying to be an ALU with the single value balance is a sure fire way to allow bugs to be introduced in a safecoin update.
Tipping would work, but the desired (some say required) micro $ tipping would not then be possible, it would be bigger than a micro $ and if the coin reached 1000 dollar then it is milli $ tipping.
If we are using overall 62 bits for safecoin then why not use all the available decimal places it can provide for 2^32 coins worth. And that is conveniently nano safecoin. Nano provides micro amounts even when 1 safecoin is 1000. 2^32 safecoins at 1000$ if all existing, is only 429 trillion dollars. What is the US economy today? how many trillion dollars? So yes its sounds crazy to have all safecoin worth 429 Trillion, but we would never have all 2^32 anyhow.
At 1000$ also we would need less than 1 micro safecoin for farming rewards, unless your want Farming to be a minimum of $100/TB and storage costs are higher (2 or 3 times) and to have an absolute minimum of $200-300 USD per TB upload does seem a tad too high
Didn’t you want to offer different units through the api anyway @anon86652309 ? So if JS would use milli (which internally gets multiplied and then ends up in the same functions as nano requests) and not nano as smallest denomination it would just be them who are limited for starters and not all the real programming languages just because of JS…
Cutting down possibilities for all just because of the inability of few doesn’t seem right to me. …
Edit/ps:
While I understand this very well and am just the same it doesn’t mean that one must enforce the solution one favours if there are no serious arguments against the solution a coworker with experience in a similar area suggests
I’m not sure I understand the worry over Javascript. It seems that JS CAN handle the task, the coder just needs to use strings to manipulate instead of a number … correct? Using strings is extra steps, but for any coder who isn’t just starting out, this shouldn’t be a problem. Am I missing something here?
I like the nano safecoin idea … have argued in years past that we need a lot of subdivisions for future scaling and this seems as though we’d be completely SAFE with nano divisions.
Javascript is the second most used language by MaidSafe. What happens when a javascripter does MAX_SAFECOIN_NANO - 50 === MAX_SAFECOIN_NANO and sees that it’s true?
To be slightly less provocative, what is the plan for MaidSafe using javascript and integers more than 2^53?
Strings for all numbers?
BigInt?
Custom types in a library?
I’m not actually worried about it that much. People will manage. @neo is right that you can’t ask to build a robust backend from the basis of a shonky frontend language.
These examples are real. They will happen in real life to real people spending real money.
I still prefer u64 and nanosafecoin as the smallest unit. But let’s not pretend edge cases are trivial or stupid or undeserving.
I understand and agree somewhat with what you are saying here, but these are bad programmers problems and quickly fixed for reasonable programmers who do some testing.
The back end is of utmost and essential use use best practices for it.
I do too, but not called any technical name like nano though . I think it has to try and be easy to be accurate in every language by default if possible.
something not mentioned in this conversation could be embedded systems, many of which may not have 64bit addressable memory. I am not all that comfortable with 2 x 32 bit integer or even a single 64 bit integer. However maybe thinking embedded does favour the (internal) 2 x 32 bit integers, or even 4 x 16 bit or 3 x16 bit or … In any case I am not posing a solution here, just poking around, like many of us.
It is easily if the official JS bindings just contact milli as smallest unit
Actually a large part of my day job is plc programming - and those systems move(d - depending on the brand ofc) to 64 too lately so even though arduinos are 32 bits for now they probably won’t (be able to use safe APIs directly anyway atm) and they most certainly will not handle insanely large numbers of little denominations but just choose the appropriate base unit… (and it’s probably a matter of time until we will see 64 bit there too)
embedded is easy enough. If the device is capable of running a SAFE client then its capable of a simple library that converts a internally used value for “safecoin” into the required API.
This would be a simple library that the programmer writes.
This is what i was trying to say that we cannot cater for every device now. There are simply too many. ARM, MicroChip, AMD, etc etc and they can use different base codes. But they do usually do “c” code so any library is fairly portable between embedded devices.
If they are capable of running a Node then by default have 64 bit integer maths. I do not know of a 32 bit cpu that does not do double length integer
And I gather there will be “c” bindings anyhow.
But again this should not dictate the back-end and using non-standard storage units.