Practice Exams:

Blockchain CBSA – Objective – Ethereum

  1. Ethereum Overview

In this module. Let’s cover the objectives around Aetherium for this exam. Now, Aetherium is of course one of those subjects that’s far and wide. It’s definitely not a 20 minutes subject to cover Ethereum. Technically and in detail it’s literally a three day class. But I want to ensure that we understand the basics of a theory theorem, especially for the CBSA exam. Now, the good part about this exam is it’s not going to dive into anything really technical. It’s more factoids, as I like to call them, or trivia around a theorem that you might want to know.

It’s going to cover what this is all about. So Ethereum was essentially, as we know, developed by Vitale Budarin, and this was in 2014 is when the presale happened. Initially there is 60 million that was essentially created and essentially provided to the contributors of the presale. There’s approximately 12 million that was created. And when I say created, that’s Ether, that’s the supply of the tokens was essentially created to the development fund. This went to the contributors and the developers.

Now basically when a block is created, five Ethos are created. So about every 15 seconds. Now I think it’s probably a little less than that now, but again, on average it’s about 15 seconds. And that goes to the minor of the block. And then two to three E threws may be sent to another minor, someone that might have participated in the transaction and we would call that an uncle.

Now, Ethereum is the most widely used open source blockchain. It’s essentially distributed computing. That’s all it is. It’s really a distributed app. And again, we know that with Aetherium that it was really developed to host D apps. It was really meant to be a blockchain platform to develop on. Now Ether though, and Ethereum are actually two different things. So just let’s clarify this. Ethereum is a platform while Ether is essentially the token that’s used to facilitate transactions on the platform. In other words, to use the Ethereum platform you have to have Ether to pay for the usage of the platform.

It offers a decentralized EVM. It’s a Turing complete EVM we’ll cover that actually in a separate module for the EVM. It was initiated by Vitalic Booter in 2013 and it went live in 2015. Now, on the exam, some of the terms around Ethereum, this is easy to get. It’s just that if you don’t get it you’ll be giving up what I call give me questions on the exam. So Ether is the token of Ethereum and Ethereum is the platform. Once again, to use the Ethereum platform, we need to have Ether.

Now, when it comes to tokens with blockchains, there’s two types of tokens. We have usage tokens and we have work tokens. So let’s talk about these. Now usage tokens are going to be used on a blockchain platform similar to like a native currency. An example of this would be Golem, a work token is different. This is going to essentially give you some rights. A good example would be dash. So, for example, for you to participate as a sort of minor, basically in dash, you need to become a shareholder. And to do that, you need to have dash. And to do that, you have to do what? You have to go get tokens to identify yourself as a shareholder. And that will give you some voting rights. Now, with the theorem tokens, we want to know that there are different types of tokens. The main token and the one you want to know for the exam is actually ERC 20. ERC 20 defines a common list of protocols that an Ethereum token has to implement. Now, this is important because this basically defines how developers are going to define the behavior of the tokens on that ecosystem. So we know that if we’re going to develop on a theorem, we can do that. For example, if we want to develop our own token, our own blockchain platform, we can do that on a theorem and create our own tokens on top of the ethereum blockchain. Now, this is very common as well. So if you wanted to deploy your own token, you could do that. But to do that, it would now have to be an ERC 20. Once again, I’m going to say ERC 20. Again, remember that it defines a common list of protocols that Ethereum token has to implement. Now, when it comes to the components of Ethereum, there are four main components. We have our nodes, we have EVMs, we have Smart contracts, and then we have D apps. So let’s go ahead and look at a picture here.

For example, if we have an Ethereum app, we’re going to have a wallet to be able to transfer our Ether from point A to point B over here. Now, it’s important to realize as well that, for example, if we want if let’s say, for example, if Jamie here wants to be able to send funds over to Jamie to his wallet or her wallet, whatever Jamie is, basically, again, we have two Jamie’s. But assuming that Jamie One and Jamie Two are different, we have a sender and we have a receiver. Now, what we want to do is because Jamie request $100 and we’ll say that just to make this just easy, just for talking purposes, I’m going to call this person here sue. Sue wants to send Jamie $100 an Ether. Okay, piece of cake, right? Now, to do that, we have to go ahead and initiate the request.

