Posts

You don't have to know how it works 99% of the time.

avatar of @edicted
25
@edicted
·
·
0 views
·
6 min read

That's the beauty of technology.

You don't have to know how running water works.
You don't have to know how your car works.
You don't have to know how your computer works.

They just work (until they don't)

Have you tried turning it off and turning it back on again?

That's also the biggest advantage of my programming endeavors. I don't have to know how MySQL database works unless I'm trying to do hardcore optimization. I don't need to know how JavaScript works or how Node.JS works. I find the command I need and tinker with it until it does what I want it to do, and usually that's a "good enough" solution (just like crypto).

That's the advantage of building on top of old knowledge.

No one needs to know exactly how it works to build something new. In the context of my current project, I'm issuing all kinds of SQL commands and I have no idea how they actually work in the background. The 'S' stands for structured. All relational databases use the same core commands. If I moved to another database, most of the code I've written would work there as well, even if the backend was completely different.

This is also an interesting thing to consider with crypto. Technically, we have no idea how the nodes run in the background, and it doesn't matter. All that matters is that nodes don't break any of the rules of the given crypto they are coming to consensus over. Technically, Bitcoin nodes could be written completely differently on various technologies. All that matters is that they reach the same conclusion.

From a corporate capitalism standpoint, they wouldn't understand the advantage of such redundancy. That's just a waste of time and money, right? Capitalism attempts to get from point A to point B as quickly and cheaply as possible.

Crypto is exactly the opposite of that. The redundancy and inefficiency is a feature that promotes unparalleled trust within the network. If you had ten different servers built in ten different ways that all came to the same conclusion, you know that the chance of a bug being somewhere in the system is near zero. If one system gets hacked the others will let that system know immediately. This is the value of robust redundancy.

And that sounds like a lot of work, right? That sounds like a waste of time. Well, counterpoint: what the hell else should we be doing? When all the jobs get automated out the only thing left to do is to create fair systems of distribution for those resources. The legacy economy is not up to the task. Again, all that extra work to be done is a feature, not a bug. There are going to be millions of people out of work with nowhere else to go.

Tinkering with the inner workings.

So the database I'm building for my own crypto/game platform is a little weird. I actually did do some research into the inner workings of MySQL datasets. I realized it will be cheaper to use BIGINT to keep track of money instead of DECIMAL.

Now, when people think money, people think DECIMAL. The definition of money is that it needs to be divisible. There must be fractions of the whole in order for users to divide the currency down to the exact amount they want. USD and other fiat go down 2 decimal places (pennies). $0.01 is the smallest amount possible.

But again, this is just another form of unit bias. If we just measured everything in pennies instead of dollars, there would be zero need to use any kind of decimal when keeping track of money. This is what I plan on doing.

https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html

Taking Hive as an example, I was going to mirror what we do on this network and have 3 decimal places of precision. On Hive 0.001 is the smallest unit of measurement. We can see that this level of precision alone costs 2 bytes of memory on MySQL. Then on the other side of the equation I'd have to decide the maximum amount of money a wallet would be able to hold at any given time. How many decimal places do I need for that? 12? That's a maximum of 999B coins. And it would also cost an additional 6 bytes for 8 bytes total per decimal.

But instead what I'm going to do is just multiply everything by 1000. People are dumb, brains are dumb. People HATE decimals and fractions. How many users bought DOGE because it was "cheap"? A BIGINT in MySQL is also 8 bytes, and even though the minimum unit is 1 instead of 0.001, the maximum unit is massive and gives me more precision.

What is the maximum unsigned (not-negative) BIGINT?

(2^64 - 1)

Why 2^64? Because it's 4 bytes, 8 bits per byte ( 8 x 4 = 64 ) Each bit has two options (true/false 0/1 on/off).

Why -1? Because 0 counts as a number.

That's 18,446,744,073,709,551,615.

So a BIGINT can store a maximum of over 18.4 Quintillion.
Which is x1000 more than 18.4 Quadrillion.
Which is x1,000,000 more than 18.4 Trillion.

More importantly, it is over 19 digits of precision, whereas the decimal only had 15. Also I have no idea how the math is done in the background, but I assume that arithmetic with decimals is slightly more complex than the tricks that can be employed with native integers.

Do you need to know any of this?

Of course not. All you care about is if it works or not. That's the magic of tech. The people building this stuff simplify the output as much as possible so the end-users need to know as little as possible as to how it actually works. Technology as a whole would be useless otherwise.

Unit-bias

One of the biggest mistakes Satoshi-Nakamoto made when designing Bitcoin are the units. Honestly everything should just be measured in the base units of sats. 10 BTC is actually just 1B sats. 0.01 BTC is actually just 1M sats. 0.00001 BTC is actually just 1k sats. It's amazing how badly decimals and fractions get into people's heads to the point of not even wanting to buy Bitcoin simply because of the unit system.

When Bitcoin launched the block reward was 50 BTC. That's 50 BTC per block on average. In reality the code shows this as 5,000,000,000 sats. Ironically, the word Bitcoin and the units of Bitcoin never even appear in the code. The unit Bitcoin is a totally arbitrary unit decided by the frontend, and now we are stuck with it.

So when I tell you that my coin will mint 10,000 mana per 3 seconds, is that a lot? that's 3333 coins per Hive block! Yikes! That's a lot of inflation! RIGHT?!

Yeah well, when Bitcoin launched it was printing 5B sats every 10 minutes. Yeah, that's 8,333,333 sats a second. So on a real level my coin has x2500 less inflation than Bitcoin. Again, all of these units are totally arbitrary and meaningless. All that matters is how the inflation changes over time on a percentage basis, not what it started at.

Another interesting fact to point out here is that there will only ever be 21M Bitcoin total. That's 2,100,000,000,000,000 sats or 2.1 quadrillion. When we look at how big a number a BIGINT can store (8 bytes) each one is well over the maximum number of sats that will EVER EXIST (about x10,000 more storage). Pretty crazy considering databases are littered with millions of these things, and a single one could store all sats in existence. I guess that just the magic of exponents and technology building.

Conclusion

I'm just rambling: you don't need to know any of this, but that's kind of the point, isn't it? The end user doesn't need to know how technology works. We build systems for people who don't need to know the inner mechanics. Anything else would render technology completely worthless. Rather, we continue to simplify everything and "dumb it down" so anyone can use it. Crypto has a long way to go in this regard; we are the Internet in the 90s, but we are trying our damnedest.

Posted Using LeoFinance Beta