PYMNTS Crypto Basics Series: What’s a Blockchain and How Does It Work?

What Is a Blockchain and How Does It Work?

Bitcoin, blockchain and cryptocurrency are words that most people have at least heard of since the industry exploded into the mainstream public consciousness in 2021.

Over the course of this series of articles, we’ll be delving into the basics of the industry, providing an introduction to crypto that will give you a solid grounding in the technology and a lexicon for its terminology — cryptographers should never be allowed to name anything the public will eventually need to know — in short, enough to understand what people are talking about and decide if you want to learn more.

What we are not going to do is talk about regulation, finance or investing — you’ll find that elsewhere on PYMNTS.

So, what’s blockchain?

At its most basic, a blockchain is a digital mash-up of a database and a ledger. Think about a checkbook full of paper checks. Remember the little booklet where you recorded the number of the check, the date it was written, who or what it was for, and the amount it was for? Write it in pen so it can’t be erased, and you’ve got the bare bones of a blockchain — a record of transactions (the checks, in our analogy) that can’t be deleted or changed.

But it is a digital ledger with no central authority — there’s no bank to stop or reverse payment. Once it’s been cashed, there’s no going back. There’s a word for that in cryptography: immutable. It means something that cannot be changed over time.

Immutability is why a blockchain can’t be forged or censored.

That database part is broader than the checkbook’s memo section. A blockchain can hold essentially any data or media that can be digitized. That can be a unit of currency, a picture of your cat, a video of your kid, a record of your medical history — you name it. The only limit is the file size.

The Blocks of Information

The word “blockchain” is pretty descriptive. Each block is a new link on a chain attached to a wall (the Genesis Block — more on that another time). Add a link and the chain gets longer; cut a link and the chain is broken and useless. If anyone tries to change the amount written on a check before cashing it, you’ll know because your checkbook ledger does not match your bank account balance.

Think of each link — block of data — on that chain as a check. You can’t change what’s written on it. But something about the transaction it represents needs to be changed. Let’s say you wrote a $100 check, but the doll you wanted was $120. Or they sent you a smaller doll than you ordered. The first check (let’s say No. 101) is immutable, so the only way to change the transaction is by writing a new one.

But if you’ve written several checks since then, the payment for the rest of the doll will be check No. 104. Your account balance will reflect those checks’ amounts, and the memo for check 104 will say something like “paid too little for the doll bought by check 101.” Or if you overpaid, the refund will be entered into the checkbook ledger as a deposit representing the overpayment in check 101.

OK, enough with checks.

Each block on the blockchain is the same size — in the case of bitcoin that is 1 megabyte. Each block will take as many transactions as fit on it. So, a lot of records of an exchange of money, but not as many cat pictures. A new block is added every 10 minutes.

Building the Chain

Just like a chain’s links are physically attached to each other, each block is connected to the ones before and after it. This is where the cryptography part of cryptocurrency comes in.

Each block comes with what amounts to a serial number and a timestamp that keeps that block in its proper place on the blockchain.

The way a block is identified is by taking what amounts to a cryptographic picture of the transactions on it — as well as the block preceding it. This “photograph” is then hashed.

A cryptographic hash is a type of math problem that turns a data file into a code in a predictable way. So, hashing a block of 10 cat pictures, they will always produce the same code — a “hash” of that information. Alter what’s on that block in any way, no matter how small, and the hash produced will be very, very different.

Creating a hash is very simple, mathematically speaking. Reversing it — taking that hash and turning it back into 10 cat pictures — is so hard that it is effectively impossible with modern computing technology.

So, the hash produced by each block of transactions is a picture of those transactions and the transactions on the block before it. That means that in order to change a block 10 back on the chain, you would have to rewrite every one of those links.

Decentralized Data

There’s one other main way that the record of the transactions on each block of a blockchain become immutable: decentralization.

A bank’s record of your checking account is stored on a computer, and with the right access can be changed or deleted with a few clicks of a keyboard.

Blockchains get around this by storing that chain of transactions in many different computers owned by different people in different countries. With the right software, anyone can create a bitcoin “node” — a computer running a program with a complete copy of the entire blockchain. Nothing — not even a court order or threat — can affect the blockchain if enough copies exist in enough different places.

To keep the blockchain accurate, each block is added to all nodes simultaneously, timestamping it and verifying that the hash shows it is in the correct order. That requires an agreement by all the nodes that the block is accurate and should be added to the blockchain.

That is controlled by a “consensus mechanism.” There are several different consensus mechanisms, and the one used by bitcoin is called “Proof-of-Work,” or PoW. It’s the reason running the bitcoin blockchain creates such a staggering amount of pollution — it currently uses more power than Ukraine does in a year.

Sign up here for daily updates on all of PYMNTS’ Crypto coverage.