Blockchain CBSA – Blockchain 101
- Objective – Consensus among Blockchains
Let’s go ahead and talk about consensus. Now, when it comes to consensus, this is a course area that will be tested, I guess, in a way probably significantly more than perhaps other sections. There’s a lot here to talk about, and we definitely want to make sure you understand the reason to use specific consensus methods and why specific blockchains use proof of work, proof of stake, d, POS, poet, et cetera. But let’s clarify what consensus is.
Consensus is a dynamic way of reaching an agreement in a group. Basically, we need to have a way to agree on what we’re doing, agree on a transaction, agree on this is how the blockchain should be ridden to right and by who. But basically, consensus is a way to reach an agreement. Now, when it comes to consensus, Algos, the main ones that you’re going to see on the exam will be proof of work, proof of stake delegated, proof of stake, byzantine, fault tolerance, dags. And there will be a few others on the exam. I’m going to guesstimate I saw probably six questions just on consensus algorithms.
And we’re going to focus on this a little bit more than other modules just because there’s a good percentage of questions from just this module. So let’s talk about proof of work. So proof of work was the first blockchain consensus algorithm. Once again, I’m going to repeat it. It’s the first blockchain consensus algorithm. Once again, you want to remember that. Now, who created this algorithm? It was satishi nakamoto. He created bitcoin.
Now, proof of work does what? It basically has miners that solve hard problems. Remember, the miners are there to do two different things. They’re there to do what the first is, is to ensure that the signatures are correct, that the person that is trying to send funds is actually the person. And the second thing they’re trying to do is make sure that there’s no double spending that’s going on. Proof of work runs on the longest chain. In other words, it’s a marathon. Whoever produces the most value in the shortest time wins the race. Now, the downside to this is that it’s very expensive. It uses a lot of electricity. Bitcoin, Ethereum and Litecoin are good examples of blockchains that use this.
Now, proof of stake proof of stake is different in the sense that there aren’t miners. Instead, they’re called minters. Minters are going to stake their tokens. I like to call proof of stake similar to gambling. In other words, you’re going to go to a horse race and you’re going to go ahead and stick up $200 so that you gamble that you’re going to win $2,000 at this horse races. This horse races and wins. Right. Basically, proof of stake is much more environmentally friendly. However, it could be prone to attacks a little bit more. So pure Coin and Ethereum will be going to a POS as well. At the time of writing, that attempt has failed several times. DPOs. Now, DPOs is essentially another algorithm out there that allows basically it’s a proof of stake form, a proof of stake delegated proof of stake that allows token holder holders to basically cast votes.
Now these votes are weighted. Basically waiting means what? Now once again, just realize that DPLs is going to stake and basically when they stake it’s weighted and weighted is going to basically assign sort of a value in a hybrid approach basically to determine who’s going to do what and who’s going to basically produce the blocks. Now, the benefits of DPOs is that it separates concerns that the stakeholders that have tokens control the blockchain. Now, as it sounds this is more centralized, right? Scalability is better, there is governance as part of this and it also avoids a nothing at stake problem and we’ll talk about what that is coming up as well. Now, DPS divides the consensus model into two fundamental parts. The first thing is it’s going to elect a group of producers and then it will schedule production. Now just be aware not everyone that is part of a D POS network can produce blocks. Now the nothing at stake problem basically the nothing at stake problem is where you would have a small group of validators that might try to take control of the network and this is where they want to try to hijack the tokens basically or the stakes that are there and basically control the blockchain services. Basically. This is where again, DPS has a dynamic model to help prevent this.
So if it sees for example, a high number of validators sort of basically doing things that they shouldn’t then basically it will help prevent those issues. So this chart here you would really want to spend a little time to prepare before taking this exam. And I put this together to sort of sum up the pros and the cons for folks on the exam. Most of the questions will focus on the consensus, what blockchain that consensus is used in and what are the pros and cons. So for example, proof of work is used in bitcoin ethereum, for example. The pros of proof of work is that it’s widely tested, it prevents double spending, right? However, the downside is that it’s slower and it’s very resource intensive. I won’t read all these to you. This is again something you’ll want to invest some time in. Make sure you understand this before you take the exam.
Now, when it comes to proof of elapsed time, this was created by intel. This is known as Poet. Poet is the acronym that’s also referenced to proof of the lapse time. This is a proprietary algorithm, use a proprietary hardware. Now the downside to use in Poet is what you’re depending on intel. Now Sawtooth uses Poet for example and it uses their intel chips to provide basically a trusted execution environment which is again also provided by an SGE or SGX which is a soft regard extension. Proof of authority is another algorithm that’s out there. It uses a set of authorities. Basically it says you’re the manager, but you’re not the manager.
You’re the manager, but that node is not the manager. Again, it’s sort of a pick and choose approach. Proof of Burn now, this one here is where the coins are burned. And when they reference proof of burn, this is basically saying that once you use a coin it’s gone. In other words, it’s not there anymore. Basically, if you use two tokens or two coins they’re gone, right?
So just be aware and then proof of activity. This is a hybrid of proof of work and proof of stake. This is where you have template blocks that are mined and then fill with the transactions that are validated by a proof of stake approach. Proof of capacity. This uses hard drive space. If you have more space to use, the better odds you’ll get selected to mine. Again, sort of some odd consensus approaches here. Like I said, you can definitely expect questions on at least most of these. I won’t tell you which ones, but you will definitely see five, six questions just on this module. And there are some practice questions I encourage you to go ahead and take a look at.
- Hashing Overview
In this objective, we’ll talk about what hashing is and why it’s important. Basically, hashing means that you’re going to take an input and have a specific output. For example, when we have a notch, a nonce is what, a random number, and we change that nonce, the hash of that output will change. Because of what reason? Because the input was changed. When it comes to cryptocurrencies, for example, basically all of these generally use a hashing algorithm and it’ll be a fixed length. But remember that the same input will have the same output. A different input has a different output. When it comes to your input, remember, it’s always going to be 256 bits. For example.
If there’s a slight change to the input, it will be what reflected in the hash. When it comes to these hash functions, this is one of the things that makes it immutable. It provides integrity and is tamper proof. Now I’m going to advise you to sort of highlight that or memorize that. What does hashing provide? It provides integrity and it provides a tamper proof system. Here’s an example of hashing, and here’s a practice question as well. There’s a demo coming up right after this on hashing, which will walk you through the Anders platform, and it literally shows you how all this works in a demo approach. Let’s go ahead and move on and talk more about hashing.
- Demo – Anders Hashing Demo
Now I’m over here at the Anders. com Blockchain hash demo page. This is a really cool website. They’ve got an Sha 256 hash demo page. They have a block and a blockchain and some other pages as well to look at. Now, let’s just briefly talk about what we’re going to do here and why it’s important in regards to blockchain and encryption. Now, generally, a hash algorithm, what it’s going to do is take that data that I’m going to enter and put it basically into what’s called a fixed length hash. Now what should happen is every time I enter the same data, I should result in getting the same data out.
Now, when I modify the data by, let’s say, one number or one letter, that will totally change the hash. But basically, whether it’s Bitcoin or Ethereum in general, hashing works pretty much the same. But for example, in Bitcoin, it uses an Sha 256 hashing algorithm and it uses what’s essentially random numbers that will generally allow the Ethereum protocol to use what’s called a predictable amount of CPU effort.
And that’s why, for example, with like Ethereum or even Bitcoin, they’re able to estimate the cost of processing that transaction because of the fact the hashes, the signatures are steady when you generate that hash. Basically, this will of course provide a result that should be expected. So let’s go ahead and give it a try. I’m going to go. Hello, Udemy. Okay, now if you look at the hash, you can see that it’s 903 and then it ends in 1219. Now let me just change that by one digit. Let me go, Udema. Now you can see that that totally changed. Let’s go ahead and put back the Y. And again, what do we have that same exact hash ID. And when I add blockchain there, let’s say you can see that the hash begins with the BA and ends in a five E.
Let’s go ahead and take out an N and you can see that that totally changes. And I take out another one that totally changes that hash. Let’s go ahead and put in the I N. Now you can see it goes back to the BA and it goes to five E again at the end. So so just think of it from this perspective. The hashing algorithm was what essentially is going to take that input data and turn it into a fixed length hash. Because of the fact that hash will result in the same data, basically, it won’t change the output if it’s the same data.
However, if you change, I should say the input by one, then what happens? The output will be totally different. But basically, just like any compute data, for example, these are going to be large numbers and typically too, it’s going to be written in down here. You can see it’s hexadecimal. So with that said, just be aware of how Sha 256 works and just have a good understanding it’s fairly simplistic. Now let’s go over here to block. Now, you could see when I go to block, I have a hash already there. There’s a block ID one. If I take out that block ID, and I add in like, let’s say 33, you can see that it starts with 71 and it has an F three. And then let’s go ahead and change it to 31.
And you can see that it ends in 67. And then I change it back to 33. You can see that there’s F three again. Now let’s enter some data. And you can see that when I go, hello world, it ends at nine four. And then I take out the D. As expected, it changes back. And now what I could do is if I go here to mine, what’s going to happen is it’s going to go ahead and essentially what this is doing is representing, essentially writing to the blockchain. And so what’s going to happen is it’s going to take the previous hash, basically, and, you know, make sure it’s aware of that. And you can see that the block ID is 33 and the knots that was chosen, remember, the knots is a random number that’s chosen. And again, you can see that that’s how that changes.
Now what about if I change the knots? You can see that the hash changes as well. I change it back to five. Guess what, I get the same hash. Now let’s go over to blockchain. Now, you can see this actually happened in sort of a workflow. Now I have block one, block two, and block three. You can see the knots are totally different and there’s no data. What I want to do is I want to go, Hello, Udemy. And you can see that my hash is D seven and ends in AV. Now you can see that the previous hash, what’s it represent? D seven ends in AV.
What’s this hash here? So basically it’s referencing the previous hash. And then this one here, what’s it doing, this hash here is being referenced by the third block. And if I go? Hello Udemy. What happens? Basically, the hash changes again and again, block ID, different nuts. So this is a really cool tool to play around with just to give yourself an idea. And again, if you go down the line, you’ll see that it’s going to reference the previous hashes. So this is called Anderscom blockchain, blockchain HTML. The link is in resources. Give it a try just so you have a good idea of how things work.