So basically, the wallet needs to have essentially $100 of ether in it. If it does, then again, great. So what’s going to happen is that request is going to send out data and it’s going to validate that the value of the ether is available. It’s then going to send a request to the EVM. And the EVM is going to go ahead and put that transaction out to the blockchain. And if that transaction is valid, again, there’s more to this than just what I’m going through, but just at a high level. We just want to realize that there’s a process to this.

And if the value, of course, is accepted, there’s no double spend then that’s sent to Jamie’s wallet, and then that $100 is then transferred out of the wallet and then into Jamie’s wallet, and he or she then has $100. And if you want to know more about it, go over to Theorem Stack Exchange. They have some good diagrams and workflows on that. But in general, just for this purpose, just realize that the EVM has a role in this as well. And we’re going to talk about the EVM coming up here very shortly, and there are some practice questions as well to look into before you take this exam. Let’s move on to the next module.

  1. Ethereum EVM

Okay my friends, the next objective is going to be talking about the EVM. Now the EVM is the Ethereum virtual machine. Now there’s a couple of areas on this exam you’re going to want to know and I’m going to point them out to you. So let’s go ahead and talk about first what it is, why it’s important, how it really comes into play, what makes it unique. First of all, the Ethereum blockchain just to be aware is an a transaction based state machine. Basically when we talk about computer science a state machine refers to something that is going to read a series of inputs and based on those inputs will transition to a new state. In other words, it’s very dynamic. It’s not a static machine. The genesis state is the beginning state and then on to the final state. So think of Ethereum as a dynamic based blockchain. Now the EVM is really what makes it work. It’s built on software running the Ethereum protocol. It executes the smart contracts. Now the Ethereum program basically uses what’s called the Solidity programming language. So Solidity is actually a developed language specifically for Ethereum and it works really well. And the reality is it’s actually a very widely used and very popular development language. We’ll talk more about that in the development section of the course.

Now the EVM is contained as a full node essentially on every node on the Ethereum network. So if you have 1600 EVMs each of those EVMs has what, copy of the blockchain? The EVM code is a programming language in which accounts on the blockchain are going to contain the code that it’s running. The code associated with an account is executed every time a message is sent to that account. So basically it has the ability to read and write to storage and then send messages based on the requests that are sent or received. Now contracts, these contracts can call other contracts and send Ether to a non contract account by means of message calls. Now message calls are similar to transactions. They’re going to have a source, a target, et cetera. Every transaction consists of a top level message in which the turn can create further messages.

Now, ethereum uses what’s called gas. Now this is an interesting basically subject in the sense that very different than other blockchains. One of the areas that I think the developers thought of was because Ethereum is a token but it’s traded like a cryptocurrency there had to be a way to deal with price fluctuations with Ether. So if anyone remembers back in 2017 and 18 Ethereum and all the other cryptocurrencies were going up and down sometimes 40% or so in a day. And how do you deal with something that just goes up, down, up, down, up, down? And the reality is that if you need stability then just using Ether just didn’t provide it because of the way it’s traded.

So gas was actually what was created to help alleviate that. Now the EVM is in the theory and virtual machine as we know it’s computer software. It runs at an abstraction layer straight above the underlying hardware. So basically it is going to be installed on some kind of virtual machine essentially or hardware basically a server and it’ll go ahead and run. The theorem uses a semi Turing complete VM and it’s going to run and compile the code. Now for those not familiar Turing complete. This just means that the software is going to be strong enough to deal with whatever is giving to it. In other words it’s agile. So if the developer wants to go ahead and add all these RPC calls then great. It’ll probably handle it without a problem. Now one of the limitations really the only limitation per se with an EVM is that turning complete machine is that it is actually bound by gas.

