Byzantine Generals Problem and The Double-Spend Debacle

in LeoFinance3 years ago

Byzantinegeneralsproblemdoublespend.png

The Byzantine Generals Problem is a networking problem posed during the birth of the Internet itself. Yep, that's right... all the smarty-pants were thinking about this issue right from square one, and it was thought to be a problem that was literally IMPOSSIBLE to solve. Every year that it went unsolved, it was thought to be even more unsolvable than the year before. After all, if the top minds of the world couldn't crack it after all that time, surely it must be impossible!

Byzantine Generals Problem: Medium.com

It is a fictitious problem, but one of the hardest problems of all time. It was first referenced in the paper titled ‘The Byzantine Generals’ Problem’, published in 1982.

Imagine divisions of a Byzantine army, attacking a completely encircled city. To proceed, the generals of each division, who are dispersed around the city’s periphery, must agree on a battle plan. However, while some generals want to attack, others may want to retreat.

In the official description of the Byzantine Generals’ Problem (which you’ll find on page three of the aforementioned paper), there is a leader-follower set-up. In order to achieve consensus, the commanding general and every lieutenant must agree on the same decision.

Byzantinegeneralsproblem2.png

Byzantine Fault Wikipedia

A Byzantine fault (also interactive consistency, source congruency, error avalanche, Byzantine agreement problem, Byzantine generals problem, and Byzantine failure) is a condition of a computer system, particularly distributed computing systems, where components may fail and there is imperfect information on whether a component has failed. The term takes its name from an allegory, the "Byzantine Generals Problem", developed to describe a situation in which, in order to avoid catastrophic failure of the system, the system's actors must agree on a concerted strategy, but some of these actors are unreliable.

Byzantinegeneralsproblem.png

Byzantine Generals Problem: Coincentral.com

The Byzantine Generals Problem is a term etched from the computer science description of a situation where involved parties must agree on a single strategy in order to avoid complete failure, but where some of the involved parties are corrupt and disseminating false information or are otherwise unreliable.

You’ve come at just the right time – we’ve got this city surrounded but have an unfortunately complicated logistics issue here. We have two armies, one on each side of the enemy city, and we need to attack at the same exact time. The city is strong enough to defend itself against one of our armies, but not strong enough to defend against two at the same time. If we don’t attack at the same time, we lose. And losing sucks.


Now clearly, this is not a problem based in reality.

It's an analogy.

This is a networking problem only. If we actually had an actual city surrounded we wouldn't be sending scouts through the middle of the city, and the city wouldn't allow anyone in or out during a siege to begin with. Coordinating an attack in real life is as easy as sounding a horn and making sure you can trust your allies.

Rather, this is a trust/reputation issue within the confines of a decentralized network. It's actually pretty impressive that people were even thinking about this stuff right from the beginning, and because the problem was so improbable to solve the entire Internet was centralized into the technocracy we see today.

bitcoinbubble.jpg

When Satoshi Nakamoto published the whitepaper for Bitcoin, he was laughed off the damn stage. Those who were educated enough to even begin to understand what he was claiming knew that the whitepaper solved the impossible problem of the Byzantine Generals.

Because this was an impossible feat and Nakamoto was an anonymous entity, it's easy to see why it was so completely unbelievable that he had solved it. One would only expect the top minds in the world to come forward with a solve for this and take credit for it themselves. This is the kind of thing you win a Nobel Prize for, after all.

But she did solve it!

An ugly solve, but a solve nonetheless. Anyone with an interest in pure mathematics and definitive proofs would be repulsed by such a fumbling answer, but nobody said it had to be a good solution. It simply had to be good enough.

miningpoolsmine.jpg

How? Mining.

Bitcoin mining is a lottery system that secures the network and expends energy in addition to requiring an overhead cost of hardware to mint the lottery tickets. This is how the unsolvable Byzantine Generals problem was solved. Again, it's an ugly solve, but it is a solve.

The reason this post is so appropriate is that I just recently talked about counterfeiting and how Bitcoin has solved that issue as well, which is much more impressive than the idea of a 21M coin token cap.

51% attack

This is the only thing that can break consensus and destroy the Bitcoin network. Even if this happened Bitcoin would have still solved the Generals problem, because this is the most obvious and allowable point of failure; if you can't trust more than half the network then the network is invalid to begin with. It's kind of like how Steem got attacked with sock-puppet witnesses and we had to fork to Hive to correct it. Pretty impressive when you actually think about it we are all still here to tell the tale.

doublespendproblem.jpg

So how is it done?

The 51% attack is also known as the double-spend attack. In order to achieve this attack, one must have enough hashpower to spend Bitcoin and then rollback the chain to a previous block and fork to a new chain. Sounds complicated? That's because it is! (Not really).

Imagine we controlled a huge majority of hashpower for any POW coin. Theoretically, we could mine two different blocks at the same block-height. This means we could mine two different blocks that have the same block number, effectively forking the entire network into two different chains.

