What is the Blockchain?

Academind by Maximilian Schwarzmüller
A free video tutorial from Academind by Maximilian Schwarzmüller
Online Education
4.6 instructor rating • 23 courses • 1,180,042 students

Lecture description

We already wrote our first Python code, but the course comes with a special project where we will be able to apply our new knowledge - The Blockchain. Let's have a closer look at that now!

Learn more from the full course

Python - The Practical Guide

Learn Python from the ground up and use Python to build a hands-on project from scratch!

17:31:57 of on-demand video • Updated July 2020

  • Students can take advanced Python courses and build real projects with it
  • Students may build upon the Python and Blockchain knowledge gained in this course and start working on their own Blockchain
  • Students can dive into Web Development or Data Science with Python
English You've probably heard about Blockchains or at least about Bitcoin and cryptocurrencies in general. Bitcoin is a cryptocurrency and cryptocurrencies are based on the Blockchain technology. The Blockchain technology can sound very abstract, but in the end a Blockchain is just a distributed data storage. So the same copy off the data is kept on multiple machines which are connected and each data storage, so on a machine, the Blockchain is just a chain, a list of data stores (containers); the so-called blocks, which are in turn connected to each other. So the order of the blocks matter. Every block is really just like a folder on your system which contains some data. It's not technically a folder but you can think of it as one. So we got all these folders where each folder knows about the folder before it. This builds up a chain, so the order does matter. Then the whole folder holding all these sub-folders, this is your Blockchain. What's inside a subfolder? That's the data stored in the Blockchain and the Blockchain is not limited to transactions. As you'll learn, the Blockchain is a data store and a single block in the end can hold any data you want. This could be some text. This could be a number. This could be a program you can execute or, as in the case of Bitcoin, it can be a list of transactions. More on that in a second. We of course don't just have one block, we have multiple blocks in a Blockchain. The interesting part is that they know about each other to ensure that you can't manipulate data in blocks. Because it's distributed across multiple machines, you want to make sure that the machines can check each other. Each block receives a hash, or is hashed. A hash simply is some long text, you could say, that is generated automatically from all the parts that make up the block. So if you've got a block with the data 'Hi I'm in a block' and then, let's say, you have some metadata in that block like a unique ID for every block, then you could take both, use some hashing algorithm (we'll use plugin for that in this course) and then it spits out some text and you'll always get the same text for the same inputs. The hash, as it is called, is stored in the next block. So whenever you change the previous block, the next block will detect, "Hey, the hash I stored doesn't match the recalculated hash for that updated data", because the same input yields the same output. If you change the input, you change the output and therefore the next block, which stored the old hash for the old input, would recognize that something went wrong. That is an important security mechanism and this is how the Blockchain is built; you've got all these blocks and the next block always knows about the previous block. Now that's a lot of theory. What's a cryptocurrency then? A cryptocurrency is the most prominent use-case of a Blockchain. A cryptocurrency is really just something which uses the Blockchain technology. If the data you store in a block is a list of transactions, and a transaction is basically just a piece of information where you say who is sending how much to whom (these three things are important), if you've got a list of such transactions in a given block, you obviously can take advantage of the security mechanism that these transactions can't be edited without the next block recognizing it and therefore now you have a cryptocurrency; you have your own cryptocurrency managed in your Blockchain which is distributed across many machines and which is therefore secured. This is what's used by Bitcoin, Etherium, Ripple and all the cryptocurrencies you know. So back to the picture from before, our data now simply is that list of transactions; it's that simple. What are the coins then? Well, the coins are just something you come up with. You can get the 'things' you're transferring in the transactions whichever name you want. Coins are transferred with transactions; that's all. You have to, from and how much. The 'how much' is your coins and you can name them whatever you want. The coins normally can't be changed to other real currencies unless you find someone of course who says, "Hey, please send me some coins and I will give you this amount of U.S. dollars, or this amount of Euros". This is how it works. The worth of the coins is really just what people think it is. This is how it works for all these cryptocurrencies. That also explains their high volatility. It's a new market and the true value of these things is still something we have to evaluate. Finally, coins are created with mining because of course we can send them around, but this doesn't create them. Mining is a crucial part and mining is how new blocks are added. We will have open transactions where you want to send something to someone and for that transaction to be confirmed, it needs to included in a new block which is added to the end of the Blockchain. People who are adding this are doing the so-called mining, because this process actually takes a bit longer. They have to solve a complex algorithm and they get some new coins out of the system as a reward. So if we want to summarize it in a big picture, this is how a Blockchain looks like. It actually runs on multiple machines; so-called nodes. You also might have heard of the term 'wallet'. Wallet, in the end, is just a node (this is a simplification we'll use in this course) and a wallet in the end is what enables you to send and receive coins. It's a piece of data which allows you to identify yourself, you can say, and then you can send coins through transactions to other wallets and if such a new transaction is created, it's broadcast to the nodes (nodes distributed across the whole node network) and they will verify a transaction while doing so to make sure you have enough funds and to make sure that you really are who you claim to be. Once a couple of transactions have been collected, one node will eventually bundle them up in a new block and then inform the other nodes about that new block so that it is added to the Blockchains of all the nodes on all the different computers; only after this new block and the whole chain it belongs to has been verified by all the nodes of course. So that's the Blockchain in a nutshell. As I said, I'll come back to all of these core concepts throughout the course. In the end, it's a distributed, secure data storage, where each block is a folder with some content, some data inside of it and it's a cryptocurrency if that content is a transaction where we send coins from A to B.