Blockchain 51% Attacks... For Dummies

Blockchain 51% Attacks... For Dummies

Blockchains are decentralized public ledgers, made up of nodes that keep copies of...

images (1).jpg

Dang, I'm psychobabbling again. If you're a beginner reading this, then I apologize for that. Let's start again, shall we?

Imagine you're in a bank on a Tuesday morning, standing in front of a long counter. Behind the Counter are ten cashiers, each of them busy with long sheets of paper. These cashiers spend the whole day receiving deposits from the bank's customers, recording them on one end of their "long" sheets of paper and feeding the other end into a beeping machine attached to the counter.

S1300i-1.gif

This machine is a special one, and the way it operates is simple. It's a lot like a photocopy machine or a scanner, really.

It gobbles up these sheets of paper as the cashiers feed it. Afterwards, it extracts the transaction details from them and adds this information into some kind of perfectly organized database.

At the end of the working day, the machine prints out screenshots of how the database now looks. All the cashiers at the bank have to pick up a copy of the printouts, and then staple it to all the others they've collected over the years.

By doing this, the cashiers can mutually agree about the "state" or current condition of the bank's affairs, because they all have matching records that can be referenced and verified whenever needed.

In a nutshell, I have just explained what a blockchain network is, using analogies. Let's use the Ethereum network as an example, shall we? The cashiers are the various nodes that make up any blockchain network. Keep in mind (if you didn't already know) that blockchain networks are decentralized and are made up of several nodes.

fbloc-03-00012-g003.jpg

Anyway, back to our cashier story. The job of these cashiers (nodes) is to collect transactions from users (customers) on the Ethereum network, record them and feed the information into the Etheruem State Machine. At the same time, all the data they hold is "synchronized". This means that once you see the data contained in one node, you've seen it all.

When all the nodes of a blockchain come to an agreement about what the state of the network really is, they achieve what is known as "consensus". Upon consensus, there are no conflicts about what is really happening in the network. Everyone agrees that the information in the database is correct, and all the cashiers can go home to prepare for the next day at the bank.

download (1).jpg

However, there's a catch. What if one of the cashiers decides to be dishonest? What if one of them (let's call him "Cashier A") receives a $100 bill from a customer at the bank? But instead of recording this transaction and paying it into the bank's treasury, Cashier-A slips the $100 bill into his pocket?

sneaky-tom-and-jerry.gif

What happens then? How does the network fix this?

Remember how i told you blockchain networks are decentralized? Well, this means that all of its nodes have some degree of influence over it. Some nodes are bigger, and therefore have a bigger share of control over the network, while some are smaller and have an equivalent share of control.

This is where i explain what 51% attacks are. It is actually possible for Cashier-A to getaway with stealing the $100 bill. Under normal circumstances, all the other cashiers would have seen Cashier-A receive the $100, bill. At the end of the banking day, they'd have checked their printouts of the database's state and realized that there is indeed a missing $100 transaction.

Cashier-F would have raised an alarm saying, "I disagree with Cashier A's account of events, because he's a lying F***"

download (2).jpg

Cashier-A will eventually get kicked out of the bank for his dishonesty. he'd lose his job and company privileges for trying to steal a $100 bill.

However, in a real blockchain network, not all cashiers have equal influence over the state machine. Cashier-E may have 5% while Cashier-B has 20% and Cashier-C has 1% (you get the point). Theoretically speaking, it is possible for one of the cashiers to be so big, that he has more influence than all the others.

If one of the cashiers manages to gain 51% of influence over the state machine, a "majority carries the vote" situation arises, and that cashier can choose to "double-spend" his customers' money, or even refuse to record them altogether.

In essence, that cashier has majority of the influence over the state machine and can "theoretically" manipulate things however he sees fit.

I say "theoretically", because i'm not aware of a successful blockchain 51% attack ever having happened before. However, i am aware of an "almost successful" one