How does the network know which fork to pick?

Usually mining software will follow the chain who's difficulty solved the hardest problem. In the context of Bitcoin, this means more leading zeros at the beginning of the block hash. The more leading zeros one randomly gets when constructing these lottery tickets, the harder the solve.

Therefore, if we were able to solve two different blocks for the name blocknum and spend our Bitcoin on both blocks we could theoretically spend our money twice to game the system. This is why centralized exchanges often require THREE "block confirmations", meaning the transaction in question is three blocks deep on the blockchain, which would be INCREADIBLY expensive and risky to double-spend once the transaction is buried that deep.

Why is it risky? Because the amount of energy and time you'd have to spend reversing 3 entire blocks is absolutely massive, and there's also no guarantee you'd get lucky enough to pull it off anyway. This is a lottery after all and block solves are 100% random. By the time you mined 3 blocks to take over the chain Bitcoin may have posted 3 more blocks, meaning you just wasted all your time and money and the chance of succeeding in this attack is even worse than before.

Orphaned blocks

This is the key to attacking the Bitcoin network or any POW coin. We must mine a fake block that we plan on being invalidated, spend our Bitcoin in exchange for something of value that can't be taken away from us (probably crypto), and then allow the block we mined to become invalidated by the other block. In essence, we'd create a temporary fork in the Bitcoin blockchain that would soon be destroyed and no one in the network would continue building from that orphaned block.

It becomes clear that even though this is a "counterfeit adjacent" problem, it is still not technically counterfeiting. This is because at the end of it all the Bitcoin network still has a cap of 21M coins and no extra Bitcoin has actually been minted, we were just sneaky enough to spend our money twice by orphaning the block in which we spent our money and received something of value in return.

cryptoadoptioncurve.jpg

How is this scam avoided?

Well, we do what centralized exchanges do: we wait. Every time a new block is created on the Bitcoin blockchain that makes all the older blocks even more secure than they were before (which is actually quite secure). Honestly, this isn't something people have to worry about unless they are accepting payment for a very large sum of money. In fact, vendors who accept Bitcoin or other POW coins as payment in the future will likely allow zero confirmations to occur just to speed things along.

That's right... even if a transaction has simply been broadcasted to the Internet and hasn't even been confirmed on a block yet, that still has pretty good security. Simply broadcasting the operation to the network is going to be good enough for small transactions, as the chance that people are going to try and game the system is pretty low.

Think about it this way: are you going to hire a security guard just because people are stealing from your store? What if the salary of the security guard is more expensive than simply letting a few bad apples steal from you? You're probably not going to engage in such a blatantly losing proposition unless "it's the principal of the thing" is what's driving the decision.

Similarly, why would anyone require Bitcoin confirmations to be secured on the blockchain when they can see that the operation has been broadcast immediately? What are the chances that one of your regulars would walk out of the store and invalidate the transaction before it was put on a block? Probably pretty low... and if they came back to your business you'd obviously have words. In addition, the Lightning Network may solve this problem entirely with instant and cheap transactions (again at the cost of security). Security is only required for huge amounts of money at one time.

securesecurity.jpg

Conclusion

So the next time someone tells you that Bitcoin is a bubble and it's value is founded on "nothing", you can tell them actually the value of Bitcoin is that it's literally impossible to counterfeit because it solved a math problem that was thought to be unsolvable for decades.

DECADES

1982-2009, 27 years: Just think about that for a tick.
The Birth of Bitcoin was the birth of the decentralized Internet.
This will only be fully obvious in retrospect after it happens.
The value of such a thing is limitless and priceless beyond measure.

Posted Using LeoFinance Beta

Sort:  

I got a math problem for you:

3 guys go into a motel.
The clerk says $30.
Each man pays $10.
The manager comes in later and says $30 was too much give them back $5.
The clerk thinks 5 doesn't divide by 3, so he puts two in his pocket, gives each guy $1.
So, each fella paid $9.
Times 3 is $27.
$2 for the clerk makes $29.
Where is that missing dollar?

How fascinating that this riddle can simultaneously double count the bellhop's tip while ignoring the $3 in everyone's pocket to get a $1 discrepancy and fool everyone.

I've been asking people that question since the 8th grade, good to finally have an answer.

27+2=29 is an unrelated truth.
The manager told to give 5 back. That means 25.
So 27-25=2.
Here is your 2 ;)

Posted Using LeoFinance Beta

{LOL}

Massive foulness at play. The new bill (25$) is different from the old bill (30$). Manipulation with simple math :)

Posted Using LeoFinance Beta

That timing though... With the bitmex rumors about a double-spend

BitMEX went on to tweet, "A transaction in the losing chain sent 0.00062063 BTC to the address 1D6aebVY5DbS1v7rNTnX2xeYcfWM3os1va, and a transaction in the winning chain which spent the same inputs only sent 0.00014499 BTC to this address."