And again probably not worded very well but basically what I’m trying to say here is that you need to have gas to run the machine. So for example if you have for example zero five Ether and this Ether for example is not enough then that EVM will not continue to process that transaction. And I’ll go through a demo on gas. It’s very simple, it’s very useful and actually if you use Metamas you could see how it all works as well. Now the power of the EVM is of course limited by gas. That’s really the gut you there. Now the implementation can be in different languages so you could be implementing this in Python, Ruby C and whatever else might be supported at the time. Now one of the important things I didn’t really put this here is that it’s really the EVM is very similar running in basically what’s called a sandbox and basically sandbox is what it’s an isolated environment.

So let’s talk about this a little bit more now when we talk about the EVM. A couple of things to point out here. Let me get my point here. Okay. So when we talk about the EVM the first thing to realize is that we have a peer to peer network and we have to be connected to the internet because again Ethereum is a network based blockchain and therefore we need to have other nodes to communicate with. Those nodes are going to be running a distributed ledger.

Essentially that hardware is going to be running and these nodes need to be running. And on top of the nodes we have what we have our EVM, that’s our Ethereum virtual machine. And then we’re going to load our smart contracts on top of the EVM. And if we have multiple smart contracts that are working together we would call that a D app. So that’s really the main point to get here. And again some practice questions to help you all out with that. Before we take the test, let’s go ahead and move on to the next subject.

  1. Ethereum Gas Estimates

I’m over here at the Ether gas station. The link is here. It’s basically Ethan info. I’m over at the home page here. You can see here that it’s got the gas time to price estimator tells you the approximate use case and the cost involved tells you the count by gas price. In other words, again, percentage of transactions fall into a specific range. It seems like between four, but less than 20 seem to be about 60% of the transactions. Sort of an interesting thought there. You can see that this is the top ten miners by miners that are mining Ether. Now this sort of tells you up here the gas price standard for Ghee. It’s actually we. I never say that right, but we is really how it said.

The standard cost for a transfer is zero point 57. Right now the low bid that you could put would be about forty three cents and the safe low would be as far as three. When it comes to the number of GUI, the wait time is there. Again, it really just depends. It could be dependent on the time of day. Again, gas price, right, confirmation time. If you’re willing to pay more, you’ll get a better confirmation time. So let’s go ahead and play around with the TX Calculator for example.

Now the TX Calculator will allow you to put in how many transactions do you think you’re going to be making in the blockchain? Now again, as an architect you’re not going to have an idea, but your developers are going to have a good idea. Let’s say for example, I’m going to have 40,000. This is a big app. And I put in is that 400,000? Let’s just make it 40. So I put in 40,000 and I go ahead and adjust the gas price if I want the fastest. That’s telling me probably 20 Wii. Above 20 Wii, average is going to be four Wii, and then cheap will be three. We’ll just leave it on average.

Now I go here I go to submit. You could see that right now that the estimated cost of running that application would be about certainly less than a dollar. And Ether will be let’s go ahead and make this bigger numbers to see. We put in $400,000 right now. You can see that it’s going to cost about one dollars and change to run that transaction. But if I go fastest, you can see that it goes up five times for the fastest possible transaction time. But if I want to go the cheapest, I can then bring it down to less than one dollars. And that way when you’re designing applications, you can figure out what it’s going to cost to run that application.

 And then we have what’s called the Transmit Pool division. And this is just telling you as far as the percentage of blocks, the number of transactions, what was transmitted in five minutes or 20 minutes. That way you get an idea of transaction speeds. They have a price watch list as well. They have the gas burners. Now the gas burners is sort of funny. These are really the sort of like the nodes that are again putting in the most. These are actually the wallet addresses that are really putting in the highest number of transactions.

So this is ethergas info. I encourage you to take a look around. Got some neat features to look at and capabilities to get an idea of what you’re doing. You could also change currency here. They only support a few currencies, but it does the job. And then over here, you go over here to estimate confirmation time. As you see, if you want to get different confirmation time you can see that the fee is going to go up as well. You can increase the gas size again, it’ll increase the price eventually. This isn’t an estimator as well. With that said, just want to show you how to estimate a smart contract price to run it on the blockchain. Or your DAP, I should say.

  1. Ethereum Browsers

