Blockchain: What’s A Blockchain?
In today’s post, we are going to take a step back from looking into crypto trading, and look at the underlying technology. We will answer the question, what the hell is the blockchain? If you’re new here, or just want to get to some free crypto, you can check out my previous blog Getting Some Free Starter Crypto.
For the usual disclosure, I am not a financial advisor, I don’t even work in finance at all. My day job is as a telecommunications software engineer. Treat everything you read here as some educational resources and not financial advise. Some of the links you find on here will also be affiliate links, so using them will benefit the both of us.
Blockchain: A Chain Of Blocks?
The blockchain does exactly what it says on the tin, it is a chain of blocks. What makes it different from just digital Lego, is how each block is cryptographically dependent on the previous ones. This leads to basically a chain of custody for everything that is done on the block chain, and once something is there, it become nearly essentially to change it.
This is why a block chain is very secure, and makes for a good underlying technology to run as a crypto currency ledger. We talked about crypto wallets in the previous blog, and a wallet leverages a blockchain ledger to track transactions and balances.
What Is A Block
A block within a blockchain can be essentially anything. When you look at something like a crypto currency, a block would contain all of the transactions that are being processed in the given timeframe. For Bitcoin (BTC), the block time is about 10 minutes, so every 10 minutes a new block of transactions is solved and added to the chain. More on that later.
A block doesn’t just have to contain transaction data however. Smart Contracts are blocks of code that are placed on the block chain to execute autonomously. This is a topic all on it’s own, which will be covered in a later blog. For a quick example of what a Smart Contract can do, one just has to look at something like a decentralized token exchange where one person sends off one type of token to the contract, someone else sends a different type, and the contract automatically does the exchange and hands each person their respective tokens. No person was involved in the middle, and everything is done on the block chain, so it becomes vastly more secure and fast to handle exchanges like this.
Other companies like Walmart are using blockchains to track inventory movement to enhance things like food safety. Essentially if it’s something that exists as data, it can be placed on a blockchain.
A Closer Look
We now understand a little bit about what a blockchain is and how it’s used. Now let’s take a closer look at how it’s actually implemented. We’ll use Bitcoin (BTC) as our example, as it’s the most well known and one of the easier one’s to understand.
Please excuse my poor artistic skills. This is what an example block inside of the chain might look like. It has a reference to the previous blocks hash value, all the transactions taking place within the block, the solution to the cryptographic problem, and the resulting hash.
First up is the previous block hash value. This is what links this block to the previous one in the chain. The hash value from it is used as the start of this block. Next up we have the list of all the transactions being processed in this block.
The last two bits of the block are what are done by the miner. To understand what those last two fields are we need to jump to the next section.
Miners and Block Solving
This all applies to Proof of Work (PoW) type blockchains. Proof of Stake (PoS) and other types will be covered in a later blog, but to keep it simple, we’ll stick with our Bitcoin (BTC) example.
When a block is solved, the miners all start creating the next block and stick the just solved block’s hash into the previous field. They then pick the transactions to go in it, and populate the block data with all of them. Then they get to work solving the cryptographic problem.
The miner takes the block data, and a random guess, and runs it through a big fancy algorithm. For Bitcoin (BTC) that algorithm is SHA256, but the algorithm varies depending on the blockchain. The algorithm takes all of it, and spits out an answer, with the goal being to get an answer that is below a certain threshold. If the hash is below that value, the block is considered solved, and the miner sticks it out onto the chain. If it’s above the threshold, they guess again.
The first miner to solve the block gets a reward, and generally part of the transaction fees as well, depending on the network. This is the incentive for miners to maintain the network.
Once that block is solved, it is on to the next block, and this repeats forever. I’ll have another whole blog dedicated to just mining,
Multiple Chains in the Blockchain
With what we know now, one has to ask the question, what happens if there are multiple chains that get created by multiple blocks getting solved at the same time?
Let’s take this example, we have block 1 and 2 in the chain, but then we have 2 miner’s that both solve block 3 at the same time with a different answer. How does this get resolved? We’ll each miner on the network is going to start working on the next block based off whichever block 3 they received first. Once a block 4 has been solved on either of those chains, it becomes the longest solved chain and becomes the official chain.
So if we get a solved block off 3B, 3A is dropped out and all the transactions for it are returned to the unprocessed queue. It’s an important thing to note, because you never want to trust that your transaction is solid until after a few blocks have passed and you’re transaction is well deep into the chain.
While a blockchain is a good secure way to store data such as a crypto currency ledger, there are some security considerations that need to be considered.
The first is the longest chain issue. What happens if someone decides to go back and change the blockchain? Is that even possible? Yes and no. It is possible for an organization with an immense amount of hash power to be able to change the last few blocks if they really wanted to. But it would be very difficult.
It takes about 10 minutes to solve a block given the power of the entire mining network of Bitcoin (BTC). If someone wanted to change something that happened 3 blocks ago, they have to re-solve that block, and then generate 4 more new blocks, before the network can generate more blocks and push it even further back. It was long said that 6 blocks was the safe zone, as it should be impossible for any one group to solve 6 blocks on their own, but BTC Guild has managed to pull off mining 6 in a row in the past, so it’s something to watch out for.
For a decentralized blockchain, like one used for a cryptocurrency, it’s also important not to let all the power fall into the hands of a small group. If one were to control over 51% of the network, they become the dominant point and essentially it becomes centralized around them. Most modern cryptos have things in place to punish people who misuse the blockchain, such as burning some of their tokens, but you always have to be vigilant.
You also have to be cautious about software bugs. Especially when it comes to things like Smart Contracts. There are plenty of news articles where a hacker has managed to drain funds out of one of them, which is why you should try to look for open source projects with large communities. The more eyes on a given bit of code, the less likely there is for a defect to slip through the cracks.
I hope this general overview of what a blockchain is and how it’s useful for things like crypto currency has been beneficial. I have plans to expand out parts of this in later blogs, things like Proof of Stake (PoS) blockchains, mining, and other topics related to it, so stay tuned for more.
If you enjoyed this content, come back every Monday through Thursday for fresh Crypto content. If you have any comments or questions, feel free to email me a email@example.com, use the Contact form, or hit me up on Twitter or Facebook.
Missed some of the earlier posts, here are some related ones I think you’d enjoy: