text
stringlengths
61
434
supported, so maybe I'll switch to COVID. Maybe we'll switch to COVID. In the drop down here, we'll remove test 10 Link, because we only need test eath. We'll hit I'm not a robot, and we'll send request and the same things will pop up this time,
this is going to be for the COVID test net. And once our transaction finishes going through. Now, same thing on COVID. Here, like what we did with rink B, once our transaction finishes going through, we'll see 0.1 test eath on the COVID network, if you want to go ahead and try working
with another one of the test nets. Like maybe, for example COVID recommend you go ahead and giving it a try. But it's completely optional. And I would always refer back to the GitHub repo to make sure you're working with the most up to date faucet and test net. And if we look back at ether scan, we can
actually see more details on what actually just took place. What actually just happened, how did our Metamask get a balance of 0.1 eath. All of a sudden? Well, if we looked down in the transaction section, we can see that there's a transaction here,
some address sent us 0.1 ether. And if we click the transaction hash, we can see more details about what actually went down with this transaction. Now understanding what's going on in this transaction is essential to learning and being a smart
contract developer or just engaging with the ecosystem. So let's learn the first bit at the top is this transaction hash. This is a unique identifier for this blockchain or this test net that identifies this exact transaction. This transaction
hash identifies sending 0.1 eath to our address, we can see that the status of this transaction was successful, it didn't break. In any case, we can see the block number that this transaction was included in and we'll get to blocks in a little
bit, we can see the timestamp which of course is when this transaction occurred, we can see which account it was from which if we go ahead and open in a new tab, we can see that this is the account that this transaction came from. And it's got 3
million ether. Of course, this is fake Rinckey ether. So it doesn't really matter, we can all see who it was to, which again, is just us. This is our wallet address 0x 106 X blah, blah, blah, cero x 1066, blah, blah, blah, right, the value of
this transaction, of course, is 0.1 ether. Now what's all this that we see as the value so obviously, the value is 0.1, because that's a mode which we sent. But we see this transaction fee. In this gas price, we hover over the tooltip, we can see if you zoom in on your ether scan, you see
amount paid to the miner for processing the transaction. And we see a gas price which is cost per unit of gas specified for the transaction and ether and gray. The higher the gas price, the higher the chance of getting included in the block. Now if we
scroll down even more, and we click See more, we can also see a ton of other information here. For now we're just going to click to see less and just focus on these two. I'll explain all of these in a later session. Let's talk about just
the concept of transaction fees and gas for a second. Remember how I said the blockchain is run by all these different nodes will all those different nodes are running this blockchain because they actually get paid for all the transactions that happen on these blockchains whenever you make a transaction,
there's a node or a miner or or a validator somebody running the blockchain software is gonna get paid a tiny bit of Aetherium or polygon or whatever blockchain that you're running on, they're gonna get paid a tiny bit of that native blockchain currency. This payment is obviously to incentivize people to continue
to run nodes and they calculate how much you pay and how much the node operators get paid based off of how much gas you use. So there's this concept of gas. Gas is a unit of computational measure. The more computation a transaction uses, the more gas you'd have to pay for. For example, we do hit
click More just really quickly. We can see this section say A gas limit and gas usage by transaction, there was a limit of 60,000 units of gas on this transaction, and 21,000 or actually use. So this transaction use 21 units of gas.
Now for very simple things like sending ether, the units of gas are usually pretty cheap. But maybe for more complex things like like minting NFT, depositing to some defy contract, etc, maybe those will cost more gas because they'll be
more computationally expensive. And this is a little confusing right now, don't worry too much about it. But just know that we use 21,000 gas here. And if we pull out the calculator 21,000 gas times this gas price right here, times the gas price, we
get the exact same as we see for the transaction fee. So gas price, times how much gas you used, is the transaction fee. So whoever sent us this 0.1 ether, also paid 0.0000525, etc Rinkeby
ether to make this transaction. Now, each blockchain has a different way of actually calculating how this gas stuff works. So that's basically going to be the high level of it. So we're going to focus just here for now there's a total transaction fee. And then there's obviously the gas price.
After we cover how blockchain works, I'll explain what this burn stuff is these gas fees and all these other stuff. For now, just know that anytime you make a transaction on chain, you have to pay a little bit of what I call transaction gas. So for example, if we go to our Metamask, we have two accounts
right here, we have account one was 0.1, Rinckey eath, and account two was zero. Rigby. If I were to send 0.05 Rinckey eath. From this account to my other account, how much rinky
eath Do you think I'd have left? Well, let's go ahead and try it, this will be the first transaction that you're actually creating that you are going to spend the gas for. So if we go ahead and hit send, we'll hit transfer between my accounts. count two, we'll do 0.05.
Next, we can see some information here about what's actually going on Metamask has some new advanced gas for UI and settings, we're also going to turn the song, so go ahead and click that enable enhanced gas UI, turn that on, and then go back. And again,
this is going to be the experimental tab. But it could also just be in the General Settings tab. Depending on when you actually run this, we can see a little notification here. Again, this depends on what version of Metamask we're using. And we get this little drop down that says Here are some of the different type of gas fees that you can actually pay. The reason
that gas fees might change, as you can see here is that depending on how busy the blockchain is, you have to pay more gas. If a lot of people are sending transactions, that means there's not going to be enough space for everyone's transaction to get through. That's a bit of an oversimplification of what's
happening. But don't worry too much about it for now. Now, if we want to send the 0.05 ether to our second account, we can see this gas estimated section, which is saying it's estimating, we're going to pay 0.00004792 gas in addition to sending the
0.5 eath. So at the bottom, we have amount plus gas fee. And this is going to be the total amount that we're going to be spending on this transaction 0.05 is what we're sending. And we also have this gas piece. So we go ahead and confirm, we now
see we have a transaction pending in our Rigby ether scan. And if we click on it, we can even hit View on block Explorer. And a Rigby transaction hash will pop up and depending on when you click it, it might say indexing, this means that ether
scan has received your transaction and is trying to place it. If you don't see anything here, it means that maybe the transaction hasn't gone through yet. Maybe you need to wait a little bit more. Or maybe you need to go back to the GitHub repo and pick the recommended testament and faucet. So you might have to wait a minute or so for this to
actually finish indexing. After a minute or so we can see that this transaction has indeed passed. And we can see a lot of the same information that we saw on our last one, this time with 0.05 ether. And now if we look in our meta mask, we'll see we can see account one has 0.05 It's rounding up a little bit,
we click on the big button, we can see it actually has 0.049953, etc. And our other account account two does have exactly 0.05. This is because we spent a little bit of Aetherium on gas to send this transaction. And now with just this little
bit of information, you know how to actually interact with applications that use the blockchain, how to send transactions and a lot of the non technical details. Now here's something that's incredibly exciting with just this little bit of information. You now know how to interact with blockchains and interact with the Etherion protocol. So
if you don't want to learn how to code anything, you can go If you can start interacting with Aetherium and interact with protocols with just as much information. However, I know most of you guys are here to learn how to code. So let's look under the hood of Aetherium. And what is actually going on with these transactions, and what these gas and what these
blockchains. And what's really going on, let's learn all the fundamentals of a blockchain. Now, if you want to just go ahead and jump into the coding, go ahead and grab a timestamp from the description. However, learning exactly how the blockchain works is going to make you an incredibly powerful
developer. So let's take a look at that first. So we're going to be going through this blockchain demo on this site right here. Now, the creator of the site has a fantastic video and a fantastic walk through blockchain one on one, it is right on their site. So if you're looking for another
explanation, definitely check out his video, it is absolutely fantastic. But the first thing that we really need to do in order to understand blockchain or just on really anything, and everything that's going on here working first really need to understand this Sha 256, hash, or hashing just kind of in general, let's first understand what a hash is. A hash is a
unique fixed length string, meant to identify any piece of data, they are created by putting some piece of data into a hash function. In this example, the hashing algorithm used is Sha 256. Now Etherium actually uses this, this right
here for its hashing algorithm, which isn't quite Sha 256, but as in kind of this SHA family. But it's really just another way to hash things. And the specific hash algorithm doesn't matter so much. So this example, you just shot up to six, but you can
imagine it's the same as the Etherium. Hash, they're just going to result in a different hash. So what's going to happen in this application here is whatever data or whatever information we put into this data section here, as you can see below this hash changes. So what's happening is this data is
running through the Sha 256 hash algorithm. And it's outputting, this unique hash. So this hash is a unique fixed length string, that's going to identify like a blank data piece here, right. So if I put in, you know, my name like Patrick Collins, this is
the hash that's going to represent Patrick Collins, right. And you can see, even when I put, you know, tons and tons of data in here, the length of the string doesn't change, right. So it's always gonna be the same, we can put almost any
amount of data in here, there is an upper limit on the max size of the data. But for all intents purposes, we can pretty much put any length in here. And you'll see to that every time I type in Patrick Collins, this hash is always gonna be this seven e five D, right? I'm gonna delete I'm gonna do Patrick Collins,
again, you're 75 B is always this, this unique hash is always going to be unique, right, it's always gonna be this fixed length string here. So now we can take this idea while putting this data in here, we can move on to this concept of a block.
So with this block concept, we're going to take the exact same thing with this hash this this data section, right, but instead of having everything just being in this, this singular data area right here, we're going to split this data up into block, nuns, and data. So all so what we're going to do is we're actually going to hash all three of these to get to get
this hash, right, we're gonna put all three of these, we're gonna say all three of these are combined. Together, we're gonna put every all three of them into this hashing algorithm to figure it out. So if I type a bunch of stuff here, we can see that block one with nonce, you know, this nonce, and this data, we're
going to get this hash. And as you can see, actually, the screen turns red, this block turned red. Now, what happens when I hit this mind button? When I hit this mind button, it's actually gonna take some time, it's gonna think for a little bit. And we can see that the nonce here actually changed,
right? The nonce is different from what it was before. And this hash now starts with four zeros. Okay, and then the back turn green. When we're talking about mining, we're talking about miners solving some type of very difficult problem that takes a lot of time to do now in this example, here, the problem
that the miners had to solve was they had to find a nonce, or or a value in this nonce section that when hashed with at block number one with this data, it would start with four zeros. So the problem here the miners had to solve was to start with four
zeros and the only way for them to really do that is kind of this brute force, you know, trying stuff so they tried one okay, one didn't work. Okay, two, nope, two didn't work. 3456 Okay, five, well, that started with one zero, but it's not four. And they have to keep trying all these numbers until
they get to this one where you know, let's hit mine again. Where it has four zeros at the top at the start. Now, this specific problem changes blockchain to blockchain right yet. Aetherium has a different problem for miners to solve A
bitcoin is different problems from yourself, but this concept is going to be the same. So they have to take it, one block is going to be this, this, this concept is going to be all this data, it's going to be the block number. And it's going to be this nonce, right. And so this nonce is the solution is going
to be the the number that they use to get like the solution to the problem, right? So if I go to one here, you know, I do this again, hit mine. And the nonces changed, right? And went from one to 33,128. Because this is the nonce that allowed this hash
to start with four zeros. And so that's what's happening. When blockchain miners are mining they're going through this process is very computationally intensive process of trying to find a nonce that fulfills whatever the problem is. So that's really it, actually. So that's a block. And that's
really what's happening when miners are mining. They're just looking, there's trial and error, brute force trying to find this nut so so now that we know what a block is, let's go to the next step and figure out okay, well, what's a block chain. So here we have an example of what a blockchain is
going to look like. Right, we have a combination, you know, we have back here in the block section, we have one what one block looks like. Now here, we have multiple different blocks, right, each one of these represents a different block, but we have an additional column here, we have additional variable here. So like before, you know, we have block nonce
and data, right, we have blocked nonce data, we also have this thing called previous right, and so this is actually gonna be pointing to the previous hash of the last block. So for example, if we go to the last block in this blockchain, it says previous 008. And if we look at the hash of block number four,
is 00008. And then we look at its previous it's four zeros, B nine, we have four zeros, B, nine, and so on, all the way back to our first block, which has previous of just all zeros, right. And so the block with the previous of all zeros, is going
to be known as the Genesis block. So you've probably heard that before the Genesis block, it's the first block in the blockchain were the previous hash points to a hash that doesn't actually exist. Now, as you can imagine, kind of the same as how this block worked, how the block nuts and dated all go through the hashing algorithm in the blockchain, the block
nonce data, and previous hash all go through this hashing algorithm to figure out what the hashes okay? So if we go to over here, you know, for example, if I type in Patrick, obviously, this is now no longer valid, right? Because this nuns combined with the block the data in the previous hash, aren't
going to solve our problem of having four zeros at the at the start, right. So I'm gonna go and fix that. And that's, that's kind of an easy way to see it being broken. But, but let's take a look, if I break this block, right here, what happens if I, if I break the data in here, if I do like Patrick in
here, you can see that both of these are now read, both of these are now invalid, right? Because the block hash with the nonce hash with the new data, which is my name, Patrick has hashed with the previous block is now a brand new hash, right,
and this block is still pointing to this previous hash right here, right is pointing to this previous block. And now it is wrong, and it is messed up and now, and now it's nuts with this previous hash is also wrong. Right? And this is where when we
talk about blockchains, being immutable, this is exactly how it's immutable, right? Because I go back and I change anything, you know, if I've just typed a right here, the entire blockchain is now invalidated. Because none of these are going to have nonces that solve this equation anymore. So this is why
blockchains are immutable is because anytime you change one thing, you ruin the rest of the blockchain, okay? So however, though, you know, if it was here, originally, we can go ahead and mine these, mine all these but as you can see, you know, this is going to start getting very computationally
expensive, because I have to go redo basically the entire blockchain. And the farther and farther down the line you get, the harder and harder it becomes to, you know, rehash and redo all these different block chains here. Now, this makes a lot of sense, right? So we have this blockchain, it's really hard to change something in the past, but if we do, we can just go
ahead and remind it. Now if I'm the one who controls the blockchain, right, if I'm the one who controls this, you know, and I want to change something, the past will, okay, great. All I got to do is change the state of here. And then you know, mine, each one of these, you know, obviously, it's going to be very computationally expensive, but it's something that I can do right if I'm the one who owns the blockchain.
Now, here's where the decentralized nature or the distributed nature really makes it incredibly powerful. So we're gonna go to the distributed tab here, which is also referred to as the decentralized tab here, and it's going to show us what a blockchain looks like in a decentralized manner. So we have
this exact same initial setup here we have to Shoot a blockchain, we have our first blockchain, which is kind of exactly as the one from here. But we also have more than once we have peer, a peer beam, and PRC and when people are talking about Peer to Peer, peer to peer transactions through the
talking, this is kind of that concept that they're talking about, right. So we have a number of different peers who are running this blockchain technology, they're all weighted equally, right, each one of these peers or each one of these nodes, each one of these entities running a blockchain has the exact same power as anybody else, right. So the way
that we can tell very easily which blockchain is correct, or which ones are correct, or by looking at this end, hash here, right, or by looking at where we are in the blockchain, because again, remember, because again, remember this, this hash that
this this in this last block here, is going to encompass all of the blocks from before, right, because this last hash is going to have the previous hash here, which includes the previous hash here, which this hash includes the previous hash here. And so this last hash is encompasses everything in here,
right? And we can look, we can look at the hash of Piercey, which is four zeros, and then E four B, we can look at the latest hash appear B, which is four zeros, E for B, and then pure A, which is four zeros, E for b. So all of these peers, all of these nodes, all of these decentralized, you know these
independent, all these independent users running this blockchain software, they're all matched up, it's very easy for their nodes to look at each other and say, hey, great, we are all matched up. Now, what let's say that a decides that, you know, something happened on the blockchain that they didn't
like, and they wanted to go back and change something, right. So let's say they change here, you know, obviously, the rest of their blockchain is invalidated. And they have to spend a lot of computational power to catch up to speed. So let's go ahead and humor it. Let's say that they did, they ended up catching up. They ended up catching up, you know, they ended up mining
everything. And now they have a valid blockchain. Right? It solves the equation. Awesome. However, in block number three, there's something new, right? This is here, and it shouldn't have been here, this is some that Peer A put in by
themselves. All that happens now is we look at all the blockchains that are running the software, and we're looking at all the hashes and hash at block number five. So pure A has this new hash. Now, there's a 09 BC. But pure B has a different hash
00, e for B, right? So who's right? Is it disappear a with their new stuff? Or is it pure B? Well, that's where the decentralized data comes in. Because then we can look at Piercey Piercey, also as E forby. So if you're being Piercey will say, Hey, you're a, you're wrong, get out, right.
And pure A will stop being able to participate in the mining rewards because they have essentially forked the blockchain and started their own little blockchain right with their own history, because they're the only ones with this, this piece of data in block three, whereas pure B, and pure
C have nothing in there. So that really shows why in these blockchain worlds in this decentralized world, there really is no centralized entity, you know, pure A, you know, might have been maliciously motivated to change. You know, there's this block number three, however, democracy rules, right, the majority rules in the blockchain, pure vmpfc will say,
hey, you know, the, that's cute and all puree. But you're wrong, right? That's not right. Now, it might be a little abstract, that you just look at data and you know, as typing kind of random stuff in here and think, okay, yeah, that's, that's data, right? That makes sense, you know, just kind of random strings in here doesn't really do anything for us. So if we
actually go over to the token section here, this is where everything really starts to make a lot of sense. So we have the exact same setup here with pure a pure B Piercey. Except and the difference is, instead of having kind of this, this data section, we have this TX This transaction section, right? And this
represents all the transactions that are happening in this block, right? So we're sending $25, from Darcy to Bingle, or to Bingley force toward dollars and 27 cents here. 1922, right. And it's the exact same thing. So this, all these transactions are
gonna get hashed in the exact same way that the data is going to get hashed. And, and this is why it's so powerful, because again, you know, if I want to be malicious, right, if, if I want to say, hey, I really wanted to give Jane a lot more money from Elizabeth, so I'm puree and I go back and I change it to 100.
Well, now, you know not only do I does my whole blockchain get invalidated because that was so so long ago, but I'm not going to match any of these other chains. Right? And so my blockchain is going to be excluded from the overall blockchain. So and let's let's go ahead and fix this. And it's
the same thing if down here if I become malicious, and I want to send you know, I want Miss Audrey to have less money. Maybe I want to send $1 And they go had in mind it the same thing here, this hash now this two a one is not going to match the rubies rubies hash of BBA. And
it's not going to match Pierce's hash of BBA as well. So the two of them are gonna say, hey, this, your blockchain is invalid, it's not matching the majority, you know, you're out, right. So that's really how these blockchains work at a low level. And it all goes back to this, this understanding this
hash idea, and using it in this very sophisticated manner, to kind of cryptographically prove, you know, where, where stuff lies. Now, the way the blockchain works is, instead of random stuff, put in the Status section, it's actually going to be solidity code in here to finding ways to interact with
different blocks and different protocols that are on chain, or, as we've said before, different smart contracts. Now, the next question that you might be asking is, okay, well, how do I know how can I be sure that I'm the one? You know, let's say
this is, let's say, I'm Darcy right? How can I be sure that I was that Darcy was the one to actually send us money here. How do we know that Darcy sent $25. To Bingley? Well, this is where we get into private keys and public keys. And that's what we're going to go into. Now. Let's just do a quick recap of
what we've learned in this section. So far, right? We've learned that Aetherium actually runs on this hit check 256. But we use Sha 256. For this demo, it doesn't really matter. We're just talking about hashing algorithms. So again, hash is a unique fixed length string meant to identify any piece of data. A
hash algorithm or a hash function is a function or algorithm that computes any type of data into a unique hash. Mining is going to be the process of finding the solution to the blockchain problem. In our example, the problem was finding a hash that starts with four zeros. nodes get paid for
mining different blocks. And the problem is going to be different blockchain to blockchain a block and a blockchain is basically a combination of a block, nonce transaction and previous hash to create this unique hash for this block. And again, depending on the blockchain implementation, this might have a couple other
fields or might have different fields. But this is essentially what's going on blockchains are decentralized and distributed because many independent users are going to run this blockchain software. And they will check and then we'll compare against each other to see which blockchains are acting honestly, and which ones are acting maliciously, in the blockchain
world majority rules. The nonce here is the answer used or the number used to get this hash. Now nonce is kind of an overloaded term, it's actually used for a number of different reasons. In this case, we're using it to solve this problem of getting four or five zeros at the stop or the hash. However,
in Aetherium, it will also be often used as the number of transactions from a given address. So now we're going to talk a little bit about signing these transactions and private keys and some other cryptography pieces, right? Because in this blockchain demo here, we can see
we have all these these fantastic transactions, right? All these things went through, but how do we know that it was Darcy? Who was the one to send $25? To bangli? Right? How do we know that actually happened. And this is where all those pieces that we just learned about in our test net, in our meta mask
account are really going to start to, to come to life here a little bit here. So here we have an example of public and private keys, okay, at the top, we have this private key, right that was that was randomly generated. A private key is you know, as it kind of states is a key that you really want to keep secret,
because you're going to be using this as kind of your your secret password for all your transactions where I can really pick, you know, any, any, any private key, anything that I want. And with it, this algorithm, or they're going to use an algorithm for Aetherium. Bitcoin, they both use this
elliptic curve, digital signature algorithm, it's a variant of just a digital signature algorithm. And it's going to create this this public key, right, I'm really not going to go at all into kind of this digital signature algorithm. But just know it does use some of these, some of the hash