Okay, let’s talk about Ethereum browsers and how we could develop and access our D apps. Now, Mist is the browser essentially for decentralized apps. It’s also known DApps essentially is known as web 30 supports ie or google chrome. Mist is still in heavy development and again may not fully be supported in some situations. Now, Mist is a full mode. That’s one of the things to pay attention to. So you need to download the full blockchain. Now it also integrates with swarm as well and it is flexible as far as the desktop application that you’re using as well. Now MetaMask is a bridge that allows you to visit the distributed web of tomorrow.

Basically, MetaMask is a Chrome extension that you can download and add to Chrome. And what’s really nice about MetaMask is that you don’t have to download the full node, you don’t have to download the blockchain. It’s basically storing basically your information locally in your browser memory. It allows you to develop and run your D apps locally and you can also select your test net or your main net. It’s really a great tool. There was a demo earlier in the class as well on MetaMask. So if you haven’t seen that or played around with it, do check that out.

Now MetaMask is also again a very solid wallet as well. And in the demo you’ll see that I went through and I transferred funds and ran a test application as well. And again you would add that to your Chrome browser. Then there’s also parity. This is a lightweight browser and allows you as well to run your decentralized apps as well. Now, it does have a web three D app browser that supports as well. Let’s go ahead and move on to the next module.

  1. Ethereum Development

Okay, well, let’s go ahead and talk about Ethereum development. Now, Ethereum of course, has specific tools that are available, some of which are basically dedicated to Ethereum, some of which are not. Let’s go ahead and talk about a few of these. So when it comes to languages generally, the most common language that’s going to be used to develop with Ethereum is going to be Solidity. We’ll talk more about Solidity here coming up in a few minutes.

Then we have Serpent and then we have Mutant as well. As far as IDE environments generally, most developers are going to use typically the Solidity browser or Ethereum Studio clients are available gap, F, Parity, Ethereum Wallet as well. Storage could be IPFS warm or storage a as well. When it comes to Dab browsers, generally MetaMask or Miss will be what you will see. Again, we have a demo on MetaMask, for example. Now. First test nets. One of the things before you deploy anything, of course, is to test it out. And to deploy on a test net, you’ll need to have test Ether.

And each of the test nets have different requirements to get that test Ether. So you may want to check that out based on which test that you’re using. For example, like Rob scenes, for example. Now, when it comes to front end tools and back end tools, if you’re developing the front end and there’s your client application again, the application could be in whatever you feel like. It could be an HTML if it’s a web based app, CSS or JavaScript. Just some examples that could be used. Now, the back end is going to typically use Solidity or Serpent. Now, with Solidity, you can go ahead and download or you could also compile in your browser as well. So you have some options there. Now, Solidity, for those not familiar with it, this is really the language behind Ethereum. It was actually specifically designed to utilize the EVM. And this is what really makes it really easy to develop on, is that the network basically protocols are already there. It’s already connected essentially in that sense.

So you don’t have to go in and worry about how to configure the blockchain network because again, it’s designed to connect to the EVM. The ethereum. Ethereum based applications are written in solidity. Solidity was proposed in 2014 by Dr. Gavin Wood for ethereum. And again, this is done before it actually went live. Now, Solidity for those developers that are familiar with JavaScript and C, it’s sort of a hybrid in the sense that it has some features of JavaScript and it has some features of C as well. Now, when it comes to Solidity, it is a new framework, but it’s probably closer to JavaScript than C. Basically. Solidity is an object oriented language very similar to C Plus Plus and C, but JavaScript again, is based on HTML.

Solidity was really designed specifically for Ethereum apps and it was meant to run on the ethereum blockchain. Now, JavaScript again is really a universal language, and what makes it useful in the sense that it’s similar to JavaScript, is that there’s a wide developer audience that knows JavaScript. So this is a huge benefit when it comes to APIs. Basically, JSON is a lightweight format that can be used, of course. And if you’re going to talk to the node from a JavaScript app, you want to use the web three JS library. This is what has the RPC methods. Now, RPC is what that’s removed procedure calls for those folks that may not up be familiar with that. And here are some practice questions to help enable you before you take the test. Let’s go ahead and move on to the next module.

  1. Ethereum Security

