This course covers Ethereum denominations, the ABI array, Ethereum networks, private/public key cryptography, and much more!
In this lecture, I want to talk about Ethereum denominations. When we were executing our smart contracts and we started the game, then you already saw that we are going to add 0.1 ether. So, we already tapped a little bit into how ethers are split up, but I don't think you get the full picture yet. So, let me add the puzzle pieces that are missing. First of all, if you can go to the website EtherConverter.online, which is the address here, etherconverter.online, and then you see actually quite a bit of the ether denominations here. And you see that ether is by far not the smallest denomination that you can have. It's like US dollar and then there is cents which is even smaller. And with ether you can break it down to a lot smaller values and the smallest one is Wei. So, one wei is the smallest element or the smallest unit that you can send on the Ethereum Blockchain understanding these native tokens, the ethers on the Ethereum Blockchain. And everything you do programmatically on the Ethereum Blockchain in terms of smart contracts is going to be in Wei. So, when we are in our smart contracts, when we say, let me open up the browser here, let me open the ThreeInARow game. When we say the game costs 0.1 ether and we deploy such a game, we have to give it an address here. Let's just give it this address. No, it won't take it, but if you say we deploy this game with 0.1 ether, then the game cost will not be 0.1, it will be stored in Wei which is going to be 1 with 17 zeroes. Why do I know all this so quickly? Because one ether is 10 to the power of 18 Wei. That means it's a 1 followed by 18 zeros Wei. If you have 0.1 ether, then it's 1 followed by 17 zeros Wei. Let's count this: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 15, 16, 17 and 1. And that is pretty much all there is to say with the denominations. Just one more in advance to how you work with the JavaScript part. Because later on, we will work a lot with web features which is a JavaScript library to connect to block channels and they can convert those denominations as well. And that is fairly easy and you can get access to one of these web free instances directly here in the remix logger council. And I'm just trying to scroll where it says that you can access. You can use this terminal for checking transaction details and start debugging or running JavaScript scripts following the libraries. The following libraries are accessible. Web3 version 1.0.0 and you have to know in advance that there was a huge version chump in web3.js and it was between 020 and 1. And at the current time of recording version 1 is still in beta but it's very widely used and they changed how this works a little bit, and if you click on it then it will open up the documentation that we're going to talk later about this. And the one thing that I want to give you now is kind of a tool to convert between ether and other denominations, and that is web3.utills.toWei, and then you have to give it as a string, the amount and then the denomination that you want to convert to Wei. Let's say we want to convert 1 ether to Wei and that would give us the right amount of Wei, and you're going to use this extensively later in order to convert to Wei or maybe even from Wei to ether. If you say we have a certain amount of Wei that we want to convert to ether, then we can easily do this over here for maybe populating any labels in our JavaScript and so on. All right, what other units do we have which are important? The other one, which is very important is Gwei, gigawei, Gwei, and those are used for calculating or spending money on gas, gas costs, operational costs on the Blockchain. Usually if you spend money on transactions, then you pay a certain amount of Gwei in order to let the miner run your transaction and include it in the block. And very seldom you hear about Finney, which is like more than 100 cents, but which is the lower denomination than ether. So, pretty much if you can remember Wei is one ether is 10 to the power of 18 Wei, then you are really very safe. And when you remember that gigawei, Gwei is going to be used for gas costs then you have pretty much everything that you need to know for your day-to-day work with Ethereum. All right. That's it for this lecture. I don't want to talk about more about Ethereum units and Ethereum denominations. That's everything that you need to know from a programming standpoint. And in the next lecture we're talking about interacting with smart contracts and the ABI array, which is very, very important. All right, I'll see you in the next lecture.
Tom is a CTO, senior back-end developer, and systems architect with over twenty years of hands-on development experience in a variety of languages and systems. He has a CS master's degree and has been working with Ethereum and blockchain technologies since 2016.