lol wow... look out $21 got double-spent. God these idiots... and how long did it take for that block to get orphaned? what did the "attacker" get with his $21? I'll tell you what he got: nothing. The chain likely got rolled back before the person who received the $21 gave the "attacker" anything.

Nice catch though I probably wouldn't have seen this otherwise.

It wasn't even a double-spend, it's just how bitcoin works and bitmex is the one paying that extra $21 from their own pocket to the user. That's the risk they take when requiring only one confirmation.

lol those guys only require one confirmation?
silly.
users should be attacking them on purpose.

I always ask myself how they don't get abused. All you have to do is attempt to double spend, with one of the transactions going to yourself.

The one that goes to bitmex should have a lower fee, then you rinse and repeat. Maybe they only do 1 confirmation for low amounts?

cointelegraph did a clickbait article, so it was talked about in the crypto twitter. Andreas was really pissed off :D

when i seen the news this morning i thought, did i read about this just few hours ago or did i dreamed it :)

A super interesting article you wrote here which taught me something about BTC that I never really researched. Well, back in 2013 I read about this but forgot about it again. Your conclusion is cool, I use those arguments when I try to explain BTC to someone who doesn't know crypto. That said, I usually start at why digital money is like the digital numbers on someone's fiat bank account :)

Agree: the solution is not super nice with all this energy consumption and the number of transistors we have to create. That said, if we can turn all these datacenters to use green energy only, we already made a step towards a better solution :)

What do you think of the few large BTC miners and the possibility for these companies to work together forming a 51% majority? Don't know the exact number of companies required, but this can't be a lot these days.

Posted Using LeoFinance Beta

Even if miners conspire to 51% attack the network all they are doing is destroying their own investment. It's a losing proposition. If Bitcoin starts getting 51% attacked then people will require more block confirmations. For example, it's pretty much impossible to roll back the chain after it is 10 blocks deep (instead of the standard 3 confirmations exchanges currently require).

Love reading you.
The real problem is scale.
The Trilema (phrased by Buterin) Security,Scale, Decentralized.
So far we can't have it all.

Posted Using LeoFinance Beta

In my opinion this "Trilema" is a farce.

There are only two variables: Scaling and Decentralization.
Security is connected to both variables.
More scaling means less security, more decentralization means more security.
There is no way to sacrifice security to gain decentralization.

Decentralization opens the network and we need to fight abuse.
If we secure and close the network with permissions we gain security over decentralization.

So you are agreeing with me?

There is no way to sacrifice security to gain decentralization.

Security and scaling are the same variable (inverse).

Higher security always means less scaling and higher decentralization.
Lower security always means more scaling and lower decentralization.

I think I don't get it. Isn't permission and permissionless the secutiry sacrifice for decentralization?

I get what you are saying now. But you look at security as an enabler of decentralization.
I think the Trilema looks at it from the network access perspective.

all they are doing is destroying their own investment

You have a point. That said, even the Steem chain isn't destoyed after what happened early last year. Still that coin is in value worth more than HIVE. The land of crypto is not really straightforward, I think.

Steem was destroyed you just can't see it in the token price.
Do you realize how much money Justin Sun had to pump into it after we left in order to save face and keep it afloat?
There's a reason he stole 26M Steem from investors: he knew they would all be dumped.
Also that wasn't a double spend attack so quite a bit different situation.

I realise Steem wasn't a double spend attack. This example was to show that in crypto space one can attack, centralise, play dirty games and all, whilst the token price still is up. Sure, it did cost Justin money. But you don't think others are buying into Steem continously because of prices not coming down? Many in crypto space don't really look at the chain itself. They just buy for whatever reason. As they sell for whatever reason. At least it appears to me like that :)

100%

All short term price action is simply speculation.
Justin Sun spent money yesterday with the intent of making money tomorrow.

Justin Sun spent money yesterday with the intent of making money tomorrow.

Thats the business man approach :)

The more the network grows, the harder it gets to double spend which at this point it seems impossible. Gina do my research on the bizantine problem seems quite interesting. Regards champ!

Would be cool to get to zero block transactions and jack some people for some satoshi’s lol.

I also didn’t realize that satoshi was a woman. That’s cool or a typo?

Posted Using LeoFinance Beta

bitcoin might become so institutionalized that we won't recognize it in a few years, depends on what the new administration does

Posted Using LeoFinance Beta

Excellent description of the fundamentals of Bitcoin.

Everyone talks about "blockchain" as the technological revolution but blockchains had been around for ages.
It was solving the double spend / Byzantine General problem using not pure maths but game theory that was Satoshi's brilliant innovation.

Posted Using LeoFinance Beta

This is a phenomenal post, @edicted! Too good, really, for the $40 it earned... not to discount the medium one bit. Thank you for taking the time to explain these things better than I've seen yet. I'm not a "newbie" per se, but I certainly feel better equipped now to discuss Bitcoin with the staunch fiatists around me. Cheers! :)

Posted Using LeoFinance Beta