Well, let’s talk about Aetherium blockchain security. Well, we know that Aetherium is a public non permission blockchain. We also know that it’s open to the public. We know that it’s using proof of work and at some point when it gets to the right block number it will change over to a proof estate consensus. Now, Aetherium was originally designed to be a smart contract platform and again, it’s perhaps the most well used smart contract platform out there. With that said, we want to be aware that with smart contracts, for example, these are written in solidity and we also want to be aware that there’s a ledger as well. Now, with the Ethereal ledger it’s really a little different than perhaps what you would see in Hyperledger. For example, it uses essentially a set of trees.

And with the set of trees you could think of trees as being branches and these branches have different sort of shoots off of them. So we have a state tree, a storage tree, transaction tree and a receipt tree. I won’t go into each of these. This is, of course a subject that you may or may not be too concerned with if you’re not a developer. But basically the main thing to get here is that the way the blocks are on the ethernet blockchain they’re going to contain essentially hashes. And these hashes should have, of course, the roots of the current version of the trees in this case, for example, the state tree. And we’ll also have the transactions as well as the other relatively relevant information such as the receipt tree, for example. And then we have, of course, our theory and virtual machine. The Ethereum virtual machine is going to run the smart contracts on the platform.

Basically, contracts are going to be written in solidity and then each instruction in the EVM is going to have to be tied to what’s called a gas value. Now the gas value, as you may know, is going to be essentially an estimate of compute power required to process the transactions. And that smart contract. Again, we know that Ethereum smart contracts run on the virtual machine and we also know that if we want to execute a smart contract we have to include gas. And gas is essentially going to be a fraction of the Ether in most cases.

And this pays for that computer essentially effort that is required to run the code on the EVM. Now, one thing to point out too if you don’t have enough gas you’re not going to be able to execute the EVM smart contracts. Now let’s talk about security controls that can be at least appreciated in Ethereum. There’s really very little you can do to improve security, to be honest. However, let’s talk about what we can do with Ethereum. We know that support for privacy and security is just about nonexistent. In other words, when you make that transaction on Ethereum it’s open for the world to see.

Now, we also know that security features are not directly supported by the ethereum blockchain. You have to generally write them into your smart contract. However, this is going to change eventually. It is planned to support what’s called zero knowledge proofs. One of those is called ZK Snarks, for example, very similar to some other implementations out there, such as Zcash. Let’s go ahead and move on to the next module.

  1. Etherscan

I’m over here at the Etherscan website. It’s etherscan IO. This is the ethereum block. Explorer. Now this tool here you want to use to get an idea of the activity on the Ethereum blockchain and also to view transactions that have happened. For example, you can view your own transactions from your own wallet if you so choose. You could also view other transactions that are going on to see what the block rewards are. For example, for example if I go here and go view all this will bring up the basically the block height. This is basically more or less a block ID in a sense. And it identifies where that block number is in that blockchain. Tells you the age of it.

Tells you the TXM transmission numbers, the minor this is basically the minor pool that has mined that specific block. It tells you the gas limit, the price that was essentially requested for gas and then the reward that the miner received. And you can see that most of this is really the same mining tools. They’re all fairly routine, it seems like. And then if you go next, again, you can see that most of these are named these are typically larger mining pools that are doing this. So if you go here again, f two pool Ether mine pretty common to see those two anyways, spark pool. They’re sort of interesting. Sometimes they show up, sometimes they don’t. And as you see, it’s pretty much the same miners producing value. Now if I go back to the home page you can see that it updates the blocks and everything here and then the transactions. I go over here.

I go look at the transaction number and it’s going to tell me, for example, the timestamp, the block height. And then it basically tells you where it was sent to the value, how much Ether, which was point one Ether. This is about $28 worth of Ethereum. The gas limit was 27 50 essentially. And you could see that was a small transaction. And if you go over here you could see again this is two Ether. So you go over here, that will be a bigger transaction. Two Ether right now is worth about $561. So basically Ethereum is running just under $300 per Ether. So this is AThe Scan. This is the ethereum block. Explorer. Gives you an idea what exactly is going on.

Another way you get to it too, if you remember the MetaMask demo is if I go back here I could go view account on Etherscan. And this is my account here. You can see that this is my MetaMask account. Not my only one, but this is the one I use for playing around and doing classes and demos. So you can see that I had three transactions about 71 days ago, 100 days ago. And you get to that through MetaMask. And again, the way you get to it is over here there’s three little dots there. You just select that. Now, I could also copy my address to the keyboard. I could export my key once again, there’s a couple of ways to get to Etherscan. MetaMask is just one of those as well.

  1. Ethernodes

I’m over here at the Ethernodes. org webpage. Now this is a really neat site that pretty much displays to us pretty much geographically where the ethereum nodes are. Now there is a main net and there is a test net and you could see that Google of Maps is having some issues, whatever that is. But if I go here again, it shows me where the test net nodes are. And you go over here, there’s only 18 that are online at the time that have been discovered. There’s nine in the US. And two in Germany, two in France, two in Ireland, so on and so on. And over here, what’s cool is you go ahead and look at the versions of the clients and you can see the clients are listed there. That’s Gap. And this is in Parity. And then OS is Linux, 64 bit. Linux one is not being recognized and then FreeBSD. Now let’s go back to the maintenance net. This is going to be where most of the nodes are given a second. Now you can see that at the time there’s 16,000 plus nodes, over 45% are just in the United States itself. China has the second highest number of nodes at 1956, so they’ve got about 11%. Canada 7%, germany, Russia, United Kingdom, any go view all if you so choose as well.

Now, what’s interesting here is you can see that a lot of the nodes are being taken offline. And why is that? Well, I think because of the fact that the price of ether has dropped so much that it just isn’t making it as profitable. Same thing I’ve noticed with bitcoin, the number of bitcoin nodes that are online, the miners are just not the same. And we’re starting to see basically what I would call a flushing out of the real dedicated nodes. And perhaps that may or may not be the case down the road, who knows? But from a month to month perspective it’s still up 9%, but in a week it went down 12%. Now some of this too could be just as a result of network latency, it could be a power outage where they’re located, it could be any number of things. Again, if I go here to clients, you can see that there’s a lot of different clients that are listed.

So again you can go and play around and see Parity has Gap, right, that’s the client that is utilized for the blockchain, for accessing the client client versions are here. You can see there’s tons of different versions right there. I can’t even count them all. And then OSS again, you can see there, there is some windows, about 957 windows that are 64 bit, running 156, 32 bit it looks like. And you could see so on and so on. But anyways, this is a good little resource just so that you have an idea and you could talk intelligently with your client, that there are 16,000 plus nodes on the main net at this time. Good way to take a look around. Now, if you did want to go drill down the map, the only thing I’m going to warn you about the map is sometimes it works, sometimes it doesn’t. And it definitely could be your browser. That’s just one thing to pay attention to. I am using basically chrome. That’s usually supported as well. Ie almost never works. But the other browser you could use as well is Firefox.

That usually works pretty well as well. All right, let’s go over here. Let’s go and drill down here. I’m sorry. Yeah, over here. If you go here, you can see that there isn’t too many nodes that are in the middle of the country. It looks like there’s a good amount in Chicago. Looks like there is definitely some in Northern Virginia and DC. So if I go over here, you can see Washington has a few. And then, interestingly enough, ashburn, Virginia. And that would make sense because of the fact that is Data Center Alley. And for those folks that don’t know, ashburn, Virginia is exactly where the European trunk lines pretty much de embark into the United States. So big data center alley there.

And then over here, this is pretty much near looks like Columbia, or is it College Park? And you can see again, a node or two there. I can’t tell. It’s pretty hard to see. But with that said, this is a good tool. Go over to Ethernodes. org and check it out.