Blockchain Basics Full Course

Cyfrin Updraft Courses · 5:47:52

Ciara Nightingale and Jessica Young of Cyfrin Updraft, joined by Patrick Collins, teach a non-technical blockchain course for complete beginners. It explains why blockchains matter, how Bitcoin solved the double spend problem and how Ethereum added smart contracts, then covers oracles, the Ethereum Virtual Machine (EVM), gas fees, hashing, digital signatures, proof of work and proof of stake, attacks, hard forks, Ethereum Improvement Proposals (EIPs) and account abstraction. The instructors demonstrate a MetaMask wallet setup, test transactions on a Tenderly virtual testnet, Sepolia and ZKsync Sepolia, and an optional Uniswap testnet swap. Later lessons cover DeFi, token types, stablecoins, real-world assets, DAOs and layer 2 rollups.

Speakers

Topics

From Cyfrin Updraft Courses, hosted by Cyfrin.

Transcript

Welcome to Siphon Updraft, the number one leading blockchain education platform. And welcome to this course, blockchain basics. You are about to take one of the most transformative courses in your whole life. And I say that from experience. I did in fact take an early iteration of this course. To get in this seat, I'm in right now. This course is designed to take you from complete beginner to web3 professional and set the foundations for you to take other courses and take other career tracks. This is the first place you need to come to learn the fundamentals. And after this course, you can then go on to learn development security privacy defy and so much more. Or whether you're just

a little bit interested in how blockchains work and you want to get involved, then this is the right place for you. We have been doing this for over four years now, teaching the next generation of smart contract developers how to be successful. On YouTube alone, our videos have over six million views, where we have both the number one and number two most watched smart contract educational content on the planet. And that doesn't even count the number of viewers and users who watch and learn on our education platform, Siphon Updraft. And we've taken all the learnings in those years of doing this education, wrapped them all up to make what you're currently watching the best one yet.

Having made one of these courses for the last four plus years, I've been reached out to by countless developers who are now full-time developers in the web 3 space, making a living, doing well, and contributing to web 3. And there are thousands that I have not met who have left comments or left me notes. And I know we're going to do it again with this video. This course is designed for everybody and anybody, no matter your initial blockchain or development or whatever experience. Whether you're looking to become a web 3 solidity smart contract developer, a blockchain engineer, a solutions architect, or pursue a non-technical role, then this course is for you. And throughout this course and also future courses, we are going to be using AI to accelerate our learning. We'll teach you not only how

to become a blockchain expert, but how to use these AI tools to your advantage to make you a more efficient learner to be able to progress in your chosen career. Don't worry if you know nothing about blockchains, you've never coded before because this course is completely non-technical and we assume no prior knowledge. This course does not cover any development practices, but is a prerequisite course for getting your base level of knowledge and understanding of what blockchains are, how they actually work, and why they are totally awesome. It'll provide you with the foundational knowledge of blockchains to be able to progress down whatever career path you choose. For those already familiar with blockchains or smart contract development, feel free to jump around to the different sections to brush up on things or only learn the

things that you don't already know and grab those specific learnings that you want to take because this course is for everyone. I just want to before we dive into things give you a little overview of how Ciphern Updraft works because most likely this is going to be the first course you're taking on this platform. Cipher Updraft is made to be as user friendly as possible, though it can be a little bit confusing as with getting to grips with any new platform. So, I just wanted to give you a little look around. So, here's how the course is going to be structured. So, in Cipher Updraft, we have courses. These are these overarching topics with individual titles as you can see on the courses page. Each course is split into sections and this will be a specific topic or project where we will group together learnings. For instance, right now you

are watching the introduction section. Within each section, it is then broken down into individual bite-size lessons. And these are individual videos like the one that you're watching right now. And each video also has associated written content. We have created both video and written content for you to choose whichever learning style works best for you. So, if you don't want to hear my annoying grating voice, trust me, I've had to edit this, so I understand. Then you can flip over and read the content instead. But if you prefer to listen and do the activities and projects along with me, then you can do so. If you're watching this on YouTube right now, then this is going to be one long video, so none of that would have made sense to you. But I do encourage you to hop over to Siphon Updraft if you do so because

you're missing out big time. In order to have your highest chance of success, I encourage you to watch this course through from beginning to end without skipping anything, unless of course you already have that knowledge. And on Surf and Updraft, we have tons of choices of where to go next after you have taken this course, which we will guide you through at the end of this course. So don't worry, we will make choosing your next path incredibly easy for you. For those of you who don't know me, my name is Patrick Collins. I'm a smart contract engineer, security researcher, and just lover of all things web 3. I'm one of the co-founders of the smart contract auditing firm Siphon, a smart contract YouTuber, and I live and breathe smart contract development. I absolutely love web 3, blockchain and smart contracts, and I love the power and the tools that

they enable us to use. But not only that, I love taking blockchain developers like yourself watching this video right now on the journey to becoming a successful smart contract developer. I think the key to web 3, to blockchain, to cryptocurrencies being successful is having a phenomenal foundation of developers. So, I'm incredibly [snorts] excited that you're here with me. And for those of you who don't want to become blockchain developers, just stop once we get to the coding. In any case, I'm incredibly excited for your journey. This is a data dump passion project of all the knowledge that I've collected over the past few years of working in this industry and being a smart contract developer myself. And at this point, I have the track record to show that I am 100% confident that if you follow along, if you code along with us, if you follow

me on this journey, you will come out the other side armed with the knowledge to be a positive force for the cryptocurrency and blockchain industry. Hi, we have already seen each other briefly, but my name is Kira Nightingale and I am one of the lead instructors here at Cipher Updraft. I'm passionate about all things cryptography, so blockchains, something called zero knowledge proofs. I love math. I'm a smart contract engineer and I'm passionate about helping people break into the industry as I know it can seem a little bit intimidating from the outside. So, I want to make that process just a little bit easier. I hear so many people say that they think the space is just too complex, too confusing, or that they just don't have the right background. But the truth is, anyone can join this space. Anyone can learn about blockchains and get a thriving career.

So hopefully I can help make that process a little bit easier for you guys. And just remember, this course in particular is not technical. So if you don't want to become a developer or you're not a developer, then don't worry, this course is also for you. So we've been yapping on for a while. Why should you take this course? Blockchain professionals, smart contract engineers, security researchers are all in demand. For instance, a smart contract engineer average salary is around $145,000 per year. And with AI making things more accessible, it becomes much easier to get up to speed quickly. However, only those of you who have the true deep knowledge and understanding of the underlying technology are going to be able to reap the rewards of this opportunity.

>> AIS get stuff wrong a lot. So, we especially need the knowledge to fact check whenever AIs get things wrong. Being here, you have the opportunity to be a pioneer ushering in the age of web 3, of cryptocurrency, blazing the trail of where this phenomenal industry has yet to go. Like I said, this isn't the first time we've done this. We've already helped so many developers get into the space. >> In this course, we are going to give you the most upto-date and cutting edge knowledge understanding tools and examples. We're going to be talking about smart contracts, node operators, decentralization, defy, NFTts, Dows, and so much more. All of these words are suddenly going to be able to make sense to you. And once you have finished, the next steps are going to be super crystal clear.

>> And opportunities to make a huge difference in this amazing industry. However, I can't just give it to you. You have to come with me on this journey. You have to take the step. Despite what you might think, you know, cryptocurrencies and smart contracts enable a more accountable world, a more transparent world, a more collaborative world, a world where promises can't be broken. And that's a world that I want to live in. So before we even get started, I want to give you a huge thank you for even being here on this video and listening and being interested in engaging in this phenomenal technology.

So, thank you for being here and welcome to the rabbit hole cuz we're about to drop down. With that being said, let's get froggy. >> Unlike Patrick, I don't have a cool catchphrase. At least not yet. But I'm super excited to do this with you all. I guess I do have a kind of little catchphrase that sometimes I end meetings with, which is cipher number one. Woo. And I'll see you in the next one. Let's begin our blockchain journey by talking about some best practices. That way you can get the absolute most out of this course and be as effective as possible. Now, you're either watching this on Siphon Updraft or YouTube, and I encourage everybody to watch this on Siphon Updraft because we've got a ton of features that make the learning that much easier and more enjoyable. Let's

quickly go through a couple of key resources that you're going to be using throughout this course and other courses on Updraft. If you're watching this on Cipher Updraft, there's a couple of helpful links that I want you to be aware of and to know where they are so that you can use them much more easily. The first is on the top right hand corner of this video. You will see a little resources dropdown. Here you'll see course resources, discussions, and glossery. The first we're going to look at is this course resources. If you click this link, it'll take you to a GitHub repository for this course. This is essentially just a page that shows you all of the helpful resources for this course, for every single lesson.

what helpful blogs, articles, videos, what did we use to research for this course, etc. So, if you scroll down in this document, you'll see links for all of the different sections and be able to easily see any extra resources that you need. I will refer to this section frequently throughout the course. If I ever talk about the resources section of this course, this is exactly what I'm referring to. You can think of this GitHub repo as like your bible for this course and there is a separate one for each course on siphoning updraft. Additionally in this GitHub there is a discussions tab. So if we click on that resources button again and the dropown and then we go to discussions. This is where you can ask all of your questions, thoughts, queries, interact with other

members taking this course and discuss anything that you're having trouble with. Then finally we have the glossery. This is where we have broken down all of the different technical terms so that if you forget what something means, you can quickly go and have a little scan and see what a term means. Now, back on Cipher and Updraft, you'll see the written lesson button. If you cannot stand the sound of my voice or the look of my face while you're watching this video, you can just flip over to the written lesson and read the course curriculum there. And it's also good to come back to if you want to have a little refresh or copy and paste some of the content, maybe for notes. So, it depends on your learning style whether you want to listen to this course or whether you want to read it. If you

scroll down below this video, there is a little update section. This section is currently blank. Here is where we will note down if anything changes in the course and we haven't swapped out the video yet. This is going to be more relevant if you are a developer and you get to the development courses on a cipher updraft. If there are any changes to the development process, we will note it in the update section. This is a very fast-moving industry, so things are changing all of the time and sometimes things need to be updated. So, while you're watching this course, please be sure to check out the update section to check if anything is there. And if you notice anything that you think might be incorrect, please be sure to make a discussion on the discussions tab.

Again, this is going to be more relevant once you get to the programming courses if that's something that you want to do. In the discussions tab, there are also going to be some helpful TAs who will come along and answer your questions, including myself and Patrick and Jess. But we also have a discord link for more realtime communication. I urge you to ask your questions on the GitHub discussions since they are indexed. So other people searching in Google for their same question, they will be able to see the answer from your GitHub discussions. But Discord is still a phenomenal place for you to come and join meet up with other people taking the course and talk directly to the Cipher team. For those of you watching on YouTube, hi. If you scroll down to this description of this video, there are going to be links to all of the

resources I've just mentioned and also a link to Cipher and Updraft if you change your mind. You've kind of already seen some of the advantages of Cipher and Updraft, including those written lessons, but you're also able to track your progress. So, the courses are broken down into individual lessons and will save where you are in each of these lessons rather than having to scrub through an entire video. Additionally, on Cipher and Updraft, we have quizzes for you to test and solidify your knowledge and a test at the end of the course for you to be able to get your certification of completion badge. Also, if you wanted to open up the YouTube video and play that in the background and leave us a little like, then we'll get a bump in the YouTube algorithm and will greatly help us out. So, thank you so much. I also wanted to make a note on

AI. If you have any questions, I always encourage you to ask your favorite AI your questions first because they are great at explaining these things in a helpful way. So if at any point you become stuck, please, please, please go and ask ChatGpt, Claude, Gemini, whatever your preferred AI is, and see if that helps first. Just keep in mind that they do sometimes get things wrong. So it's great to always fact check things, check with a human or another resource. So, be sure to say hi in the discussions and meet some like-minded people. I also just wanted to make one note on coding. This isn't a coding course, but quite often this is the first course that people watch on Cipher and Updraft. Once you get to the coding courses, so not blockchain basics. I

encourage you to code along with myself, Patrick, Jess, so you can have the video up and also your coding screen so that you can code along and make sure you solidify the knowledge. And on Cipher Updraft, you can click the little video pop out button and have the video pop out so you can code alongside it. And of course, if you have any problems while coding in the other courses, please make a GitHub discussion so we can answer all of your questions. Asking questions is an art and asking these questions in a well formatted way makes you first of all an AI prompt engineer, but also helps us to better answer your question.

So, make sure that you add lots of detail into your question and give us all of the relevant information. The next thing I wanted to say is take breaks. Maybe every 25 minutes or an hour, whatever works for you, take a little break. Maybe you like to take longest chunks or shorter chunks. Just don't try to rush through everything as quickly as you can. Make sure you give time for your brain to absorb the information. Go outside, take a walk, go to the gym, get some food. Your brain needs time for the information to settle. Maybe every 2 hours you step away, be done for the day, go for a walk, go at the pace that works for you.

Everyone has a different learning pace. There is no right speed for this course or any of the courses on Cipher Updraft. Not only that, but you can also change the speed of the video itself. On YouTube, you can click the little gear icon and change the speed of the video. And on Cipher and Updraft, there's the playback settings where you can click the speed and change it. So, if I'm talking way too fast, you can slow me down. Or if I'm talking really slow, you can speed me up. Additionally, if English isn't your native language, we have lots of different subtitles on Cipher Updraft. So, make the different adjustments that you need to make the learning work for you. This course is modular, so you can bounce around the topics that work for you. So, if you already know some of this content, you

can feel free to skip that. If you want to do a section again, you can do so. If you want to go right to the advanced stuff, you can feel free to go and do that. And like we said, go at the pace that works for you and take the learnings that you need. After each lesson, it makes sense to go and reflect on your learnings for that lesson and really make sure the knowledge gets ingrained. One of Patrick's favorite sayings throughout this course and other courses is repetition is the mother of skill. And we're going to be repeating the information a lot to really make sure that we understand it and remember it. As I mentioned previously on the Cipher and Updraft platform, we are also going to be having some quizzes to test your knowledge and check that we've actually learned what we're supposed to

be learning. If you're watching on YouTube, you won't have that. So, go sign up for Cipher Updraft, by the way, for free and then play the YouTube video in the background to bump the algorithm for us. Thank you. In the GitHub repo, I've also left some helpful resources. So, of course, we have the discussions tab, but I've also left links to Ethereum Stack Exchange, which is like a decentralized Q&A forum, and different AI and more. And one thing about getting into the blockchain industry is to learn how to unblock yourself. And the key to doing so is using AI, using these Q&A forums, using the GitHub discussions, using Discord to be able to ask effective questions. Plus, syncing and meeting other people in the space makes it so much more fun. So, those are some best practices for you to be super

successful. Remember to ask AI your questions and if you get blocked to open a GitHub discussion, but you are now standing on the edge of your next step to becoming a blockchain professional. And if you're like us here at Cipher Updraft, once you jump in and get started, you're just going to want to go deeper and deeper and learn more and more because it's such an exciting space. I'm so excited for you to start this journey with us and I'm looking forward to seeing you on the other side and learning what courses to do next, where to go next in your career. Let's get started with the blockchain basics.

Let's go. [music] Now, throughout this course, you will see a number of different guest lecturers who are going to be giving you this information. We work with some of the best people in the industry to give you this information. For lead instructors, I've already introduced myself, but just to reiterate, my name is Patrick Collins, and I will be the lead instructor for the majority of your journey on Siphon Updraft. But it's not just me who helps out creating the curriculum here. I'd like to also introduce our co-lead instructor, Kira Nightingale. I will let her go ahead and introduce herself. >> Hello everyone. I know we have already done kind of an introduction. You kind of know who I am, but let's just do something a little bit more formal. My name is Kieran Nightingale and I am a lead instructor here at Cipher Updraft and I care a lot about your learning and

teaching you to become the best web 3 professionals in the world. I myself learned from Patrick Collins years and years and years ago. So I am hoping to be able to impart some knowledge on you guys as well so you can pass that down as well. I love all things coding, blockchain engineering, security and particularly cryptography and math. That is the kind of the thing that makes me tick. My background is in physics, so any equations, funky things like that are just I absolutely love them. I am super excited to be going on this journey with you. And I can't wait to see all the incredible things that you guys get up to after taking this course.

So, good luck. And before we get started, I also just want to introduce you to Jess, our final instructor, who will also be teaching in this blockchain basics course. And I'll let Jess do a little introduction to herself. Hello, my name is Jess. And just a quick introduction from me, I will be leading section three of this course. And to give you some of my credentials, I have a mathematics degree. I've been working full-time in web 3 for six years now. And I have been working at Cyprin for two of those years. Imagine [music] a world where you could send money to anywhere, anytime, without a central authority or intermediary being able to control your money, without needing

permission to prove what's yours, without anyone having the power to freeze your assets or deny your transactions whenever they like. This isn't science fiction. It's not woowoo. This is blockchain. And by the end of this video, you'll understand what blockchains are and why they really matter. To understand what blockchains are, we really need to understand the problem that they solve. Why you're here, why you are watching this course. There are two fundamental problems that we want to solve. The first problem is centralized money. Let's take a look at the traditional world. Let's say you're sending money to your friend through your bank. What's actually happening here? In most instances, you're not physically handing them cash anymore.

Instead, the bank updates its records, talks to other banks, and eventually updates the bank's records of your friend's balance. You're trusting the bank with complete control over your money and transactions. You're trusting that they will act honestly and actually execute your transaction. These intermediaries don't just facilitate the transaction. They don't just allow it to happen. They control the entire process. They have full power to deny your service, freeze your assets, or cut you off completely. To help you understand and really feel this, let me give you a few examples. Let's say your friend who lives the other side of the world has done you some freelance work. You want to pay them right away. But unfortunately, you can't. Why? Because they don't have a bank account because

they don't currently have a permanent address and the bank requires them to have a permanent address to be able to set up a bank account. Let's now look at an actual example. In 2022, somebody called Vitalic Buterine, who we're going to look at later. He was the inventor of Ethereum, which is just a specific blockchain. It's not going to make any sense right now, but it will later. He wanted to donate to support Ukraine during the war. If he were to use traditional banking, this would create paper trails that might alert hostile governments and put humanitarian efforts at risk. But instead, he used cryptocurrency and enabled Vitalic to donate to Ukraine anonymously and without anyone intervening and blocking his transaction. The second problem is centralized agreements. Beyond money, we

also struggle when we need to make decisions or agreements together. Traditional systems solve this by having some central intermediary to facilitate the agreement. We trust them to be fair and honest. But what happens when the trust breaks down? Let's look at a theoretical example. Let's say you are voting in an election. After the election, the votes are counted up and the winner is announced. But chaos then ensues because everyone on both sides is arguing that the other party participated in foul play. They both say that they manipulated the results and tampered with the votes. But what if we had a system where no one could tamper with the votes and everyone had to abide by the rules of the election and cheating just isn't possible. For a recent example, the recent US election

saw widespread allegations of fraud and cheating. Whether these claims are valid or not is kind of irrelevant because they revealed a fundamental problem. People can't independently verify the validity of the results. When the trusted authority breaks down, the entire systems legitimacy comes into question. How do we know for sure whether they cheated or lied or not? The solution to both of these problems, so centralized money and centralized agreements is blockchains. For centuries, we have just had to accept this power imbalance because someone ultimately had to be the central authority to decide who owns what and keep the system fair and make sure that there was a source of truth according to some person who says so. But what if we

could create a system where no one person has this power? Where the system itself is the authority and no single person or institution can override that? What if the system truly was fair and had a source of truth that wasn't based on trust at all? Enter blockchain technology. But what actually is a blockchain? First, I want you to think of a ledger. So, those big books that accountants use to track transactions or used to use before everything was online. And now, instead of imagining each bank owning its own ledger, now imagine there are thousands and thousands of people across the world that have an identical copy of the same ledger. one ledger to rule them all.

When someone wants to make a transaction, they announce this to everyone by creating [clears throat] a unique digital signature, which is like a fingerprint that only they can make. Everyone with one of these copies of the shared ledger checks does this person have the money to send this transaction and that the transaction did actually come from the intended sender. And if the majority of people agrees that this transaction is valid, everyone simultaneously updates their ledger. And the way they keep track of this book is that each page of this book contains a set number of transactions. And after some specified time period, all the transactions get bundled together into one of these blocks like a page in our ledger. And then at the end of each page

or each block, there includes a special code called a hash that mathematically links each page to the previous page. It uses a unique fingerprint of all of the information, all of the transactions on the previous page. Think of it like a seal of approval that if any of the text on the page changes, the seal breaks. If someone tries to change an old transaction on page 10, it would change the page's fingerprint and would break the link to page 11, which would break the link to page 12, and so on. Everyone would immediately see that the pages were broken and reject the change. This is why it is called a blockchain. It is literally blocks of transactions that are chained together mathematically creating [snorts] a permanent

tamperproof history that everyone shares. It is a shared record book that everyone is keeping. And these individual participants that are keeping a copy of the shared ledger are called nodes and they form what's called a decentralized network. A network of nodes where there is no one centralized authority. And this is a type of peer-to-peer or peer-to-peer network. So each node connects directly to other nodes in the system. There is no central server that controls anything. When Sally sends 10 tokens to Tony, the transaction spreads across the network like gossip. This is actually a technical term which is kind of funny.

It's actually called a gossip protocol and describes how this information propagates through the network without needing any central coordinator. And each node will contain a complete copy of the blockchain. Nodes can freely join or leave the network. And if nodes go down, it doesn't matter because everyone else also has a copy. So to summarize, a blockchain is just a shared ledger, a shared record of all of the transactions. And these transactions are grouped together in blocks where each block is mathematically linked to the previous block through cryptography. And it's maintained and controlled by a decentralized network of participants called nodes. So instead of having to trust one bank with the master ledger, you're trusting math and that a majority

of participants are going to act honestly because everyone gets to agree on the valid state of the blockchain. If something bad happens, if someone tries to send a fraudulent transaction, the majority of the network are going to block this transaction and say no, we don't want to keep a record of that. If this sounds confusing to you, don't worry at this point. We are going to go into so much more depth throughout this course of how this actually works. And right now all I really want you to understand is that rather than having one book keep one ledger, one central authority who controls what happens and what the records say, we have a shared ledger where the same copy, the same ledger is shared among multiple participants who all have to agree on

what is happening. It is decentralized and this is the blockchain. Blockchains create what's called a trustmin minimized system. Instead of having to trust intermediaries like banks to not freeze your funds, trusting governments to not debase your currency, trusting companies not to change the rules, you instead trust in math and code. The system guarantees fairness rather than having to rely on trust. And to create this system, we not only need blockchains, we also need to create digital currencies that exist on these blockchains. A digital currency is any form of currency that exists purely in a digital form rather than physical banknotes or coins. And we need these digital currencies to exist to be able

to remove that central authority. Let's now dive into the origins of digital currencies and blockchains to really understand what they are used for. Let's start with the origin of digital currencies and then move on to the origins of blockchains. And let's start with one that you might have heard of before and that is Bitcoin. Bitcoin is a digital currency and it exists on a blockchain also called Bitcoin. Bitcoin became known as digital gold. And this is because like gold there is only a limited amount referred to as a finite supply. There will only ever be 21 million of Bitcoin. And Bitcoin finally allowed people to be able to store and send value digitally without having to

trust a government or intermediary. But it actually wasn't the first digital currency, but it was the first one to solve something called the double spend problem. Let's take a little look into this by going backwards very briefly. So digital currencies have actually been around since around the 1980s. The first major one was called DigiCash. But Digiash had a fatal flaw. It needed that central authority, that central intermediary to agree on who had sent what and what all of the balances were. which of course meant that this intermediary could freeze your funds, reject your transaction and had complete control over the system which is of course the problem that we are looking to solve that we need blockchains for.

But why did they need the central authority and this is because of the double spend problem and it works a little bit like this. If I email you a photo, I still have that photo also on my computer. So now we both have a copy of this photo. For photos, this is of course fine, but digital money has this problem, too, or had this problem. I could send you my $100. You'd have $100, but I would also keep my copy. I could then just spend the money over and over by just creating copies of it. What is to stop someone copying and double spending your digital coins? Physical cash, of course, doesn't have this problem. If I give you my $20 bill, I no longer have that $20 bill. But with digital money, we need some way to make

sure when I send you my money, they are actually gone from my account and cannot be copied. And the way the early digital currencies solved this was to have a central company of course tracking everyone's balances. And this defeats the whole purpose, the thing that we are trying to avoid. So how do we create digital money that cannot be copied and doesn't need a central authority to control every transaction? How do we solve the double spend problem while maintaining a system that cannot discriminate or censor? And this is actually a famous computer science problem and it's called the bisantine general's problem. I might be pronouncing that wrong. So we have some generals who surround a city and they need to coordinate an attack and they

can only communicate by messenger. But how can you be 100% sure that the messages you received are from honest generals and not attackers? How do they reach an agreement on when to attack? Similarly, in digital money, how do you get thousands of computers to agree on which transactions are valid when some might be dishonest? And this is precisely the problem that blockchains, specifically the first one being Bitcoin, solved. In 2008, someone or an entity or a group of people called Satoshi Nakamoto, published a paper with a solution, and that solution was, of course, Bitcoin. They had finally solved the problem where they created a digital currency that did not have the double

spend problem without relying on a central authority and they did this using blockchain technology. Bitcoin is a decentralized digital currency that operates on its own blockchain network called Bitcoin. So the idea that Satoshi had of course was what if everybody keeps track of everybody's balances and that is of course what blockchain does and this creates a system which is credibly neutral. It doesn't care if you're a billionaire, you're in debt or you have $2. It doesn't care where you live. It doesn't care whether you're trying to buy a coffee or send money overseas. The rules are the same for everyone and it's enforced by code rather than enforced by people or

authorities who might discriminate or have favorites. We don't like favorites. And this neutrality is built into the system. And that's exactly what makes it credible. You don't have to trust that it's neutral. It just is. No single person or organization controls Bitcoin. Not even Satoshi Nakamoto. There's no CEO who can change the rules. No board of directors who can freeze accounts, no governments that can shut it down. The network simply processes transactions according to its rules baked into code. It is blind to everything else. It doesn't have access to any other information. For people, for example, living under repressive governments, experiencing hyperinflation, or excluded from traditional banking, this is

absolutely life-changing. It means that for the first time in history, anyone with internet access can access a global uncensored monetary system. Your money is yours and only you have access to it. Pretty cool, right? So then a few years later, a man named Vitalic Buterine thought, what if we could take this concept of credibly neutral money and extend it to agreements where the terms of those agreements are unbreakable rather than having to trust that all parties in the agreement are going to act honestly. Then you could create unbreakable agreements. If you buy me lunch, I'll pay you back tomorrow. If you loan me some money, I'll pay it back

to you with 10% interest. You don't have to trust me. What if it is baked into code using a credibly neutral system? So in 2015, he and his team launched Ethereum. Like Bitcoin, it also has its own digital currency and it's also baked into the chain and it's called Ether or ETH. But Ethereum's superpower is not just digital currencies. It's that it can also run code that can do more than just tracking money. It can also create credibly neutral agreements. And this brings us to one of the coolest concepts in blockchain in my opinion, smart contracts. So the idea isn't actually totally new. A cryptographer named Nick Sabo actually described it back in 1994.

But blockchain and Ethereum made it finally possible. So to understand what smart contracts actually do, let's think of a traditional agreement. Let's say you're buying a house. To do this, you need lawyers, banks, different companies, insurance, all working together to make sure that the deal happens correctly. Lots of intermediaries, lots of fees, lots of things can go wrong, lots of delays. Not ideal. Let's now also imagine you're making a simple promise to a friend. I say to you, I promise next time, next week, I will pay for the coffees. Here, buying a house or agreeing to pay for coffee, you are entering into an agreement. you are entering into a contract where traditionally anyone in that contract can break the terms of the

agreement. This is because in traditional agreements we rely on both parties to trust that they will hold up their end of the bargain just based on their worth. Failure to do so can end in arguments, court involvements, loss of funds, or even worse. So, wouldn't it be nice if these agreements could be totally unbreakable? And this is exactly what smart contracts are that Ethereum enabled, unbreakable agreements. So, we're going to be going into a lot more detail into smart contracts in a future lesson, but let's just go into from a high level what they are right now. As with blockchains, if you don't understand what smart contracts are in this lesson, don't worry. We're going to be going over all these concepts

multiple times. So, a smart contract is like a regular contract, but rather than being written down digitally or on paper, it's written in computer code. And instead of having to rely on lawyers or courts to enforce the rules, the blockchain automatically enforces it. Let's use a simple example. Let's say your flight was delayed. Maybe it was 24 hours. Your airline promised that you'd get a refund if this delay was not your fault. You register your claim, but once you submit, the terms have changed and the airline doesn't give you your refund because they claim suddenly that the circumstances were out of their control.

Now, imagine that the terms in which you receive your refund are baked into code and they cannot be changed. Once both parties agree to the terms, it's final. If your flight is delayed, you get paid the refund within minutes. And this is exactly what smart contracts enable, unbreakable agreements. And this is the key difference between Bitcoin and Ethereum. Bitcoin is decentralized digital currency. Ethereum is decentralized digital currencies and agreements via smart contracts. So, Bitcoin is like a calculator. It's really good at keeping track of digital money. Ethereum is like a computer. It can do that, but it can also run apps, games, and all sorts of programs via smart contracts. Bitcoin's creators

intentionally kept it simple by focusing on being the best digital money. Ethereum's creators wanted to create a world computer where anybody could run unstoppable applications and agreements. Technically, Bitcoin does kind of have its own smart contracts, but they're intentionally something called cheering incomplete. So, they don't have the full functionality of like a normal programming language, unlike Ethereum, which aside from some small caveats, is cheering complete. We're going to go into chain completeness later, but you can think of Bitcoin as not having smart contracts, only having digital money on the blockchain, and Ethereum having digital money and smart contracts.

So, now we understand where blockchains and digital currencies come from. Let's go through the benefits of blockchains in a little bit more detail so you can really feel why these blockchains are so cool and so revolutionary. I really want to be inspiring you here. So, the first benefit is that they are permissionless. So you actually own your money. In the traditional system, you need permission for everything. Permission to own an account, permission to send money, permission to access your own funds, permission to participate. Banks and intermediaries control your money. You just have permission to use it. And that permission can be revoked at any time.

So is it even really yours? With the blockchain, it's permissionless. No one can deny you access. No one can stop you from transacting. You don't need anyone's permission to use what's yours. The second benefit that we've already talked about is that it's credibly neutral. It works the same for everyone. Traditional financial systems can discriminate. You can't get a bank account without an address or government ID. You can't receive international payments in some countries. Services can be denied based on nationality, credit score, or even in some extreme cases political views. Blockchains, however, are, as we said, credibly neutral by design. It doesn't care nor even know who you are, how much money you have, where you're from, what your credit

score is. The protocol treats everyone exactly the same. The system literally cannot play favorites because it is just code following rules. There's no human bias. There's no discrimination. It is just math. The third benefit is of course it is decentralized. No one can stop it. Traditional systems are of course as we said centralized. They have a single point of control and failure. Governments can shut down banks. Banks can shut down accounts. Companies can go bankrupt. Servers can be seized. But blockchain is decentralized. It's just thousands of computers storing the information running the blockchain worldwide. In order to stop the blockchain, you'd have to shut down the

internet itself. Even if the banks block it, the network will keep running. Your transactions will keep processing because no single entity controls it. And the fourth benefit that we're going to talk about is that it is immutable and transparent. The rules cannot change and everyone knows the terms. Traditional systems are opaque and changeable. Banks can change the fees without warning. Companies can update their terms of service after having signed the agreements. Governments can shift regulations overnight without telling anyone. And this all happens behind closed doors. In blockchain systems, everything is transparent. All the transactions are visible to everyone. We can all see where the money is going and what is happening. And also, it is immutable. Once something

has been recorded, once it is written down in the book, in the block, included in the blockchain, it cannot be changed. It can't be deleted. History cannot be rewritten. The rules are written in code and they are visible to everyone. So, this is all really cool. And blockchain sounds amazing, but what are the real use cases? What can you actually do and is being done with blockchains today? So, we've already discussed the first two, so let's recap them very quickly. First is, of course, digital money. So, we have Bitcoin for Bitcoin and ETH for Ethereum. And they let you send money without banks. It's digital cash you can send over the internet without a central authority.

And the world of blockchain finance is referred to as DeFi, which stands for decentralized finance. and it actually goes way beyond ETH and Bitcoin. And we're going to go into that in the use cases section of this course. It's really cool. So, get excited for that. Another type of digital currency is stable coins, where the value of a stable coin matches that of another asset. For example, USDC is a digital dollar. One USDC is the same in value to $1. They can be swapped one to one. For people in countries experiencing hyperinflation, stable coins are absolutely life-changing. With USDC, people can protect their money by holding digital dollars instead of their local currency because potentially the value of the dollar is more stable. The

second is of course smart contracts. So those unbreakable agreements, they are like regular contracts, but they execute based on the predetermined rules of the code. So you can imagine insurance that pays out deterministically. So there's no paperworks, there's no filing claims, there's no reliance on the insurance company, there's no reliance on anyone to make a human decision as to whether you should receive your payment. If the terms of the code say you should, you just will. But there are also many other use cases in blockchains. Another use case, of course, is crossber payments. Currently, sending money internationally is broken. Applications like Venmo or PayPal often don't work between countries. But with blockchain, you can send money to anyone at any time, anywhere, in minutes. And apps like

Clave allow you to send money to your friends in other countries as easily as sending a text message. The next use case is something really cool and that is digital ownership. Through the blockchain, you can prove the ownership of digital assets like digital art, music, in-game items, education certificates, or even digitalization of real world assets. For example, you could have a token representing your house and then you could sell a fraction of your house via this digital ownership. Artists can then sell their art without galleries having to take a massive cut. Gamers can actually own the in-game items and then sell them. It's a certificate of authenticity that cannot be forged. And all of this is enabled via onchain tokens, which we're going to

revisit later in this course. The next use case is global financial access. Currently, there are so many people worldwide who can't access financial services. No stock markets, no savings accounts, no investments. But with just a smartphone and the internet, blockchain gives everyone the same financial tools that someone on Wall Street would have. And this is decentralized finance, aka DeFi. You can trade, you can save, you can invest, you can build wealth regardless of where you were born or who you are. The next use case we're going to touch on is governance. Instead of having traditional voting, communities can make decisions together via Dows or decentralized autonomous organizations.

Think of a DAO as like a club where each of the members gets to vote on what happens. But the voting and the results are completely transparent and deterministic. It cannot be forged or manipulated. Again, of course, don't worry if all of this sounds confusing. We are going to be taking a deep dive into the use cases of smart contracts and blockchains later in this course. The most important thing I want you to understand right now is that people are already using this. This is already changing lives and solving real problems. Now, I just want to address a couple of things before we finish up this lesson.

The first is some terminology that you might hear. So, first of all, DAP. And a DAP is a decentralized application. So, they're basically apps built on the blockchain. Instead of having backends running on servers as with usual applications, they run on these decentralized blockchains. You can think of them exactly the same as you would a normal app, except no one single entity controls them. And unlike an app or DAP on your phone, when we say DAP, we are also referring to decentralized websites. So if Google had a blockchain for its backend, we'd also call the Google website a DAP, too. You may also hear them referred to as a decentralized protocol or a smart contract protocol, but they all mean the same thing. They are usually just a smart contract or a

system of smart contracts working together instead of having a centralized server. And then we have the term web 3. And this refers to the new internet that we are building. Web one was simple websites where you could only read and web two was what gave us social media and interactive sites. Big companies and institutions control and own everything including your Instagram profile. They can shut down your Tik Tok at any time. Web 3 gives us a more open internet. It is the internet but with blockchain. We now have smart contracts and user ownership where you actually own your digital assets and your data.

The next thing I wanted to touch on very briefly was some common concerns with cryptocurrencies and blockchains because you might have heard of them before and think that they're a little bit scary or have some misconceptions. So, I just want to clear everything up. If you haven't been thinking this, then don't worry, but I just think it's worth mentioning. So, first of all, isn't crypto just for criminals? You might have seen some scary news titles, things like that. But cash is of course used for crime, too. But we don't ban cash. Blockchain transactions are traceable, which actually makes them better because there's a permanent record. There's no permanent record of cash. But we in the industry are actually, as I said, in the process of also adding privacy into blockchains via zero knowledge proofs.

And projects like Aztec are building this right now. And that is because privacy is not a crime. You are watching this on the internet right now. Criminals use the internet for criminal activity all the time. Yet, we don't ban the internet. Just because tech can be used for bad doesn't make the tech itself inherently bad. It can also be used for good. And that's because the tech itself is neutral. It's the person using it and how you use it that determines whether something is good or bad, not the underlying tech. Crypto and blockchains are the same. It gives financial access to people who can't get it. For the first time in history, you can get access to financial services regardless of where you're born. Yes, criminals can do bad things with it,

just like they can do bad things with cash, stocks, a computer, but the amount of good that blockchains also bring to the world means that we can't just throw the baby out with the bath water. The second thing that people often say is that it is bad for the environment. So there are some blockchains that use a lot of energy but newer ones are also incredibly efficient and they actually use less energy than traditional banking systems. According to the University of Cambridge, if we look at large companies, banks and even buildings, they use hundreds of gawatt per hour of energy comparing this to Ethereum which uses approximately 5 GW per hour. And the third thing that people say is that it is just too complicated which actually we have done so much work to make sure that this is no longer true.

In most instances using a blockchain app is pretty much no different from using any other app. You don't need to understand the intricacies of how the internet works to use Instagram. And the process of onboarding to blockchain is currently being worked on all of the time. And that's actually why we need people like you to join the space and work on onboarding users and improving the user experience. Let's just do a very quick summary before we move on. What is a blockchain? It's a shared record, a shared ledger that no one can manipulate. It's a way for people to agree on what is true without needing to trust a centralized authority. Whether you use it for money, contracts, ownership. Blockchain gives you direct control and ownership over your digital life. We're still in the early days. Blockchain right now is like

the internet in the '9s. Most people didn't see the point, but it was just about to change everything. So, this is a super exciting time for you to get on board and join in. Because in the future, we are going to be using blockchain to vote in elections from your phone where no one can tamper with the result. You will be able to own a fraction of a building in Tokyo from your living room. You'll have a universal digital identity that works everywhere without exposing private data. You'll get paid instantly for your work without having to wait for payroll. And this is already happening in blockchain native companies like Ciphen right now. So, I know this has been a lot of information to absorb and don't worry, as I said, we're going to go into more detail with these concepts and we're going to be going over it again

and again. So, if you're still really not really sure at how it works or what's really going on, then that's to be expected at this point. I just wanted to get you a little bit excited. And the main thing is I want you to understand why blockchains are so powerful. And to help you get a real feel for the problem that blockchains solve, I have created some challenges for you. So, if you head over to this URL, you can take these challenges, give them a read, and then hopefully you will really feel the problem that blockchains are solving. And as I said, in future lessons, we're going to be looking under the hood at blockchains, how they really work. And that will really help you understand how they are permissionless, transparent, immutable, decentralized, all of these things, and how that actually is achieved through blockchains. But for

now, just get excited about being on this journey together and getting involved. And after you have finished with those challenges and only after you finish with those challenges, I will see you in the next lesson where we will learn a little bit about the different blockchain ecosystems, the different blockchains out there, and why there are so many. I'll see you very soon. All right, so hopefully you now understand a little bit about what a blockchain is, but most importantly, why they're absolutely gamechanging. But I just wanted to touch on something that I found a little bit confusing when I first started, and that is that there isn't just one blockchain. And we've actually already talked about two of them and that is Bitcoin and Ethereum.

But there are actually many many blockchains and they all have different types. We have ZK sync, we have Salana, we have Arbitum, we have Polygon, we have optimism and so on. There are different types of blockchains that all have different purposes and work a little bit differently. Don't panic if you find this lesson really confusing. I know this is a lot of information very early on, but I just wanted to give you a quick lay of the land. We're going to go into more detail with the different types of blockchains later, but this is kind of like a map before we go on the road trip. I don't want you to memorize the entire street. I just want you to understand the general geography. And then we'll take a deeper dive into the technical details much later in this course. And as Patrick, who originally

recorded this course, said, "Repetition is the mother of skill." So the more that we repeat things, the more that they will become ingrained and we'll understand them. So, why are there so many blockchains? Now, let me paint a little picture for you. We're in 2021. Everyone is selling and buying these weird things called NFTts, which I know we haven't touched on yet, and we have these things called transaction fees, which again, we're going to touch on later. But essentially, to interact with the blockchain to send transactions, you have to pay. And the more people that are sending transactions, the higher these fees are. And you can imagine it a bit like having to pay $200 just to send $50 to your friend. not particularly useful. And this happened because Ethereum is designed to process about 15

to 30 transactions per second, but there were thousands of people trying to send transactions and use Ethereum all at once. It's like we had only one road into the city and it was rush hour. There was a massive traffic jam and no one was getting anywhere and the cab fees were incredibly expensive and it was incredibly slow. So what did they do? They just built more roads. And obviously our analogy here, there are more blockchains. So they just build more blockchains. There are two main types of blockchains. We have a layer one blockchain and we have a layer 2 blockchain. The layer 1 blockchains, some of them solve this congestion problem, some of them don't. They have other benefits. I don't really want you to worry too much right now about positives and negatives of different

blockchains and layer ones and layer 2. I just want you to understand briefly the fact that there are many chains and they fall into different categories. So layer ones are like entirely different blockchains. They are completely separate from each other or L1's for short and you can think of them as entirely different highways. Salana for example is its own L1 and it can handle many many more transactions per second than Ethereum. It does have trade-offs for doing so which we're not going to go into right now. And different layer ones can work a little bit differently from each other with their own ecosystem, their own developers, their own communities. It's like how different countries have their own languages, maybe their own currencies, etc. But the Ethereum ecosystem is the largest and it's the one that we're going to be focusing on primarily in this course.

But here's the good news. Once you understand how Ethereum works, you can easily learn other blockchain ecosystems. It's like having to learn Spanish first. Once you know it, it's easier to pick up things like Italian and Portuguese. So, we have these layer ones, these different blockchain ecosystems, and then we also have what's called a layer 2. And as it sounds, a layer 2 is actually built on top of a layer 1. So you take the security, the decentralized nature of the layer one. Let's say it's Ethereum. And then you kind of make it bigger by building an extra layer on it. You can think of it as like an express lane above the main highway. So they handle all the traffic up top. What they do is they take loads and loads of transactions and they like compress them all and squish them down so then they could be submitted back to

the layer one. I really don't want you to get stuck on understanding the difference between layer ones and layer 2s. I kind of just want you to understand that they exist. And then when you hear all of these different blockchain names like Zosync, like Arbitum, etc., and someone says, "Oh, that's a layer 2, you kind of understand that then it is also connected to a layer 1 such as Ethereum. We are going to be going into all of this in so much more detail later." The other thing I wanted to touch on is the fact that we have what's called a mainet and then test nets. So, while we're learning, let's say we want to interact with the blockchain, we don't really want to be practicing with real money when we don't really know what we're doing yet. Same with developers when they're writing code for the blockchain. They're writing

smart contract code and then they're putting that on the blockchain which is called deploying by the way. They don't really want to be doing that where there's real money and have to pay money to do this and then risk their real money. They kind of want to test everything first in an environment that doesn't use real money. And this is what mainets and test nets are. So a mainet is where the real money lives. When you buy Bitcoin or Ethereum or any other token on an exchange, you're buying it on mainnet. These are real funds with real value. Every transaction you send costs real money. But then every mistake is also permanent. It's like playing poker for the first time but with real money. And then we have test nets and this is like your practice area. It's a

replica of the blockchain protocol. So how it works is exactly the same but it has its own transactions and the money isn't real. like the tokens, the Ethereum on the test net doesn't have any value. It's like playing poker with the poker chips that have no real cash value. You can practice sending transactions, using DAPs, decentralized applications, even building your own projects, all without having to risk your real money. And on a test net, you can get these tokens which don't have any real value via something called a faucet. It's literally a website that will give you these tokens for free. For instance, Ethereum's main test net at the moment of recording is called Sapoleia. And you can go to a faucet to get some test net, Sapoleia E. And that's what we'll actually be doing in

the next section of this course very shortly. We'll be getting some test net e and we'll be sending some transactions on Ethereum's main test net. The test net that we'll be using in this course is linked in the GitHub repo for this course. And in future courses, you should always look to the GitHub repo associated with that course to see what our recommended test net is. Additionally, we'll also be using Tenderly, which kind of allows you to create your own version of a test net without all of the problems associated with test nets. This will make more sense once we get to the next section. I also just wanted to point out the way that we keep track of all these different chains and make sure we know which one we're using at any one time.

And the way we do that is using chain IDs. So, all of these different blockchains, all of these different mainets, these different test nets, whether they're an L1 or an L2, they all have a different chain ID. And this helps all the applications know which blockchain they're running on, which blockchain you've sent your transaction to. And it's a unique number that is unique to the specific blockchain. For instance, for Ethereum mainet, the chain ID is one. For Seolia Testnet, the chain ID is 111 55511. The chain ID tells your wallet, which is what you use to send transactions. Don't worry, we're going to go into it later.

And applications exactly which blockchain you're interacting with. And you can actually head over to this website called chain list which will tell you what the chain IDs are for the different chains. Absolutely do not go and memorize all of these chain IDs, please. Most of the time applications and wallets will handle all of this for you, but I just wanted to give you some exposure to this very early on to make sure that we're repeating things. So, I know all of that felt like a lot of information because honestly, it is. But here's what I actually want you to take away from this lesson. There are many blockchains. There are L1's which are their own ecosystems and then there are L2s that are built on top of the L1's usually to make them faster and cheaper like an express highway to

process the transactions quicker off of the L1. In this course we'll be focusing on Ethereum and all of its layer 2s. We have mainets which are where real funds are being dealt with and then we have test nets which is where fake practice funds are being dealt with which don't have any real value. And most of the time throughout this course and other courses when we're interacting with the blockchain, we'll actually be using a test net and we use chain IDs to distinguish between these different chains and make sure that we're working on the correct one. We started with just one primary blockchain and that was Bitcoin. And now the ecosystem has grown into this massive world with many, many, many chains, which is really, really cool. And they all have their different positives and negatives. And we're going to be talking about all of this and what

layer ones are and what layer twos are in much more detail later in this course. as I said. So, please don't worry if this lesson confused you. So, in our next lesson, we're going to be talking a little bit more about these smart contracts and their major downside, which is that because they are on the blockchain, they cannot access any real world data. They are blind to anything else going on outside of the blockchain, which was one of the main benefits we said about blockchains because they can't discriminate. But it does have a major flaw in our agreements, and this is called the oracle problem. and it's something that chain link solves. So, we're going to be going into the oracle problem and chain link in the next lesson. [music] In our last couple lessons, we learn

about how blockchains create a source of truth without requiring any intermediaries. We also learn about the power of smart contracts, these decentralized, unbreakable agreements. Now we're going to have a little look into smart contracts more but before we do that I just want to touch on one main drawback of blockchains and also smart contracts and this is the oracle problem. So as a very brief recap of the last couple lessons we learned about blockchains and the fact that they are a shared ledger a shared record of all of the transactions distributed among multiple parties. These parties are known as nodes and they remove the control from being in the hands of one

single entity. This creates a system where no one can lie, no one can censor, everyone is able to see what's happening and nobody can be blocked from participating. We then learned about how Ethereum extended this idea of credibly neutral money to credibly neutral agreements via smart contracts. And these smart contracts exist on chain, so on the blockchain. and they execute deterministically based on their code, which means that they don't require an intermediary to enforce the rules. The code enforces the rules itself. So, of course, these digital agreements sound amazing, and we want to be able to use them in our day-to-day life. And to do that, we probably need to be able to have data from the outside world. The blockchain

can see all of the different balances. It can see what's called the state, which is just like the data in the smart contracts. It can see what's happening on the actual blockchain, but anything outside of the blockchain, it can't see. It doesn't have access to. It can't see anything in the real world. And blockchains cannot interact with real world data on their own. And this is the oracle problem. To really understand it, let me give you a simple example. Let's say you have a smart contract that pays out if it rains more than 2 in in your city. Your smart contract is onchain, so exists on the blockchain. So, how is it supposed to know if it actually rained or not? and if it did, how much. It can't check the weather by itself. It needs someone or something to tell it when it has rained and how much it has

rained. The other thing is that blockchains are deterministic. They are predictable in that the same inputs should always yield the same outputs. And this is exactly what makes them so trustworthy and secure. We can rely on the code. Real world data, however, is not deterministic. If different nodes query the real world data at different times, they will have different results. And since all the nodes need to agree on the current state, the current data on the blockchain, if they all go and individually fetch some real world data, how much has it rained in London right now? They will all get slightly different results at different times.

Therefore, it'll be very difficult for them all to come to an agreement. And so, it breaks the entire system. So, blockchains are inherently isolated. But if we're going to use them for real world agreements, they need external information. They need stock prices, weather information, sports scores, election results, or even just knowing if your package was delivered or not. So the problem is, how do we connect these deterministic blockchains with the real messy world? This is actually what oracles do. So an oracle is any service or device that delivers data to these decentralized blockchains. It connects blockchains to real world data. Let's go back to our weather insurance smart contract. It needs to know whether it has rained or not. So an oracle needs to

check a weather API. If you don't know what an API is, it's just something you can ask query to see what the data of something is. There's different APIs for different data. And for instance, there will be a rainfall API. So the oracle will query the API. It will ask it for the information and then it will send it back to the blockchain. But hang on a second. We're trying to create a decentralized system. We can't rely on a single oracle or data provider because what's to stop them changing the result? That would again create a centralized permission system, which is exactly what we're trying to get away from. What if the oracle lies? What if the oracle gets hacked? What if they just decide to go offline? So, just like we need a

decentralized network of nodes for the blockchain, we also need a decentralized oracle network, which by the way is referred to as a dawn, decentralized oracle network. Here we have multiple independent Oracle nodes providing the same data cross-checking them with each other and reaching an agreement known as consensus. They agree about what's true and then submit this agreed upon value onchain. And this creates something called hybrid smart contracts. Hybrid smart contracts are smart contracts which have a combination of onchain and off-chain data and logic. your onchain logic and data stays decentralized and on the blockchain, but you also need your off-chain data to be provided to your smart contract in a decentralized

way through a decentralized oracle network. And by combining the two, we get the best of both worlds, the decentralization and security of the blockchain, plus the data we need for real world agreements. And actually, most big web3 protocols are already using some kind of hybrid smart contract system. DeFi or decentralized finance platforms need price data. Insurance contracts need the real world data. Predictions markets need the outcome information and so much more. So throughout this course, whenever we say smart contract, we're actually often using it interchangeably with hybrid smart contract. But if you hear us specifically say hybrid smart contract, we're talking about a smart contract that also has an off-chain component.

And really the most useful kinds of smart contracts are going to be a hybrid smart contract because they need that connection to the real world data. And this is exactly what chain link does. Chain link is a modular decentralized oracle network that can bring external off-chain data onchain in a decentralized way. Chain link allows us to get the real world data. It allows us to perform automated onchain actions based upon some predefined rules such as a specific time interval. It allows us to generate onchain truly random numbers. It allows us to communicate back and forth between chains in their different isolated blockchain worlds and so much more. All of this in a decentralized way. Chain link solves the blockchain oracle problem. And the best

part about chain link is that is blockchain agnostic. So it'll work on Ethereum Avalanche ZKYNC Polygon any blockchain where the chain link services are enabled. So by learning how chain link works, you can transfer it to whatever chain you want to work on. The knowledge will work exactly the same. Chain link is the most powerful and most popular decentralized oracle network and it's the one that we focus on on cipher updraft in this course and other courses. In fact, we have a whole course dedicated to the fundamentals of chain link. What chain link offers and how it works from a non-technical highle perspective, but also digging into how it works from a code level if you want to become a developer. So, like I said in previous lessons, if that's something

you're interested in, it is one of the pathways that you can follow after this course if you would like to read that. It's actually a readonly course, so there's none of my face in that one. And if you're a developer and you're looking to learn about smart contract development, we use chain link throughout the Solidity smart contract developer track, which again, don't worry, I will guide you through when you get to that point. But regardless whether you are nontechnical or technical, we will be teaching you all about chain link, all about why it's super cool all the way throughout our different courses which we're going to talk about right at the end of this course. So don't worry about remembering that. So let's have a very quick look about how chain link can actually be used and how it is being used right now.

First of all, in DeFi or decentralized finance, these kinds of applications need price information and it needs to be provided in of course a decentralized and secure way which chain link can do through its price feeds. Next we have of course insurance. Chainlink can report on flight delays or weather information. So you can get your insurance without having to submit a claim. Another big use case of chain link is gaming. So many blockchain games rely on truly random numbers maybe for a random prize giveaway or a mystery box reveal.

Chainlink provides a service called chain link VRF or verifiable randomness function which ensures fair outcomes which are not predictable for things like card draws or mystery boxes like we were saying. Again, don't worry about why we need VRF and why we can't really have truly random numbers on the blockchain without chain link. If you're interested in this, I really do recommend the chain link fundamentals course, which again I will be recommending to you at the end of this course. But just know you can't really have randomness on chain without chain link. We also have predictions markets like we were talking about earlier. By using chain link and their data feeds, smart contracts are automatically able to settle bets on sports games or elections or anything else you want to

predict. So now I want to go into a little bit more about the purpose of smart contracts. I know we have talked about why they are really cool and what they are useful for and how they can access real world data through oracles. But let's just take a little step backwards and do the same as we did for blockchains. We talked about the benefits of blockchains and why they're super cool and we really hammered that home. But let's now do the same for smart contracts. Why are they so cool? What are they so useful for? Let's really get to feel the problem. What's the real value proposition that smart contracts have? Think about your traditional agreements today. Whether it's a loan, whether it's an insurance policy, whether it's a simple bet with a friend, these all rely on trust. I know I keep saying this, but it's so

important to understand. They all require intermediaries like banks, like lawyers, or courts even. Particularly if you're playing poker with Patrick, by the way. True story, not true story. What if we could create agreements that could execute deterministically based on their logic without having to rely on trust and without having to rely on those intermediaries? And of course, the easiest way to sum up what they do is trust minimized agreements. But this all feels a little bit theoretical and a little bit confusing. So, I'm going to use an analogy that Patrick likes to use, and that is the good old pinky promise. And you still might be a little bit confused about what they are and how they actually work and why they're really cool. And if you are, then don't worry, because in the next lesson,

Patrick is going to take a deep dive into the undeniable value of smart contracts and the good old Pinky Promise. This is a good one. It's probably one of my favorite videos out there. So, enjoy. Cryptocurrencies fundamentally rellandscape markets and agreements as we know them. Unfortunately, you've probably only been bombarded with people screaming about NFTts and money. Now, some of the memes are fun, but let's forget the and get down to the essence of this space. [music] If you're already in web 3, this is the video to send to your friends to explain why you're so excited about this space and explain why we're here. And then, if you're not into crypto, you've come to the right place. And yes, there are fun memes and markets and there's some money stuff and there are all these things.

But outside of all that, the purpose of blockchains relates to the age old elementary school unbreakable promise, the pinky swear. Let's get froggy. Nearly everything you do in life is the result of an agreement or a contract. Your chair was the result of an agreement to buy and sell lumber, to assemble and sell the chair to a retailer on Amazon. Then you made an agreement to buy the chair for $40. The lights in your house are powered by electricity, which is an agreement from you and the electric company. You agree to pay them. In return, they'll keep the lights on. The electricity that they generate is agreements between them and engineers who built turbines to generate the electricity. With insurance, you agree to pay some amount of money to them every month and in return, they will do nothing or I mean they'll cover

your medical bills. Almost everything you do and everything you interact with is the result of some form of agreement or contract in some aspect. Now, agreements and contracts can feel kind of abstract and boring to really grasp on to. So, to simplify, we can also refer to them as promises. When you get an oil change, they're promising that they will faithfully change your oil in exchange for money. When you put money in the bank, they promise to keep it safe in exchange for them to use your money to give out loans. When you buy a lottery ticket, the lottery promises to give you a fair chance at winning a ton of money in exchange for you buying the ticket. Whenever you make one of these agreements, in a way, you're asking them to pinky swear to not screw you over and to treat you fairly. But this doesn't

always happen. Let's look at a realworld example of someone breaking the pinky swear. Back in the 80s and 90s, McDonald's ran a promotion for people to win money by collecting McDonald's Monopoly game cards. The idea was simple. You buy McDonald's and in return, you get a chance to win $1 million. You can imagine McDonald's literally going, "Hey everybody, I promise if you buy our McFood and McNuggets, we'll give you a fair chance of winning this money." But they ended up breaking this promise. >> Instead of having a fair chance of winning, your chance was in fact zero. In the mid '90s, between 13 and $24 million went into the pockets of not people playing the game honestly, but a group of corrupt insiders who had rigged the game. Meaning that when you played

the McDonald's Monopoly game, you are buying into a set of lies and promises that were 100% always going to be broken. And the thing is, it doesn't really matter if this was McDonald's fault or not. They were the ones making the promises that they ultimately could not keep. Another way you could think about it is that that's $24 million that they essentially stole from you and I. Now, if this system was deployed on a blockchain with something called a smart contract, it would have been impossible to defraud this $24 million due to smart contracts being immutable, decentralized, and transparent. But I'll get back to that in a minute. In all the agreements and contracts we make, imagine making a pinky swear with a

10-year-old and imagining how that agreement would hold up. Hey buddy, could you could you please keep my money safe? You can play with it if you like, but just just please have it when I come back. Immediately, you might get that worrying feeling in your chest. Something might go wrong. This 10-year-old might lose your money. You might be thinking, >> "How could I trust them? Will they break their promise?" >> And this feeling of I can't breathe because of untrustworthy situations. Happens to us all the time. Can I trust this used car salesperson to give me a good car? Can I trust this tag that says machine washable or will it make my shirt shrink? Will my insurance provider break their promise of covering my medical bills when I get hit by a bus?

>> When Patrick promises he'll go on a hike with me, will he actually? >> Yes, I I I actually will. The issue with our current agreements and contracts is we have to trust the people who are making them to do the right thing. However, often they're actually incentivized to not do the right thing. Insurance doesn't want to pay out money. Sometimes salespeople just want to get the off their shelves. And with my girlfriend, I promise to go on a hike, but I hate hikes. Where else has this happened? Now, you might be thinking, "Okay, Patrick, this seems cool, but like where has this actually affected me?" Well, the McDonald's lottery that we just spoke about above during the Great Depression with the run of the banks, banks promised to keep our money safe and that when we went back to go get it, they would actually have the

money there. And well and behold, there were times that they didn't have the money there. Just last year, Robin Hood painted this amazing picture. Come use our application. We will give you access to the markets. We promise we will give you a retail investor a fair chance of interacting with the world of finance. [clears throat and snorts] Psyche. But not this asset, this asset, this asset, or this asset. The 2008 financial crisis. Remember that? Shady deals behind closed doors combined with lies about financial product brought the world to its economic knees.

>> How are youing us? >> Hyperinflation in Zimbabwe. Hyperinflation in Brazil. Theronos. History is a relentless lesson of trustworthy entities being notorious promise breakers and we finally have a way to fix it with smart contracts. Now before I jump into smart contracts, a lot of people might be thinking, "Hey, cool and all. However, we have systems in place to protect against a lot of these things, which is true and which is great and that is a very helpful step forward. But these systems often break. Ones in 2008 definitely didn't work. The ones with the Robin Hood crisis definitely didn't work. And even if these systems apply and you go to court to try to work them out, maybe you're in court for years before you actually see a resolution. And by that time, what you

needed the money for is long gone. So what is this technology? What is this tool that can fix this fundamental problem in our agreements today? This tool is smart contracts. And this tool is what the blockchain was built for. Now, I'm going to give you a quick overview of what a smart contract is. However, I'm leaving some links in the description for more in-depth explanations, but the basics of them is a smart contract is an agreement, a contract, or a set of instructions deployed on a decentralized blockchain. And once the contract or set of instructions is deployed, it cannot be altered. It automatically executes and everyone can see the terms of the agreement. The real basics of it is that the code is executed by a decentralized collective like a group of people, but a

group of people running a certain software. This means that no one person or entity can actually alter any of these agreements or change the terms of the arrangement. In these traditional agreements, whoever owns the contract, whoever owns the execution of the contract can flip a switch and say, "We're not going to do that anymore." In smart contracts, in web 3, in blockchain, you no longer can do that. Typically, these smart contracts are on a decentralized blockchain and used in combination with a decentralized oracle network to get the real world assets and information. And if these words sound like I'm conjuring up a magic spell, well, again, check the links in the description if you want to learn more about the technical implications. If you're not a technical person and you're not interested in getting to the nitty-gritty, you can kind of think of it like HTTPS. I bet the vast majority

of you don't even know what HTTPS stands for, and [clears throat] yet you use it every single day whenever you log onto the internet. So, how does this fix the McDonald's monopoly issue? In its traditional form, the lottery was executed behind closed doors. somebody operated and owned the code and the contracts and the agreements that ran the lottery and they had the power to alter it and nobody other than the people internal on the lottery could audit this altering happening. Now, if the code for this lottery was deployed onto a blockchain, every time a hacker attempted to alter it, everyone would be notified. Not only that, but you couldn't even alter it because the terms of a smart contract cannot be altered once deployed. Combine that smart contract with a chain link VRF oracle to get a verifiably random number and

presto, you now have a perfectly decentralized, unalterable agreement that is impossible to hack, commit fraud, or manipulate. We have just saved the public between 13 million and $24 million just by fixing the issue of trust. How does this fix Robin Hood? Well, the problem with Robin Hood is already fixed, right? Again, the problem is that there's a centralized body that can flip a switch at any time and say, "Yeah, you can't access these markets anymore. We're breaking our promise of actually giving you access to the markets." This is already fixed with something called decentralized exchanges, and these exist today. One of these exchanges is one called Uniswap.

You can swap ERC20 tokens, which are kind of the equivalent of stocks, but some aren't, some aren't. It's a little confusing. I won't get into that here either. But it doesn't have that centralized body that can flip a switch and ruin access to the markets. And had these investors been on a decentralized exchange, it would have saved them hundreds of millions of dollars. And it would have prevented fraudulent market manipulation. How does it fix run of the banks? With transparency built in and automated solveny checks, you can build a bank-like smart contract that has insolveny checks built in that make it impossible to get there. Insolvent means broke as any agreement or any history lesson where there was a trust assumption that was broken. Smart contracts can be applied to and should

be applied to, especially in a time where big money runs, owns, and controls everything. We desperately need to move to a world where some self-interested centralized entity can't flip a switch and ruin people's access to the services that they need. We can move away from a world that is brandbased to a world that is math-based. Right now, if you interact with a service that you don't like or that they break their promise, the only thing you can do is walk down the street to the next service that's going to make the same set of promises and you have to hope and pray that they're actually going to keep it. We can move from that to a world where we can just look at the math and say, "Oh, okay. 1 plus 1 equals 2. This is what this agreement is going to do for me

every single time, guaranteed." because it's a decentralized autonomous agent, has no incentive to be evil, and everything is transparent and out in the open. I'm a big company and if it was better for me for OnePlus 1 to equal three, maybe I would go behind some closed doors and fudge some numbers and come back out and be like, "Hey, 1 plus 1 equals 3." But with smart contracts, that's impossible. Doing the right thing is infrastructural. Now, given the choice between two agreements, one where you have to trust a single centralized entity that they're going to do the right thing for you versus a decentralized untamperable collective, which one are you going to choose? I'm picking the one that can't screw me over every single time for every agreement I

can apply it to. Now, this technology is relatively new, but we have already seen it rellandscape entire markets and continue to do so. The traditional financial world is already getting its lunch eaten by DeFi or decentralized finance. There's already over $200 billion dollars of people's money in these protocols to help have a more fair, more accountable, more transparent financial system. This D5 movement is one of the main reasons I got into this space because we desperately need to move away from where we are right now and end people's chances for wealth being sucked up by some group that's bending the rules in their favor. And smart contracts are our ticket to that better world. More and more industries are also coming over to smart contracts and blockchain because of all the

innovations and because of all the advantages that it has. As we grow and as we get better, we get closer to this vision of having this concept fulfilled. Trust minimized agreements. These smart contracts are minimizing the trust that we need to give other people in order for these agreements to be executed. If trust minimized agreements is too confusing for you, just say unbreakable promises. Now, I got to be honest with you guys. Blockchains and smart contracts and cryptocurrencies can actually do more than just trust minimize agreements. >> What they have security benefits, uptime benefits, execution speed benefits, and a whole lot more. But it's a lot easier to just learn about one and learn the other ones later, right? It's kind of like sprinkles on top. So, this is why we are here. This is why we're building this future, and this is why we are so

excited about it. Now, back in 2022, there were a lot of issues with a couple different companies, like, for example, SPF's FTX platform. The thing to me that's most frustrating about that situation is that FTX platform wasn't anything that I just talked about. It wasn't decentralized. It wasn't trustless. It wasn't transparent. It was purely a traditional web 2 company pretending to be web 3 and just using the cryptocurrency part of web 3, but not actually using the smart contracts. And we're doing a much better job as a community getting rid of the bad actors. And this is something that's incredibly important for you when working with protocols and when building protocols. I want you to be incredibly successful here. But I want you to be incredibly successful because you're

making a ton of value. A lot of these platforms that we saw collapsing last year were not creating value. They were stealing value. They were siphoning value. They were faking having value. And as you learn and as you build smart contracts yourself, it'll start to become innately aware of what protocols and what companies are centralized and are not the ethos of web 3 and the ones that are. We are building verifiable trust minimized agreements, unbreakable promises. And if you can't verify those promises, then it's not trust minimized.

It's not web 3. It's not what this industry is for. That's what I want you to do as you finish this course is be a force for good. Unfortunately, because a lot of people haven't taken my course, not everybody understands the difference between a legitimate project and a token that's just meant to pump somebody's bags. As this space continues to grow and as people like yourself take courses like this, we will get to continue to push real legitimate projects forward and wash out the products that aren't actually contributing to web 3. So, we've learned about blockchains and smart contracts, but there's one more foundational piece that you need to understand, and that is the Ethereum virtual machine or EVM. Think of this as like the engine that makes smart

contracts actually work. I found the EVM a little bit confusing when I started. So, if you find this lesson confusing, don't worry. I just want to give you familiarity with the term EVM so you understand a little bit about what it means. But do not get hung up on this lesson. It is a little bit more technical. I just want to make sure you have some exposure to this terminology. So hopefully by the end of this lesson you'll understand a little bit about what the EVM is and you'll know the difference between if a chain is EVM compatible versus EVM equivalent. Just wanted to note quickly that through this course I'm going to say this a couple of times but we are focusing on Ethereum unless we state otherwise. So EVM compatibility, the EVM in general, EVM equivalence doesn't apply to anything outside of the Ethereum ecosystem. So

Ethereum itself plus all of its rollups or L2s. I know we've only briefly touched on what those terms mean. Don't worry, we're going to come back to it. So, what is the EVM? The EVM stands for the Ethereum virtual machine. Think of it a bit like the operating system for smart contracts. Just like Windows or Mac knows how to run different programs, the EVM is a bit like the computer inside of Ethereum that knows how to run smart contract code. It's really just a standard that defines how the smart contracts should execute. Now, this is a little bit technical, but I just wanted to say this quickly. So you have all of the nodes in Ethereum in the network of participants and to perform their tasks they just really run some code and this code is called the client code. An

example includes something called GE and this client software is an EVM implementation. So all the EVM is really doing is ensuring all of these nodes execute the smart contracts in exactly the same way producing identical results. So given the same terms in smart contracts they will produce the same result. Now, that will sound a little bit technical, so you can think of it a bit like this. Smart contracts are like the recipe. They've got the step-by-step instructions, and the EVM is like a robotic chef that follows this recipe exactly. It determines given a specific instruction what the action that needs to happen is. Every time someone interacts with the smart contract, the EVM follows the instructions step by step, getting the same result every time. Why do we need

the EVM? This is because blockchains are decentralized. Thousands of computers run the client software. When you use a smart contract, all the computers need to execute the code and get the same result. And the EVM is what makes this possible. It's like a computation engine that processes smart contracts on the Ethereum network. Let's very quickly go into the difference between an EVM compatible chain and an EVM equivalent chain. EVM equivalence is when the chain works identically to Ethereum in every single way. Examples include chains like Optimism and Arbitum. Smart contracts work exactly the same on these chains and don't require any special tooling or modifications. EVM compatibility is a bit like EVM equivalents except there are some differences between how the chain works and Ethereum. They can run

the same smart contracts with the same code, but sometimes they work a little differently under the hood and may require some small changes or might require different tooling. Examples include Polygon ZKevm and ZK Sync Era. If you're a developer, you should always be checking the developer documentation for the chain that you are working on. And this is to see if there are any differences between that chain and Ethereum to make sure that you know of any potential pitfalls. And this is crucial for security. And that was a whistle swap tour into the EVM, EVM compatibility, and EVM equivalents. Don't worry, we are going to be going into this again. I just wanted to give you the heads up from the start because we are going to be using this term EVM a couple of times.

[music] Okie dokie. We are on to the final lesson of this section before we can go and get practical which is super exciting before we can actually start interacting with the blockchain getting some test net funds sending our first transactions which is going to be so much more exciting than all of this theory. So we now hopefully understand a little bit from a high level what blockchains are and what smart contracts are. Let's have a little deeper look into the benefits of smart contracts. The first benefit of course is that they are decentralized. There is no single point of control. The same as blockchains. Blockchains are thousands of computers, thousands of nodes, all running the same software validating the same transactions. So there is no single entity that controls the system. And

smart contracts are just code that exist on the blockchain. So they inherit this decentralization. So in the traditional world, if a bank decides to freeze your assets, if the bank goes down, you're stuck. But with smart contracts, even if hundreds of nodes go down, if they go offline, your smart contracts will keep running as long as one node stays online and keeps the blockchain alive. The second benefit that smart contracts inherit from blockchains is that they are transparent and they are also verifiable. Every action on the blockchain is visible to everyone and you can actually see exactly what a smart contract is going to do before you interact with it. There's no hidden fees. There's no fine print. No, the terms may change without notice. It's

like being able to read the exact rules of the game before you play. And everybody has to play by the same rules. No one can change the rules Midame and everyone knows the rules. In the traditional world, the terms of agreements can change and are also subject to interpretation. Let's say you have house insurance and you're forecast to have wildfires near your house. Insurance companies could just amend their terms of service despite you having paid for this insurance for years. and they suddenly say they don't cover wildfires anymore and this avoids them having to pay out. Whereas with smart contracts that are now connected to the real world via chain link, the insurance money will be paid out according to the rules in the agreement

that you signed. As soon as the wildfire is recorded on chain via the decentralized oracle network, you will receive your payout. And if companies don't want to pay for natural disasters, you'll know that before you sign the agreement. The only thing I want to note here is that this doesn't mean that you lose your privacy by everything being transparent and visible on chain. And that's because blockchains are actually pseudo anonymous. And this means that your onchain actions aren't actually connected necessarily to a real world identity because of course blockchains that have issues with connecting to real world data. And additionally, technologies like zero knowledge proofs can add privacy where required. This is pretty out of scope for this course. We have a separate course on zero knowledge proofs. The next benefit is speed and efficiency. The stakes of this benefit

are a little less than the others, but nonetheless, it's still important. Smart contracts can make these agreements more efficient. Sometimes international bank transfers can take days, weeks, whereas smart contracts can execute them any time of the day, any day of the week, anytime you like, 24/7. There's no bank holidays, there's no business hours, there's no your transaction will be processed in 3 to 5 days. If the conditions are met, your smart contract will execute. The next benefit is that they are immutable. And immutable means that they cannot be changed, which we've already talked about a bit. Once the smart contract has been taken, the code's been taken and it's been put on chain, which is called deploying. Once we've deployed the smart contract on chain, the code is there forever. We can't change it. No can sneak in and

alter the terms of the agreement. There's one teeny caveat to that, and that is upgradable smart contracts. And this is where the original smart contract can redirect calls to a new smart contract. It's like a permanent sign that points to a different location. Like, hey, look over here to see the new terms. But even then, the original smart contract wasn't actually changed. And all these updates are visible on chain. It's all still transparent. And you'd have known originally that this original smart contract was able to be upgraded. And users can see who controls this upgrade and whether they want to participate in the system. And this transparency ensures there's no secrecy. No one can secretly change the rules after you've agreed to them. The rules still can't change. It's just the rules were

initially with a caveat. Oh, by the way, I can change the rules. So, that was baked into the initial agreement anyway. So, back on amusability. History cannot be altered. To hack a traditional system and rewrite history, change all of the data, you'd only need to hack into one server. To hack and break a blockchain, you need to take control of more than half of the computers in the system to be able to come to an agreement on this agreed upon change. The majority of the participants in the system agree to your change. And this is actually, by the way, called a 51% attack and has never successfully been done on Bitcoin or Ethereum. They are resistant to this.

So, we can consider these attacks virtually impossible. You cannot change history. going to go into these blockchain vulnerabilities and how they actually work and how they're avoided later in the course. So, in traditional agreements, the terms of service can change last minute. The insurance company can decide not to cover wildfires after you've paid for your insurance for years. With smart contracts, this is impossible. The terms are immutable and so you are paid in line with the terms of the agreement which are written in code, not what the company decides last minute they want to pay. The final benefit is that they are of course trust minimized. In a traditional agreement, you are trusting each party that they will abide by the terms of the agreement. You're trusting

that they'll do what they pinky promised. Will the insurance company actually pay out? Will the bank honor your withdrawal? Will your employer pay your salary? They pinky promise they will. Smart contracts replace this trust with code. You don't have to trust anyone because the smart contract will execute deterministically exactly as programmed. No human can interfere, get greedy, or change their mind. And that is why we call them trust minimized agreements or unbreakable promises. We're moving from a world in which you have to trust companies based on their reputation to a world where you can verify the math and code yourself. It's a math-based world rather than a brand-based world. don't need to sit on the edge of your seat worrying if they're going to do the right thing.

With smart contracts, there's no right thing. There's only the agreed upon terms. There is only the code. Let us imagine that I owe Kira $5. If we're both in the same room, it's pretty simple. I open up my wallet, take out $5, and I hand it to her. That's a direct wallet towallet transfer. But now imagine that I want to give Kira $5, but we're on opposite sides of the world.

It's a little bit more difficult. Traditionally, I'd have to involve my bank where there are often fees, delays, and third parties involved. With blockchains like Bitcoin and Ethereum, I'm able to send digital funds to Kira, even if she is thousands of miles away. And almost as easily and directly as if we were in the same room and I was handing her that physical cash. Again, this would be through a wallet to wallet transfer, but this time on the blockchain. You can think of a blockchain wallet as a secure digital wallet that manages your digital assets and is your access point to the blockchain. It's an application that allows you to review your balances,

review past transactions, and most importantly, send and receive digital tokens. So, what currencies can we send with a digital wallet? There are actually thousands of tokens that exist, but most blockchains have what is called a native currency. Now, do not worry if you don't understand this yet, but you can think of a native currency like a country's national currency. So, in the UK, we have the great British pound. In America, we have the US dollar, and in Australia, we have the Australian dollar. And it's the same for blockchains. Blockchains have a native currency, which is their built-in currency. For the Bitcoin blockchain, it's Bitcoin. And for the Ethereum

blockchain, it's Ether. So, for the purpose of this course, we'll be focusing on Ether on the Ethereum blockchain. Back to our example, let's agree with Kira to pay her back in digital tokens as opposed to dollars. When a wallet is set up, it generates a unique wallet address. You can think of your wallet address as your digital mailbox. In the real world, when somebody wants to send you a gift, they send it to your mailbox. In the blockchain world, if somebody wants to send you tokens like Ether, they send them to your wallet address. So, this is the information that I'll need from Kira in order to send her those digital tokens. So, to make my transaction, I

can open up my blockchain wallet and initiate a transaction to send tokens to Kira's wallet address. A blockchain wallet will provide the secure means to approve and send digital funds on the blockchain, handling all of the technical bits behind the scenes. So to recap, a blockchain wallet allows us to review our balances, review past transactions, and send and receive digital tokens. When we create a blockchain wallet, we generate a unique wallet address, and this is our identifier on the blockchain. It's our digital mailbox. It's the information that we share with others to send and receive digital tokens.

So, we know that we can make peer-to-peer transactions on a blockchain. And we know that wallets are our tool that allow us to interact with the blockchain. They allow us to make those transactions. But what does that actually look like? How do you actually go about creating a wallet and creating a transaction? Well, that's what we're going to be doing in this lesson. Let's get started. For this tutorial, we'll be setting up a MetaMask wallet. Now, MetaMask has a really nice user interface. It is incredibly popular. And it's a personal favorite.

It's an application just like those you find on your phone that allows you to review your balances, review past transactions, and send and receive digital tokens. The first thing we need to do is go to metamask.io. As always, when it comes to links, always double check them to make sure that they are absolutely correct. Next, we need to go to get MetaMask and then we want to click add to Chrome. So, this is us adding the extension to our browser. And by clicking add extension, we're accepting all of these permission requests.

Now, if we just give it a second, the MetaMask homepage should automatically open. And here we can get started with setting up our very own wallet. So what we need to do is press get started and then we need to scroll to the bottom of the terms of use before clicking I agree and then agree. And then we are ready to set up our wallet. So we need to click create a new wallet. And then we have three different options. We can continue with Google, continue with Apple, or use a secret recovery phrase. Now, think about it. Just like a normal online banking application, we want to make sure that we've got access to it at all

times to make transactions. And we want to make sure that nobody else can gain access to it. So, they can't make transactions using our funds. So, we want to make sure that we're using the most secure account setup possible. For this tutorial, we'll be setting up our MetaMask wallet using a secret recovery phrase. Throughout the entire Ciphen Updraft curriculum, you will hear us banging on about being secure and being safe within the web 3 industry, and this is super important. We take risks with everything we do, and sometimes we're happier to take on more risks than other times. But when it comes to web 3 and our wallets, we are holding real funds

in these wallets eventually. So, we want to be as secure as possible and take on as little risk as possible. With a secret recovery phrase, our wallets are separated from our Google and Apple accounts. And those accounts are susceptible to hackers impersonating us to try and gain access to our wallets. Now, in my opinion, MetaMask have done a brilliant job with keeping those accounts secure when being set up with a Google or an Apple account, but as I said, we want to minimize risk as much as possible. And being a security firm, we like to go the extra mile. So, we will be using a secret recovery phrase.

By using a secret recovery phrase, we have full control over our accounts. On the topic of security, this wallet that we're creating in this tutorial should only be used for education purposes. To stay safe, never put real funds in this wallet. Since you're at the beginning of your education journey, we should just be using this wallet to learn and experiment and to use throughout the updraft curriculum until you're feeling more confident with your OPSAC and your web 3 security skills. At the end of this lesson, I'll be showing you how to set up a new browser profile and how to create a wallet in there that's just slightly more isolated and slightly more secure and that can be used to hold real

funds in the future. Back to MetaMask, I'm going to click use secret recovery phrase and then I'm being asked to create a password. Now, obviously since our wallets hold digital funds, it's important that this password is secure. So follow all of the typical strategies. Make sure you're using capital letters, lowercase letters, special characters, and numbers. But most importantly, never reuse a password used elsewhere for a real wallet. Now, since this wallet will only be used for learning, as we've just discussed, then you can just use something you'll remember, but just be 100% sure to use a strong password when you create a real separate account for funds. So, I'm going to type in my

password and then type it in again. And then we need to tick this box to confirm that if we forget the password, MetaMask cannot reset it for us. Then we click create password and we're on to step two. I want to preface this by saying that the MetaMask signup flow does change slightly from time to time. So, don't worry if this looks a little different, but step two is setting up our secret recovery phrase. So, let's click get started. A secret recovery phrase is a series of 12 words that we must keep safe. This is like the master key into our wallet. If we lose access

to our secret recovery phrase, we lose access to our wallet and there is nobody that can help us recover it. Unlike in the traditional world where if you lose access to your bank account, you can ring up customer services and regain access through your bank. In the blockchain world, that's not an option. We have complete self-custody. And don't worry if you've not heard that term before, but it means we are completely in control. We have to keep our secret recovery phrase safe. And if we lose access to it, we lose access to our account for good. So, it's important to keep it safe. But on the flip side of this, if somebody else gets access to our secret recovery phrase, they can

access our account and they can send transactions using our funds. This is really, really important. If anybody online asks you for your secret recovery phrase, they are trying to scam you. You may even receive emails from accounts that look like they're from a legitimate company within Web 3 asking you for your secret recovery phrase. I promise you this will be a fishing scam. Please be careful. Please be vigilant. Do not share this with anybody under any circumstance. It's super important in order to keep your digital assets safe.

And this is actually another reason as to why I'm saying let's use the wallet that we're setting up now for education purposes and then create another one later that holds real funds. Because while we have this dummy wallet, this practice wallet, we'll get used to guarding the secret recovery phrase and storing it somewhere safe while knowing that we have no real funds at risk. So now you may be wondering, well, how do we keep these 12 words? Let's start with what not. When storing any information on a device that's connected to the internet or on an application that's backed up to the cloud, we are at risk of hackers gaining access to that

information. Unfortunately, now with different things in life, we're happy to take on different risks for our blockchain wallet and our digital funds that's holding real value. We do not want to take on any risk. So, what we should definitely not do is screenshot our secret recovery phrase, take a photo of it, copy it into our notes, or do anything that is essentially storing it online because then we are susceptible to hackers gaining access to this account. Now, it's often deemed safer to store a physical copy of our secret recovery phrase. So, some people write them down on paper, store them in a

safety deposit box, and some people even engrave it onto a metal plate. But at the end of the day, however you'd like to store this information, you need to ensure that you have access to it and that nobody else does. I think I've scared you enough now. Let's carry on with the tutorial. So, the next step here is to tap reveal the secret recovery phrase. I'm going to completely contradict everything I just said and this is because this is a tutorial and I'm only revealing this for the purpose of this video. Preface this as well.

This wallet will not be used to hold real funds, but I'm going to reveal my secret recovery phrase so that you can see how I'm recording them and keeping them safe. So, I'm going to hit tap to reveal and then I'm going to write these 12 words down on a piece of paper. Now, at this stage, if you have not yet written down your 12 words, pause the video now to do so. Right, time's up. Hopefully, you've paused the video and written down your 12 words. Next, we're going to press continue, and then it's going to give us a little test to make sure we've written down the 12 words. So, mine is asking me for my fourth, my sixth, and my 11th word. And as you can see, it's giving me three of my words at the bottom. So, I

just need to put them in in the right order. So, mine goes thought water then monkey. So, I'll press continue. It'll tell me that I did that right. I'll press got it. And then we can definitely help out Metam Mask. So, we can takeick this and then press I agree. And we're all done. Your wallet is ready. So, I'm just clicking done through all of the tabs here. You can see that we are officially all set up. Again, this interface may change from time to time, but if we click through these, we should all reach the same spot, the MetaMask wallet. So, congratulations. You've officially set up your very own blockchain wallet. Before we move on, I want to quickly highlight that MetaMask

is just one type of software wallet, and there are multiple other options, and there are hardware wallets as well, which are often deemed to be a more secure option. MetaMask is great for us at the moment though because it's super easy to interact with and is what we'll use in other courses if you do decide to take those development courses on Updraft. If you're not 100% confident with all of the concepts that we've covered within this lesson, do not worry. We will be going over them again in future lessons. But in this lesson, we really just wanted to get the wallet set up so that we can start interacting with the blockchain. So, as I say, do not worry and congratulations on making it this far.

So congratulations, we have our wallet set up. Now the next thing we need to do is make sure that we have easy access to MetaMask at all times. To do this in Chrome, we just hit the jigsaw icon at the top right. And then we hit this pin button here. And this means that the MetaMask icon is available at the top at all times. So if we go to Google, you can see that the MetaMask logo is still here. And when we click on this, the MetaMask wallet will pop up. If we select the hamburger icon in the top right, you can see that we have an option to expand view. And then we come to the full screen view that we were on earlier. So congratulations, you've set up your first blockchain wallet.

Throughout this course, as Kira has mentioned, we're looking at the Ethereum ecosystem. But what's great about MetaMask is that you've actually just set up a wallet that can record our balances and make transactions on all EVM chains. So we can interact with multiple networks like Ethereum, Arbitum, Optimism, Base and many other networks using this one wallet. Actually, MetaMask are actively expanding the number of layer ones that they support as well and have added Salana. So if we click on this Ethereum mainet dropdown, you can see that currently by default we have the Athereum mainet, we have linear and we have base mainet. Now these may change

over time, but again don't worry about that too much. You can also see a list of chains that are here by default. If we want to interact with a chain that isn't on this list but is supported by MetaMask, we can click custom and add some information including the chain ID which Kra discussed with you earlier. But what if we want to interact with test net? Well, we need to enable that within our settings. So to do so, we need to get the drop-own menu at the top right and then click on networks and then scroll to the bottom before enabling the toggle to show test networks.

If we continue to scroll now, you'll see that some test nets have appeared. For me, there linear Solia and a couple of others, but again, this could change in the future. If you want to use a test net that is supported but isn't here by default, we can configure those again by using the chain ID. So, coming out of here then, you can see that when we click back on the Ethereum mainet dropdown, we can click on custom and all of our test nets are here. So, if we want to be using Sapoleia, which is Ethereum's most popular test net at the time of filming, but again, this can change, then we can just click Solia here, and then we're looking at our balances on the Sapoleia chain. If we want to go back to the mainet, we can

click on Sapoleia, and then go back to popular and click on the Ethereum mainet. Now, I'd like us to think back to the previous lesson quickly and remember the wallet addresses that we discussed. When a wallet is set up, it generates a unique wallet address. You can think of your wallet address as your digital mailbox. In the real world, when somebody wants to send you a gift, they send it to your mailbox. In the blockchain world, if somebody wants to send you tokens like Ether, they send them to your wallet address. So, in our MetaMask account, you can see that the wallet address is at the top, and we can just click that whenever we want to copy it. Now, before we move on, I want to

quickly show you what a block explorer is because we'll be using these to track transactions throughout the rest of this section and throughout the rest of Cipher and Updraft. So, I'm just going to a new tab and typing in etherscan.io. Popular Ethereum block explorers, including Etherscan and Block Scout, allow you to track transactions for a specific wallet. So, in Etherscan, we can paste our wallet address or anybody else's wallet address for that matter and see all of the balances and past transactions associated to that wallet.

Of course, we haven't used this wallet yet. So, you can see that our balances are zero and we have no transactions, but we'll come back to this later. Back in MetaMask, we can actually create multiple accounts within our wallet. So to create additional accounts, we click on account one in the top left and we click add account. We click Ethereum account. And then we can name this whatever we like. I'll call mine account 2. So I'll just press add account. And then we have another account. Account 2 is set up. Clicking on the drop-own menu.

You can see that we can easily swap between the two accounts whenever we like. It's important to note that if we have multiple accounts in our wallet, the wallet addresses are different, but the secret recovery phrase is the same for all of them. So that secret recovery phrase, those 12 words that we wrote down are the master key. If you lose access to that, you lose access to all of your accounts. So that's it. You now have your very own blockchain wallet. Now, let's say that you are scrolling on the internet. You want to make a transaction and you want to get access to your MetaMask account. As we showed you earlier, we can press the MetaMask icon in the top right. And sometimes it will ask for your password if it's not

been recently opened. So, you can just type in your password, press unlock, and then we are back to where we started. Now, for best security practices, I would recommend that you keep the wallet we've just set up purely for educational purposes and don't hold any real funds in this wallet. Only once you're confident with your development skills and your security practices in your opsac should you involve real funds. So, what I would recommend you do is that you use this wallet purely for development purposes and then once you're ready to interact with real funds, create a new profile on your browser. Now again this will vary depending on the browser you are on but for Chrome all we need to do is click

the profile icon in the top right. Click on add Chrome profile. Continue without an account and then name this whatever you'd like. I'm going to call mine holds funds. And then once I click done I will only use this Chrome profile to access my MetaMask wallet. And this adds a layer of separation and improves your security. So I'll go to MetaMask io, set up another wallet, and then that will be my wallet that holds real funds. So I've got one for the cipher updraft curriculum and one for my real funds. And that's everything you need to know about setting up a wallet.

In the next video, we'll be interacting with a virtual test net. Good luck. I know Kira covered test nets in a previous lesson, but I just want to quickly recap so that we're all 100% confident with what we're doing next. A test net is a blockchain that allows us to simulate transactions and deploy smart contracts without using any real funds. It's like a sandboxed environment. And there are actually two different types of test nets that we'll be using within this course. There are public test nets like Sapoleia, which we've just connected our MetaMask wallet to, and then there are virtual test nets provided by service providers like Tenderly. In this lesson, we'll be using

Tenderly's virtual test nets. Now, both types of test nets are very similar when it comes to simulating transactions. They're both brilliant when we're doing educational videos like this one. They allow us to simulate transactions and practice deploying smart contracts without risking any real funds. When we're looking at public test nets, they actually require real volunteers to run nodes to keep the blockchain up to date because after all, it is a blockchain. But when we're looking at virtual test nets, we don't need those volunteers. We have service providers like Tenderly who do it all for us. So they are slightly different in that way. And this brings

both pros and cons for both. But with Tenderly, we can quickly set up our very own blockchain and make our first transaction. So, we're going to start here. The first step is to go to the GitHub repo associated with this course and scroll down. And as soon as you see the test net for you, you are in the right place. You can see that Tenderly's virtual signup link is already here. If you click on this, you'll be taken to the Tenderly dashboard. So, when signing up to Tenderly, please use the link in our GitHub repo because this signals to Tenderly that you've come from Cipher and helps us continue to make content on the platform. Tenderly significantly

simplifies the process of demonstrating what it feels like to send a real transaction and you are encouraged to use it throughout the rest of your education on Cypron Draft. Once here, we need to click build for free and then we'll be taken to the sign up page. Now, once we're all logged in, we should be taken to the Tenderly dashboard. In the menu on the left, we want to click virtual test nets, and we want to create our own virtual test net. For the parent network, we can use the mainet, the Ethereum mainet, and we can name this whatever we like. I'll name mine Jess chain.

Now I know Cara has discussed chain IDs with you but just to recap every chain has its own unique ID. The Athereum mainet's ID is the number one. Taking a look at Tenderly's docs, you can see that we can fork any mainet by adding the prefix 7357 prior to the chains ID. Now, I know we haven't spoke about forking yet, so don't worry if you don't understand this, but essentially, we're going to be taking a copy of Ethereum's chain in the current form and then creating a virtual test net branching off of it. So, if we go to chain ID and we press custom, this is the Ethereum mainet chain ID and I'm going to add the prefix 7357.

So, now I've got 73571. Now, I'm going to leave everything else as it is by default and then click create. So, there we have it. We have our very own virtual test net. That is really, really exciting. We've set up our own blockchain wallet and we've spun up our own virtual test net blockchain. So, how do we connect the two so we can make our first transaction? To do that, we can just click the wallet icon at the top of the Tenderly dashboard and then our MetaMask will automatically open and it's asking for the permission to connect to the Tenderly website. So, we can click connect and then if we just

give it a couple of seconds, we can click approve and then we are all connected. So now when I open MetaMask, you can see that the chain we have enabled is Tenderly's Jest chain, the virtual test net that we have just created. Remember I can easily get to the expanded view of MetaMask by hitting this hamburger icon at the top and choosing expand view. And we can easily switch to and from the Ethereum mainet by clicking where it says chest chain and then choosing popular and Ethereum mainet. And it's the exact same to switch back. We click Ethereum mainet.

We go to custom. And then we choose tendech chain. So we've set up a MetaMask wallet. We've created a virtual test net. We've connected the two. Now let's make our very first transaction. To make a transaction, we need to fund our MetaMask account. Now, as we discussed earlier, to send and receive funds, we need to share our wallet address. This is the information we share with others so that they can direct funds to our wallet. Taking a look at MetaMask, you can see underneath the account name that we have this long string of numbers and letters. This is our wallet address. So, if we just click this to copy it and then we come back to Tenderly and we click fund,

we have an option to paste a wallet address where we can paste our own and then we can select what tokens we'd like to fund our account with. I'll be choosing Ether and I will fund my account with 1,000 Ether. Then I just click top up account and that's it. Technically, we have just sent our very first transaction. If we scroll down on Tenderly here, you can see a list of transactions that have occurred on our virtual blockchain. This is like Tenderly's builtin block explorer.

Similar to Etherscan and block explorer, it's it allows us to see all the transactions recorded on our virtual block. This transaction here is the transaction we have just made. So, we've called the add balance function and we've requested 1,000 ETH. If we click into this transaction, we can see even more details. So, we can see where the funds were sent. And this is our wallet address. If we click up on MetaMask, you can see this ends in 8997F and this ends in 8997F.

So, this is our wallet address. You can also see that we were funded with 1,000 ETH. You can see the time that this happened. You can see the block that this happened in. And you can see the network's name, Jess chain. To verify this, we can take a look in MetaMask as well. So, if we open MetaMask, you can see that on Tenderly JC Chain, if we go to tokens, our balance has increased to 1,000 Ether. Again, unfortunately, this test net ETH does not hold any value. If we could create 1,000 ETH out of nowhere, I'm sure we all would be doing so. But this

is just for simulating transactions and doesn't hold any real value. Still, that's amazing. You've sent your very first transaction on the virtual test net. But let's take this one step further. Let's actually simulate making a transaction within MetaMask. First, I'm going to open up my MetaMask and I'm going to click on the drop-own menu so that I can expand view. So, since we've just created two accounts within this wallet, we have account one and we have account two. Let's direct our first transaction to account two. First, we need account 2's wallet address. So, let's open up account two. We click on the name. We click on account two. And

you can see we've swapped over. Account 2's balance on the Tenderly Jest chain is currently zero. So let's change that. If we copy account 2's wallet address and then switch back over to account one, we can initiate the transaction by clicking send and then pasting account 2's wallet address. Now we need to decide how much test net ether we'd like to send. I'll send 50. Then we need to press continue. and then scroll down and confirm the transaction. And then you can see that we have sent a transaction from account one and it's been confirmed. And that transaction was worth 50 Ether. So if we go over to

account 2 and we click on tokens, you can see that we now have funded this account with 50 Ether. Congratulations, you've made a wallet towallet transaction. Now, I know that that was a long lesson, but we've done a lot of exciting things in here, including creating our very own virtual test net, connecting our MetaMask wallet, funding our MetaMask wallet, and sent a wallet towallet transfer, simulating what it's like to make a transaction on a real blockchain.

Before we move on, I want to emphasize an important point for you to take forward into future lessons on siphon updraft. Anytime we deploy something to a test net or interact with the test net, you are encouraged to use tenderly virtual test net. Within this open updraft curriculum, we often demonstrate deployments with test net. And this is simply because making a transaction or deploying a smart contract. It's like the final stage in development and it's what makes our work feel tangible and real. However, as we mentioned in the previous lesson, public test nets require volunteers to run nodes to keep the blockchain up to date. Now, in the last couple of years, funding our

accounts with test net e has become significantly harder. So, recall in the last lesson when we were on tenderly and we could press that nice fund button and fund our accounts with however much test net e we would like. We can't really do that as easily on public test nets anymore. In fact, it's almost impossible. Testnet ETH used to be very much available at any time, but now it's become harder and harder. It's incredibly challenging and it's really time consuming. In fact, often you need to have funds on the Ethereum mainet in the same wallet account in order to access the public test net for so to be able to hit that fund button. And even

then, we often get given 0 not five e. So in conclusion, test net e is just not as readily available as it used to be. But we believe that using virtual test nets like tenderly is just as effective for your learning and can be much much easier. So from now on, anytime we instruct you to interact with a test net, you are encouraged to use virtual test nets instead and you have the skill set to do that. That said, we will still show you what it looks like to make a transaction on a public blockchain. This is primarily to demonstrate what it looks like to use popular block explorers like Etherscan and Block Scout since these are the tools that you'll

need to be familiar with when you do go on to interact with the mainet and make mainet transactions. But as I said, when you are following along, you have the skill set to use Tenderly's virtual test nets instead. Now, in the next lesson, I'll be showing you how to make a transaction on an Ethereum test net, Sapoleia, but you're not encouraged to follow along because, as I said, to access those forcets, I've had to put real funds in my account. Going back to the GitHub repo associated with this course, if we scroll down to the first section, you can see we have a section called test net forcets. Now, we try to keep this as up to date as

possible. And we link here all of the different forets that are offering Sapoleia ETH. I'm going to click the first one, which is the main Sapoleia foret. Now, just like before, we need to supply this with our wallet address. So, I'm going to Metam Mask. I'm going to copy my wallet address and then I'm going to paste this in here. Then I'll click this button to receive 0.05 05 Saporia ETH and the transaction will be made. Please note that you do need a Google account to use this foret, but there are a number of other forcets listed within the GitHub repo if you want to use a different one. So this is saying that the test net ETH has all been sent. So if we go back to Metam Mask and we

change our chain to custom chain Solia, you can see that we have now got 0.0 05 Sapoleia ETH. Now, at this stage when we were using Tenderly, we were able to see that transaction in the Tenderly dashboard. As I've mentioned, Etherscan is a popular blockchain explorer that allows us to review our transactions in a similar way. If I go to sapoleia.etherscan.io and I copy my wallet address and paste it into here and then hit enter, I can see that one transaction has happened here. And if we click into it, you can see that 0.05 ETH was sent to my account two minutes ago. So, we've now funded

our MetaMask accounts with 0.05 Sapoleia ETH. And the process to make a transaction is the same as before with the virtual test net. What we do is we get account 2's wallet address. So, we go over to account two, we copy the wallet address, and then we go back to account one. We press send. We paste account 2's wallet address. And then we can determine how much we'd like to send. Now, obviously, we need to send less than 0.05 Solia ETH because that's all we got from the foret. I'll be sending 0.01.

And then we can scroll down to press continue. And then press confirm. And then we can see that the transaction has been confirmed. It's been sent. You can see that account one now only holds 0.04 Sapoleia ETH and account two now holds 0.1 Sapoleia ETH. So if we go back to Ether Scan for our wallet address and we refresh this page, you can see that we now have two transactions associated with this account. If we click into this most recent transaction, you can see that 0.01 note one ether has been sent from account one's wallet address to account 2's wallet address. There are a couple of other details here to look at

as well. So these question marks give us a little description of what these terms mean. So a transaction hash which is the top one here is a unique 66 character identifier that is generated whenever a transaction is executed. So this string of numbers and letters identifies this transaction on the entire blockchain. If we copy this and we go back to sapoleia.etherscan.io and we paste our transaction hash, it will take us straight back to that specific transaction. We can also see that that transaction was successful, what block that transaction was in, and

the time stamp. So that's everything. We have made our first public test net transaction. Congratulations. Okay, so you may have watched me send our first transaction on a public test net or you may have followed along. Either way, congratulations. You should now be a little bit more familiar with Ether Scan and how to use MetaMask. When we're reviewing transactions on a block explorer like Etherscan, there is a ton of information for us to look at. So, we have all of the information we've just discussed and we also have this click to show more button. And here we can see even more details about a transaction.

For now though, let's click to show less and just focus on the details that are here. We'll talk about all that later. You can see two fields that we haven't mentioned yet. The transaction fee and the gas price. Again, if we hover over these icons at the side, we can see a small definition for each. So, the transaction fee is the amount paid to process the transaction in ether and fiat value. And the gas price is the cost per unit of gas spent for the transaction in ether and guay. Let's break that down because they're important concepts for you to understand. Imagine the blockchain is like an incredibly busy delivery service. Every time you make a

transaction, whether it's buying an NFT, interacting with a smart contract, or making a simple transaction, it's like sending a parcel through this digital delivery service. Now, delivering any parcel takes effort, but some more than others. A small lightweight package takes less effort than a big heavy parcel. For a traditional delivery service, this effort can be measured in the parcel's weight in kilograms. On the blockchain, this effort is measured in units called gas. More technically, gas is the amount of computational power that your transaction uses to be processed. A simple transaction like

sending tokens from one wallet to another is like a small lightweight package. It doesn't use much effort. It doesn't use much gas. But remember when Kira taught you about smart contracts? Sometimes interacting with those can be like sending a big heavy parcel. It requires a lot more computational effort, meaning it uses a higher amount of gas. So we know that gas is the amount of computational power your transaction needs to be processed. But what about the cost? This brings us on to the gas price. This is the price you're willing to pay per unit of gas.

Back to our analogy, it's like the price you're willing to pay per kilogram for your parcel. The network's delivery trucks, aka the computers processing transactions, are always looking for the most profitable packages to deliver. If they have two parcels that are the same weight, so they use the same amount of gas, but only have space for one more parcel, they will deliver the parcel that's most profitable for them. So, the one with the highest delivery fee. Now, imagine a huge rush where everybody wants to send a parcel at the same time.

Maybe it's a public holiday like Christmas or Thanksgiving. This creates a bidding war. To ensure that your package gets picked up first, you may offer a higher price. But as others do the same, the price of shipping goes up for everyone. And this is exactly how the gas price fluctuates dependent on demand. So if you offer a higher than average gas price, your transaction becomes more attractive and it's more likely to be picked up and processed faster. However, if you offer a lower than average gas price, your package may end up sitting in the digital sorting office and waiting for a quieter moment.

So, gas prices are always fluctuating dependent on demand. So now that we know that our transaction will use a certain amount of computational power measured in gas and that the price of gas fluctuates dependent on demand. We can calculate our transaction fee by multiplying the gas used by the gas price. And this is the total cost to process a transaction on the blockchain. Taking a look back at Ether Scan, if we click more details, we can see this section, gas limit and usage by transaction.

This means that when we sent this transaction, we limited it to a maximum of 21,000 gas. And we used 100% of that. We used 21,000 gas, which is the fixed amount for sending ETH from wallet to wallet. We'll explain how much computation each action on the blockchain uses later. So don't worry about this now, but know that our simple transaction used 21,000 gas, which isn't much at all. If we use the calculation we just mentioned, so we multiply the gas used 21,000 by the gas price, which is around 1.5 GU. This gives us the total transaction fee for the transaction. And you can see that this

number has already been calculated for us here on the blockchain explorer. So since we need to pay the network to process a transaction, it means that when we made this transaction, we paid 0.01 ether plus our transaction fee. But where is our transaction fee actually going? In the what is a blockchain video, Kira explained that a blockchain is a shared synchronized ledger that no single entity or organization controls. Instead, individual participants called nodes form a decentralized network. Each node maintains its own copy of the blockchain and they can all join and leave the network freely. But why would a node join the network and contribute

to the security of the blockchain? Well, there is economic incentive for participating. These nodes actually get paid in tokens for processing transactions and that payment comes from your transaction fees. In our analogy, these nodes are our delivery truck drivers. They are processing transactions and picking the transactions that are most profitable for them. Remember in a recent lesson I said that most blockchains have what we call a native currency. You can think of a native currency like a country's national currency. It's the built-in currency for a blockchain. Just like in the UK, we have the great British pound and in the US we have the US dollar.

Each blockchain has its own native currency. Whenever you send a transaction, there is a node or they can sometimes be called a validator or a minor depending on what network you're on, but they get paid in the native currency of the blockchain where they're processing transactions. So, if you're sending a transaction on the Ethereum network, there's an Ethereum node getting paid in the Ethereum blockchain's native currency, which is Ether. And if you're sending a transaction on the Bitcoin blockchain, there's a Bitcoin miner getting paid in Bitcoin's native currency, which is Bitcoin. For now, just know that every time you make a blockchain transaction, you have to pay the nodes or the validators or the miners a little bit of the native currency of that blockchain.

Let's look at an example of this from our own transaction. If we pull up our MetaMask and click expand view, we can see the balances of both our accounts. Account 2 has 0.01 Sapoleia ETH and account 1 has 0.04 Sapoleia ETH. But if we take a look closer here, you can see that our actual balance is 0.03996 Sapoleia ETH. Since if we go back to Etherscan, you can see that we ended up paying this transaction fee. And now if we go back to MetaMask and we go to send another transaction, we can send it to account 2 and we can send 0.01. When we press continue, you'll notice that we

skipped past some pretty important information about the gas fee we pay for a transaction in the last video. Firstly, MetaMask has estimated the transaction cost for us. But if we click this edit button, we get a little bit more information. And this gives us the ability to edit our gas fees, aka the amount we'd like to pay per unit of gas. By default, we've selected market. So this means we're going to be paying the average market price for a single unit of gas at the current time. Choosing this option will likely have our transaction processed relatively quickly. If we were to select aggressive, we're opting to pay a higher than average gas price and we're

incentivizing nodes to process our transaction as fast as possible. If we select low, we're going to be waiting longer than average for our transaction to be processed. But for the majority of the time, just leaving it at market and not touching any of this is absolutely fine and most likely the best option. So to summarize, whenever you make a transaction on a blockchain, whether that's buying an NFT, making a transaction from one MetaMask wallet to another, or interacting with a smart contract, we have to pay a node, a validator, or a minor to process our transaction. And we need to pay that transaction fee in the blockchain's

native currency. On the Ethereum blockchain, the transaction fee is calculated by multiplying the gas used by the gas price. Although this can vary depending on the blockchain you're on, a higher than average gas price can lead to faster transaction processing times because it becomes more attractive and incentivizes those node operators to prioritize your transaction and process it quicker. But on the flip side of that, a lower than average gas price can mean that your transaction has to wait a little bit longer to be processed. So that's it. You now have a much better understanding of how transactions are processed on a blockchain and where that little bit of ether goes with every

transaction. Congratulations on making it this far. So, now that you know what a wallet is, what an address is, and how to interact with blockchains, I want to revisit smart contracts. We've talked about them from a high level and why they're really cool and the problems they solve. We know that they're trust minimized, deterministic agreements, but what actually are they? What do they look like? And how do they come to life on the blockchain? How do I use them? So, we know already a smart contract is just a contract where the terms are written in code instead of words. Think of it a bit like this. If John pays $100, then give him some digital asset. You write the same rules in a programming language instead. And this language can be transformed into a format that the

blockchain can understand and then it's able to execute it deterministically. In the Ethereum ecosystem, smart contracts are usually written in a programming language called Solidity. Other languages like Viper also exist, but Solidity is by far the most popular. For this course, we are not going to be learning Solidity. I do not expect you to have any programming knowledge, but here is an example of what a smart contract looks like. I don't expect you to understand this. It was just helpful for me to be able to actually see what a smart contract was when I first started. Let's just focus on the bigger picture. So, you see this thing called a function here. This is kind of like a button that anyone can press. When someone presses this button or calls this function as we call it, the code inside it runs automatically. For example, when I call

this mint function, when I press the mint button, it creates tokens and sends them to whoever calls it. Don't worry, most of this is abstracted away for you by your wallet or by the application that you're using. So, normally you don't even know that you're using functions. It's all done for you behind the scenes. So, how are smart contracts created? How are they put on the blockchain? Here's the process. Developers write smart contracts code. Then, they need to transform this code into something that the blockchain can understand. This is called compiling by the way. And then they put the data, the compiled data onto the blockchain. The process of putting this data onto the blockchain is called deploying. Think of deploying a bit like publishing a book.

You can write a book at home if you like, but until you publish it and put it in bookstores, nobody else can read it. Similarly, smart contracts only become real and usable once they're deployed to the blockchain. Once deployed, every single node in the network has a copy of this smart contract code. And now it's immutable, so the code can't be changed. It's transparent. Everybody can see it. Everyone can see the terms and it's always available. It's ready to execute 247. But how do we identify our smart contract from another smart contract on the blockchain? So just like your wallet has its own unique address to identify you on the blockchain, every deployed smart contract also gets its own address. This is how other people can find smart contracts and then interact with them. It's a bit like a house

address. Once your smart contract has an address, anyone can visit it and use its buttons or functions. Smart contracts power pretty much everything on the blockchain. All of those cool applications and use cases we've talked about so far, aside from native currencies like BTC or ETH, aside from those, everything else is just smart contracts or systems of smart contracts. Want to create NFTs? That's a smart contract. Want to lend money in DeFi? That's a smart contract. Want to trade cryptocurrencies? That's a smart contract. And when we go into the use cases section of this course, just know that all of it is just smart contracts.

It's just code. So get excited for that section where we're going to dive into that. But before we do so, we actually need to understand how the blockchain works under the hood. How does this transparent immutable and decentralized system actually work? How do transactions get sent and included? Let's get into it. In this section, we are going to be learning about blockchain architecture. This section is the most technical section of the course. It is going to be a little bit more challenging. If you want to become a developer in your learning journey, then this section is going to be crucial for you. If you don't want to become a developer, let's say you want to go into sales or BD or marketing or something like that, then I still recommend that you watch this section. But if you don't understand

everything, then don't worry at all. In fact, if you want to become a developer and you don't understand everything first time, then also don't worry. This stuff is quite complicated. There's a lot of new terms. There's a lot going on. All I really want is for you to have familiarity with these terms so that when they come up in conversations, let's say you're in a meeting and you hear proof of stake or you hear blockchain reorg attack, I want that to ring a bell in your head like, "Oh, I've heard Kira talk of these terms before and then you can come back to Updraft. You can reread the lessons. You can rewatch the lessons and familiarize yourself with what's going on." It's going to take a while for these concepts to really sink in and you to really understand them. So, please don't get blocked by this

section. If you do get stuck, please ask questions in the discussions and also really use AI to explain things to you. If you get stuck, just ask it a question. And if you're really stuck, just feel free to move on to the next section. You do not need to know this information in order to be able to move on. I just want to familiarize yourself with the terminology and give you an explainer so you have a little bit of understanding about what's going on. One of the most important skills that I want you to learn is to have a mental map so that in your learning you can come back to things and relearn them because not everything is going to stick the first time. A part of learning is understanding where things fit together, where you've heard about things before so you can come back to them at a later

date and brush up. So just buckle in, get yourself a snack, get yourself a coffee, and then we'll get started. And as also extra resources are going to be left in the resources section of this course for you to do some extra reading or understand a little bit more depth. In particular, the Ethereum documentation is a very very good place to go to understand these concepts on a deeper level. We need to understand how blockchains really work under the hood. How is each block linked to the previous block? And in a network of thousands of computers with no boss in charge, how do they all agree on what is true? That is the topic for the next couple of lessons. Imagine you and your friends are keeping a

shared notebook of who owes what money. You and all of your friends all own your own notebook, but you want to try and make sure all of the information in the notebook is the same. This is easy when you're together because you can all just coordinate and write down the same information. But what if you're spread across different countries? This is where things can get a bit messy. How do you agree on what to write down? Sarah's copy says Alice owes Bob $10. Tom says Alice owes Bob $15 and Mike Scopy says Alice owes nothing. But how do you decide who's right? How do you all come to an agreement? This is called the consensus problem. And this is exactly the problem that blockchains need to solve. In fact, there are three core problems that blockchains need to solve.

The first is preventing something called civil attacks. It works a little bit like this. In a blockchain, we have thousands of nodes that all need to come to an agreement. Effectively, each of these nodes acts as like a vote for what they think is the true history. What if someone were to come along and create thousands of nodes which they control? They would then have an unfair weight when agreeing on the valid state of the blockchain. It's like one person pretending to be many, many different people in a vote to have an unfair weight in the system. And this is called a civil attack and it exists outside of blockchains too. Let's say you had an online vote for some influencer award, the best influencer, and the vote is counted one per email. What is to stop

someone coming along and making multiple emails and then having an unfair weight in the system because they can cast multiple votes even though they're only one person? Blockchains also need to be permissionless, meaning that anyone is able to join. But then that still means how do you prevent someone having a majority control in the system? The way that blockchains achieve this is using a civil resistance mechanism. And the two primary ones that we're going to focus on throughout the next couple of lessons are proof of work and proof of stake. The second challenge is how do we know when a transaction is truly immutable? This is called finality. What if conflicting information were to arrive seconds later from a different node? In banks, we can reverse transactions because we have a central authority who decides what's true. But in

decentralized networks, who chooses? How long do you need to wait to be convinced that a transaction cannot be reversed? when is it considered final? And the third problem is the consensus problem. How do we get all of the computers to agree on the valid state of the blockchain? They need to agree on the transaction order and which transactions are considered immutable and final and do all of this without needing a central authority. Both Bitcoin and Ethereum approach consensus, civil resistance, and finality in slightly different ways. Bitcoin makes participating in the network expensive through computational work. You still can create lots of identities, lots of nodes, but you can't fake the electricity bill. It requires a lot of computational resources and

therefore electricity to run these nodes. This is called a proofof work mechanism. And don't worry, we're going to come back to it. I'm just introducing you. Ethereum makes participating in the network expensive through requiring stake. This is money that they have to lock up to be able to participate. You can create multiple nodes, but you can't fake having all of that money locked up. and also you lose your money if you decide to cheat. This is called a proofofstake mechanism. Both proof of work and proof of stake are technically civil resistance mechanisms and they form part of the consensus mechanisms.

How the blockchains agree on the valid state. You'll read a lot of incorrect text which refers to proof of work and proof of stake as consensus mechanisms when in reality they're just part of the consensus algorithm. They are the civil resistance component of the consensus algorithm, not the algorithm as a whole. Instead of making multiple nodes impossible, they make participating expensive through ways that cannot be faked. Don't worry if all of this is confusing. We are going to go into in more detail in the next couple of lessons. All I want you to understand right now is Ethereum and Bitcoin work differently. They come to an agreement in a different way. And secondly, that Bitcoin is a proofof work blockchain and Ethereum is a proofofstake blockchain.

You don't need to know really what that means yet. Let's start with Bitcoin's proof of work. By the way, proof of work and proof of stake are used outside of Bitcoin and Ethereum. I just want to use them as examples. In this lesson, Patrick is going to explain how blockchains like Bitcoin work. Different blockchains work a little bit differently. And in this lesson, we will explain how Bitcoin uses the concept of mining and computational power. this civil resistance mechanism called proof of work that we mentioned in the previous lesson. And hopefully by the end of this lesson, you'll understand a little bit more about what this actually means. I know these words mining, proof of work, don't actually mean anything to you just yet. So, watch this lesson and we will check in

afterwards. See you shortly. 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 walkthrough. Blockchain 101. 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, in order to really anything and everything that's going on here, we 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 fixedlength string meant to identify any piece of data. They are created by putting some piece of data into a hash function. In

this example, uh the hashing algorithm used is Shaw 256. Now, Ethereum actually uses uh this uh this right here for its hashing algorithm, which isn't quite um Shaw 256, but is in kind of this Shaw family, but it's it's really just another way to hash things. And uh the specific hash algorithm doesn't matter uh so much. So, uh this example uses Shaw 256, but you can imagine it's the same as the Ethereum hash. they're just going to, you know, 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 this Shaw 256 hash algorithm and it's outputting this unique hash. So this hash is a unique fixedlength string that's going to identify like a blank data piece here, right? So if I put in, you know, my name like, you know, 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 going to be the same amount. 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 and purposes, we can pretty much put any length in here. And

you'll see too that, you know, every time I type in Patrick Collins, this hash is always going to be this 7E5B, right? I'm going to delete it. I'm going to do Patrick Collins again, you know, 7E5B. It's always this this unique hash is always going to be unique, right? It's always going to be this fixed length string here. So now we can take this idea right of putting this data in here and we can move on to uh 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 going to put all three of these. We're going to say all three of these are combined uh together. We're going to put every all three of them into this hashing algorithm uh to figure it out. So, if I type a bunch of stuff here, we can see that block one with nuns, you know, this nuns 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 mine button? When I hit this mine button, it's actually going to take some time. It's going to think for a little bit. And we can see that the nuns here actually changed, right? The nuns is different from what it was before. And this hash now starts with four zeros.

Okay? And then it the the back turned 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 uh the miners had to solve was they had to find a nuns or or a value in this nun 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. three. No, four, five, six. Okay, five. Well, that started with one zero, but it's not four. And they have to keep trying all

these numbers until they uh 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? Ethereum has a different problem for miners to solve. Um, Bitcoin has different problems for minor solve, but this concept is going to be the same. And since Ethereum is proof of stake now, nodes actually take turns solving these problems. Again, we're not going to go too deep into that right now, though. So, they have to take um one block is going to be this this uh this concept is going to be all this data.

It's going to be the block number and it's going to be this nuns, right? And so this nuns is the solution um is 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, and I do this again, we're going to hit mine and the nuns has changed, right? It went from one to 33,128 cuz this is the nuns that allowed this hash to start with four zeros. And so that's what's happening when uh blockchain miners are mining. They're going through this process, this very computationally intensive process of trying to find a nuns that fulfills whatever the problem is. So that's really it actually. So that's a block and 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 nun. 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 blockchain? 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 or we have additional uh variable here. So like before you know we have block nuns and data right we have block nuns data but we also have this thing called previous right and so this is actually going to be pointing to the

previous hash of the last block. So for example, if we go to the the last block in this blockchain, it says previous is 00 AE8. And if we look at the hash of block number four, it's 0000 AE8. And then we look at its previous, it's four zeros B9. We have four zeros B9. 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 where the previous hash points to a hash that uh doesn't actually exist. Now, as you can imagine, kind of the same as how this block worked, how the block, nuns, and data

all go through the hashing algorithm in the blockchain, the block, nuns, data, and previous hash all go through this hashing algorithm to figure out, you know, what the hash is. Okay, so if we go to over here, you know, for example, if I type in, you know, Patrick, obviously, this is now no longer valid, right? because this nuns uh combined with the block, the data, and the previous hash aren't going to solve, you know, our problem of having four zeros at the at the start, right? So, I'm going to go and fix that. And and that's that's kind of an easy way to 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 red.

Both of these are now invalid, right? Because the block hash with the nuns hashed with the new data which is my name Patrick hash with 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 um and now its nuns with this previous hash is also wrong right and this is where when we talk about uh blockchains being immutable this This is exactly how it's immutable, right?

Because if I go back and I change anything, you know, if I just typed a right here, the entire blockchain is now invalidated because none of these are going to have uh nunes 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 if N was here originally, we can go ahead and mine these. We can mine all these. But as you can see, you know, this is going to start getting very uh computationally expensive because I have to go redo uh basically the entire blockchain uh and the farther and farther down the line you get, the harder and harder it becomes to, you know, rehash and and redo all these different blockchains

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 remine 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 in the past, well, okay, great. All I got to do is change this data 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 uh makes it incredibly powerful. So, we're going to go to the distributed tab here, which I also refer to as the decentralized tab here. Uh, and it's

going to show us what a blockchain looks like uh in a decentralized manner. So we have this exact same uh initial setup here. We have distributed blockchain. We have you know the our first blockchain which is kind of exactly as the one from here. But we also have more than one. So we have peer A, peer B and peer C. And when people are talking about peer-to-peer peer-to-peer transactions, they're really talking uh 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 are by looking at this end hash here, right? or by looking at where we are uh 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 which so this last hash is encompasses everything in here right and we can look we can look at the hash of pure C which is four zeros and then E4B we can look at the latest hash of pier B which is four zeros E4B and then pier A which is four zeros E4B. all of these peers, all of

these nodes, all of these decentralized, you know, these independent um 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, uh, 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 they did they ended up catching up, uh, 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 something that Pier 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 at hash at block number five. So pier A has this new hash now 009bc, but pier has a different hash 004b. Right? So who's right? Is it is it pier with their new stuff or is it pier?

Well, that's where the decentralized comes in because then we can look at pier C and pier C also has E4B. So Pier B and Pier C both say, "Hey, pier 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 uh the blockchain and started their own little blockchain, right? their own history because they're the only ones with this this piece of data in block three whereas pier B and pier C have nothing in there. So that really shows why uh in these blockchain worlds in this decentralized world there really is no centralized entity. you know, pier A, you know, might have been maliciously motivated to change, you know, this this block number three.

However, democracy rules, right? The majority rules in the blockchain. Pier B and peer C both say, "Hey, you know, that that's cute and all, pure A, but you're wrong, right? That that's not right." Now, it might be a little abstract that should just look at data and, you know, us 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 uh with pure A, pure B, pierces instead of having kind of this this data section, we have this uh TX this transaction section, right? And this represents all the transactions that are

happening in this block, right? So, we're we're sending $25 from Darcy to Bingal or to Bingley uh for uh $427 here uh 1922, right? And it's the exact same thing. So, this all these transactions are going to get hashed in the exact same way uh 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 uh if I wanted to say, hey, I I really wanted to give Jane a lot more money from Elizabeth, so I'm pure a and I go back and I change it to 100. Well, now you know, not only do I does my whole blockchain uh get invalidated because that was so far 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 I become malicious and I want to send, you know, I want uh Miss Audrey to have less money. Maybe I want to send a dollar and I go ahead and mine it. The same thing here. this hash. Now, this 2A1 is not going to match Pier B's Pier B's hash of BBA and it's not going to match Pier C's hash of BBA as well. So, the two of them are going to say, hey, this your blockchain is invalid.

It's not matching the majority. You know, you're out, right? So, that's really how uh 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 uh to kind of cryptographically prove um you know where where stuff lies. Now the way the blockchain works is instead of random stuff put in this data section, it's actually going to be solidity code in here defining 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 uh 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 this money here? How do we know that Darcy sent $25 to uh 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 Ethereum actually runs on this Ketchac 256, but you know, we used Shaw 256 for this demo. It doesn't really matter. We're just talking about a hashing algorithms. So again, a 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 in a blockchain is basically a combination of a block, nuns, 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 it will check and they will

compare against each other to see which blockchains are acting honestly and which ones are acting maliciously. In the blockchain world, majority rules. The nuns here is the answer used or the number used to get this hash. Now, nuns 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, you know, four or five zeros at the stop of the hash. However, in Ethereum, it'll also be often used as the number of transactions from a given address. So, that's how proofof work blockchains like Bitcoin work from a high level. And as we said, Bitcoin is an example of a proofof work blockchain. Let's do a very quick little summary. In a proofof work blockchain, the nodes are called miners

and blocks are added to the blockchain through mining. This involves solving that computational problem. As Patrick explained, this is finding via brute force the nons which when hashed with the other block data produces a hash with a certain number of leading zeros. The work is the computational effort and the proof of this work is the solution to the puzzle. This makes it very expensive to attack the network because you'd need all of this computational power. You'd need a majority of the computational power in the network.

We're going to go into that in a little bit more detail in a future lesson on blockchain vulnerabilities. The first minor to solve this computational problem gets to add their block to the blockchain. And when they do so, they earn a block reward. And of course, if you have more computational power, you're more likely to solve this problem first. Here's how it works step by step. When a miner finds a solution to the problem, they broadcast their block to the network to the other nodes in the system. Other nodes then validate the block. They check all of the data. They verify all the transactions and make sure all of the math checks out. If the block contains invalid transactions, the rest of the network will reject it.

regardless of how much computational power went into actually solving the problem. This means that if miners try to act maliciously, they will waste all their computational power anyway. And this prevents them from cheating. If the block is valid, all of the miners will add the block to their version of the blockchain and will continue solving the next problem at adding the next block to the blockchain. What happens if two miners find the same block at the same time? The network temporarily has two competing chains. This is called a fork and is something else that we're going to come back to later in this section. A fork is where the blockchain splits. So now there are two different chains. This resolves when one chain has more accumulated computational work, effectively the one with the most blocks

added. The nodes will then swap to this longer blockchain, the one with the most cumulative work, and the abandoned transactions will go back to what's called the memple. This is where all of the transactions live before they are added to the blockchain. This is called the longest chain rule. Now we need to consider finality. How do we know when the transactions are considered irreversible? In proof of work, finality is probabilistic and it's based on something called confirmations. A confirmation happens each time a block is added on top of the block containing your transaction. So just having your transaction in the block is one confirmation. When an extra block is added on top, that's two confirmations and so on and so forth. After six confirmations, the block is considered

final. And that is because the probability of being able to reverse it is minimal. But there's always going to be a tiny tiny chance it could be reversed by a longer chain. However, the computational power required to rewrite that much history makes it economically infeasible. This would far outweigh any gain they may get by reversing history, doing something like a double spend. But what about Ethereum? I said that things work a little bit differently. Ethereum uses proof of stake, but in order to understand proof of stake, we first need to understand something called signatures. In the blockchain and in cryptography, we use keys to sign and verify transactions. In fact, we've actually already done some signing when

you sent your first transaction with Jess to the blockchain. We actually signed the transaction to authorize the action to occur. It's like we sent a little signed message with our signature stamp that said, "Yes, I would like to send this transaction." I sealed this message in a special envelope with my special stamp and no one has access to my stamp. These special seals or signatures are actually mathematical and they're used heavily throughout the blockchain. Let's go into these signatures and these mystical keys and what they actually are and how they work.

Woohoo. We are now on to my favorite topic of all time and that is cryptography. You've heard of, of course, crypto, which sounds kind of similar, cryptocurrencies. But what is cryptography? Cryptography is the math behind secure communication. It's the algorithms we use to send and verify these transactions on the blockchain and that powers cryptocurrencies. This includes being able to verify that some message, like a transaction, was sent by the intended sender. And that is the topic of this lesson. Don't worry, we aren't going to be going into any actual math in this video. in this lesson or even in this course. We're just going to give you some highlevel knowledge of cryptography, specifically cryptographic

keys, what they are, how they're used, and how you can use them to create signed messages. So, let's say I have some message and I want to send my message to Patrick without anyone else being able to tamper with it. I could write my message down, sign the message, and then seal it with my signature wax stamp. I can then send this message as a letter in the post without worrying that anyone is going to tamper with my message because if they did so they would have to break the seal. Spoiler alert, the message said, "Please don't tell smart contract programmer, but I'm his biggest fan and I want to be a frog just like you guys. In fact, I've made my own frog." Here she is. Patrick can then receive my letter and he can check that the seal was in fact my seal and

therefore was sent by me. Let's now relate this back to the blockchain. In the previous section with Jess, you installed a MetaMask wallet and used it to send transactions. But here's what your wallet really does behind the scenes. It manages two special keys, your private key and your public key. And it uses your private key to create signatures. Let's understand from a high level what these two keys are. And then we are also going to go into it in a little bit more depth in a demo where you can actually see what's happening. To create signatures and verify those signatures, we have two very special keys. That is your public key and your private key. Your private key is like your signature stamp like the wax seal from our analogy. Only you should have access to it and you can use it to sign

transactions to prove you have access to the account. If someone steals your private key, they can access your account and spend your funds and send whatever transactions they like. Your public key is like your mailbox address. It's safe to share with everyone. People can use it to verify that signatures have freely come from you, but they can't use it to steal your funds or impersonate you or send transactions. These two keys are mathematically linked together. Your private key can create signatures that can be verified with your public key. But knowing your public key doesn't allow anyone to figure out your private key. It's a one-way mathematical relationship. Earlier, we also said that your wallet address was like your mailbox address. So, you might be a little bit confused here. And that's because your public key is

actually linked to your public address. It's actually just a shortened hashed version of your public key. It's a bit like a nickname that's easier to share. So, let's go back to these signatures. When you clicked confirm in MetaMask to send your transaction, your wallet is actually using your private key to create a digital signature that says yes, I authorize this action. The blockchain can then verify this transaction was in fact sent by you by verifying the signature. And they do this using your public address or your public key. All of this happens through ECDSA. And this is just the math that makes it all possible. Now, I found this all a little bit confusing without actually seeing what's going on. What do you mean that there are these two keys?

What do they look like? How do I use them to create signatures? And how do I verify those signatures? And to show you this, I've actually built a little demo. So, let's go into that now. So, that was a lot of words. I'm going to go into how all of this works. And to do this, I've got this little demo because I do love a demo app. And I think it just makes it a little bit easier to understand. So if we head to exactly the same site as in the section two, I think it was where we had the demo site. I have all my demo sites hosted here. So if you see up in the navbar, you can see all of the different applications. And I will flash up on the screen what the exact URL is because currently I'm still developing it. So I'm on local host and the

specific app is ECDSA signatures. And so I'm going to show you how those ECDSA keys, your public and your private key works and how signatures actually work. and we're going to show how each of the components are derived from each other and how it doesn't go backwards as well. And then we're going to relate it to what we've seen in MetaMask. And hopefully that will make everything make a little bit more sense because I know it is a little bit abstract and personally I prefer to be able to see what's exactly going on. So the first thing that happened when we created our MetaMask wallet was we created a seed phrase. Let's just do a dummy version of that now in this demo. So we can click generate new seed phrase. And you'll see that we have those 12 words that we had when we installed MetaMask that we need

to save securely. And the reason that we need to save this securely is that this seed phrase is the m is the master password to all of our accounts in MetaMask. So if I open up MetaMask and I click on this dropown for account one, you can see that I can add new accounts. I can create new accounts. And each of these accounts has an associated private key which allows me to sign messages. So in my demo I can click add private key. And what's happening here is that this seed phrase is being combined with the account number in a mathematical way.

You can just blackbox it for now. If I have this seed phrase and I recombine it with the account number, so account number zero, I will get this private key in a deterministic way. So the seed phrase is used to generate the private keys. Think of it like this. Your private key is like your key to a specific door. It's the key to your specific account, account zero. And the seed phrase is like the master key that can create all of these keys for unlimited doors or unlimited accounts. And that's why MetaMask was so insistent that you write down this seed phrase and keep it safe because if someone has access to your seed phrase, they have access to all of the accounts inside of your MetaMask. If you lose your private key for account one, they won't be able

to access any of the other accounts. They can only access account one. I hope that makes sense. The other thing is if you lose your accounts, if you have your seed phrase, you can regenerate all of your accounts from it. Anyway, so each of our Ethereum accounts, so each of our different accounts inside of our MetaMask wallet has an associated private key. So we can think of this private key as the password to one of our accounts. It's a secret password that we've got to keep secret. And a private key is just a long string of numbers and letters. And this is what controls your account. And if I click to add another private key, it will have a different combination of letters and numbers. That is because the account is different. Therefore, the private key is

different. And we use the account number one and combined that with the seed phrase to generate this private key. So each of these different private keys is the same seed phrase plus a different account number. And that's why you can have lots of different accounts inside MetaMask all from the same seed phrase. Please remember that these private keys control your accounts and any associated funds. This is what we are going to be using to sign messages and prove ownership of our account. If someone knows your private key like this this this string of letters and numbers, they have access to your account and so can do anything they like. So you need to keep your private key private. Never store it in plain text ever. And we are

actually going to show you how to encrypt your private key here on Updraft. So please stay tuned for that after this course is over. I will guide you before where to go to keep your wallet safe. So just to reiterate, so make sure I am extra specially clear. If you're someone has your private key, they can control that one account, which isn't a good thing obviously. And if they have your seed phrase, they can control all of the accounts that it was used to generate. I am showing you these private keys here because this is just a demo. In real life, please, please, please never share these. So, the next thing is the public key. So, we actually use these private keys. I'm actually going to delete one of these private

keys just to make things extra specially simple. I'm going to keep this account zero. And we can use this private key to generate a public key. So, if we click generate all public keys, then we can generate a public key for that account zero. And this public key is shared to safe with anyone. I could put it on a billboard and my funds would still be safe. You might be thinking, Kira, you said this public key was derived from this private key. So surely if I share this then people will know the private key. And that is not the case. And the reason for that is a little bit complicated, but essentially the private key gets transformed into the public key using something called scalar multiplication on an elliptic curve.

Don't worry about these fancy words. Here's the only thing that matters. It's a one-way street. And you can think of it a little bit like this. I could multiply two big numbers like 127 * 439 and get an even bigger number, 55,753. If I just gave you this number, it's much much harder to figure out those two numbers that were multiplied together. This isn't exactly how it works because it's elliptic curves. So, this actually makes it mathematically impossible to reverse. The reason why it's mathematically impossible is very complicated. I'm not going to go into that right now. But the only thing I want you to understand is that the private key is used to generate the public key using some very special multiplication. But there's no reverse operation. You can't take this output

and then get back the private key. It's a one-way street. You can go from the private key to the public key, but you can't go from the public key to the private key. This is actually the foundation of all blockchain security. I can prove I own an account using my private key to sign a message without ever having to reveal the private key itself. Someone can come along and verify my message using this public key, which we're going to see in a second. So, if that doesn't make sense to you, don't worry. But they can't actually steal my private key from it. So, you might be thinking, okay, that kind of makes sense, like derive your public key and that can be used to verify things. But this looks very different to this address that we saw in MetaMask. This is quite a bit shorter and that is because

this is your Ethereum address and your Ethereum address is actually derived from your public key because your Ethereum address is basically just a shortened hashed version of your public key. It's like a nickname that's a little bit easier to share than the full public key but still uniquely identifies your account. So I can click generate all addresses to generate my Ethereum address from my public key. Now I want to show you how we actually do that to show you how this is generated. So the first thing I'm going to do is remove this 04 prefix and I'm going to copy the rest of my public key. And the reason we have the 04 at the start is just to say that this is an uncompressed public key.

Don't really worry about what that means. It just means it's a big one. It's not a small one. Now we are going to go back to our blockchain demo just because we've got something helpful in there which is the Kak 256 hash. So, we're now going to hash the rest of that, except we also need to prepend it with the 0x prefix. And then what we need to do is take the last 40 characters, so numbers and letters. And if we compare, it's 91 44 blah blah blah C1 at the end. This has C1 at the end. Here is our Ethereum address. So, we take off the prefix of the 04. We put back on the 0x prefix. We hash it. And then we take the last 40 characters and this is your Ethereum address. Don't

really need to worry about how it's generated. I just kind of wanted to show you the process of how we take our public key and calculate our Ethereum address. So let's just do a very quick little summary. We initially had a seed phrase. We then combine the seed phrase with an account number to get our private key. This is our key to our Ethereum account, the master key that can unlock all of the funds. You need this to sign any transactions and send anything to the blockchain. Spend your funds or get new funds or whatever it is you need to do. We then use some very special multiplication to generate our public key in a one-way operation. So you can't take this public key and get the private key, but you can take the private key and get the public key from

it. We then hashed our public key and took the last 20 bytes or the last 40 characters to get our Ethereum address. And this is our nickname for our account that people can use to identify us and send us funds etc. So now we can use our private key to sign some messages and we can actually verify those messages were signed by the intended person using the public key. Let's now sign some messages. So I can select my account that I want to be signing with and I can create a custom message. I could write something like hi Patrick smart contract programmer is really cool from car. Oops. I can write in my message I want to sign. I

can then sign the message and it will create me a digital signature. Under the hood, what's happening is we're using the ECDSA or elliptic curve digital signature algorithm to use some fancy maths to create this signature. And again, this is just a string of letters and numbers prefixed with that ox. So it's literally just some data, which is pretty cool, right? And this data is my signature. Proof that I know the private key associated with my public key. And we can now use this to verify our signature. If we just copy that signature, we can paste that in this signature box to start verifying our signature. And I'm going to say, I think that was account zero who signed this message. So we'll check did the owner of the private key associated with this

address sign let's copy that this message to produce this signature. So we can click verify message and we can see that yep the signature is valid. The signature was created by the holder of the corresponding private key. If we change the message let's say we made it from Jess and we clicked verify signature the signature would be invalid and that is because the message has been tampered with. So you can see that we can now create a scenario where we can check whether a signature is valid to see whether the signer was the intended signer and whether the message has been tampered with. So if we create another account now let's create another private key account one can now generate all public keys to generate that second

public key with account one and we can generate all the addresses. So account one Ethereum address we've now got another Ethereum address. So now if I go down here and I select account one and say put this back to what it originally was from Kira. Try and verify the message. Oh, it's still invalid. And that's because this is not the person that signed the message. So if we now try and verify that again, it was valid. And that is because this message combination with the owner of this account signed this message. We can then do the same thing with Ethereum transactions. So let's say again it's account zero signing this transaction.

They are sending some funds to this random address with this value. We've got a nons gas limit gas price. We've talked a little bit about these things, but don't worry about it too much. We're going to generate the transaction message. So this is what our transaction message now looks like. It's got all of the fields, all of the information that we need to send our transaction. And then we can actually sign this transaction. So now we can copy this signature, paste it in here. We can say yep we think account zero they are the person who is sending this transaction and the original message was this transaction which we can copy paste that in there and we can verify the signature. We see yep the signature is valid. What if someone tries to tamper with that and they say the two address

is different. Let's now verify again and it is in fact invalid. Let's change the two address back and let's see if now account one was the signer of this message and they weren't. It's because it was account zero. So now you can see how by creating signatures we can check whether the signer of the message had access to the private key associated with a public account using their public key or their address really. And we can check whether the message really was the message they actually signed in the first place and whether it's been tampered with. So, no one can now tamper with the transaction details and they can't pretend it was someone else sending the transaction because they don't have access to the private key and therefore they cannot sign messages and without the private key you cannot sign

transactions associated with an account. Let's do a very quick little recap of the most important information. The seed phrase generates all of the different private keys by combining the phrase with the account number. So, never share your seed phrase. If you ever lose it, then anyone who has access to it will be able to access all of your different accounts. Never share your private keys because this gives complete control over that specific account. If someone gets this, you lose that account forever because they can then send transactions using your private key. Your public key and your public address are both fine to share. You can share them freely.

They're like your username on the blockchain, your mail blocks that everyone needs to be able to send you money and also verify your transactions. So please with your private key and your sephrases, never type them into a website. Never share screen with them. Never put them in plain text files. Never put them in code. Never put them in a message. Never store them in a cloud service. Never take photos of them with your phone. And yes, how do you store them safely then? That's exactly what Patrick Collins is going to cover in the wallet security course, which we're going to be recommending at the end of this course. So don't worry, you don't need to remember it. He teaches everything about proper encryption, how to use hardware wallets, and any safe storage methods. For now, I just want you to understand that these secrets need proper protection. So, hopefully

you now understand a little bit about signatures and verifying signatures and how we can use them to authorize transactions from your account. But here's where it gets a little bit more interesting. Signatures are actually used in lots of different places in the entire blockchain. Remember those node operators from our proofof work lesson? Well, in the next lesson, we're going to be looking into proof of stake. And instead of solving computational puzzles, validators actually use these signatures to secure the network. So when you're signing transactions, you're saying, "Yep, please send my ETH here." And you can check that it was actually me who sent this message. Validators can sign blocks to say these transactions are valid and I'm locking in these transaction details in this order. And

then someone can come along and verify that that validator was the signer of that block. It's the same cryptography but just used for different purposes. The same mathematical principles that protect your $50 transaction also protect the entire multi-billion dollar network. Let's move on to this proof of stake where we are using these signatures to protect the network. Instead [snorts] of racing to solve puzzles, they're signing their agreement on which blocks are valid. So now we know how chains like Bitcoin work. They use mining to add blocks to the blockchain through a mechanism called proof of work. And now we understand a little bit about what signatures are. This means we are now ready to understand how Ethereum works.

Yay. So in proof of work, of course, we had miners. And this is what we called the node operators in proof of work. Miners compete, solve a computational problem, and the first miner to solve this computational problem adds the block to the blockchain and wins the block reward. And miners with more computational power have a higher chance of earning this block reward because they are have more chance of solving the problem first. And the way each block is linked together is via hashes. And the hash of each block is in the subsequent block to link them together. Meaning that if the block's hash changes, it will break the rest of the blockchain.

And you'd have to remine everything. Now, Ethereum works very similarly to this. It also links everything together through hashes. But back in 2022, Ethereum switched from a proofof work blockchain to a proofofstake blockchain. And this is actually a lot more energy efficient. We no longer have this computational problem. Let's now go into a demo to show you exactly how this works. I love a demo as you're all coming to learn and to help us understand Ethereum and proof of stake because it is a little bit confusing when you first embark on your journey to understanding proof of stake. And inspired by that brilliant demo by Anders Brownsworth that Patrick went through, I have built this one for proof

of stake. So big thank you to Anders for the inspiration. So you already understand a little bit about blockchains and how chains of blocks containing transactions are linked together through those cryptographic hashes. And you know that changing the historical data breaks the entire chain by changing these hashes. Proof of stake works using this principle as well, but there are some key differences. In Bitcoin and proof of work, we use the SH 256 hash. For Ethereum, we use a very similar hash, but it is Kekak 256. The principle does exactly the same. Let's just recap to make sure that we are on the same page because there's nothing like a secondary explanation. Feel free to watch this on two times speed if you're like, Kira, I already understand hashing. It wasn't that complicated.

Otherwise, please listen again because hashes are super important to understand. If we type hello world, then I get this long string of numbers and letters and this is my fixed length 32 byt hash. So you'll see that there are 64 characters if I spent the time counting all of these up. Two characters together makes up a bite. This is 32 bytes long. The output is 32 bytes. This is like our digital fingerprint for our data. If I even change one character, hello worlds, the whole entire hash changes. This is the foundation of course of blockchain security. You can't secretly change anything because the fingerprint would be totally different.

If I change things again, hello world from Kira, the hash changes dramatically each time I change the message. Even if I write a really long message, the size of this hash, the length is exactly the same. I cannot predict what the hash is going to be. Hi Jess from Kira from this hash. It's always the same length. It's unpredictable and the amount by which it changes is unpredictable. Even if I change my message, my data only a tiny amount, the hash changes dramatically.

If I type in the exact same thing, so if I say hello, it's ox1 C8 blah blah blah and then at the end C8, I add a full stop or I say from Kira, but then I remove it all and I go back to just hello. It's the exact same hash that I had before. It's deterministic. And this is crucial for exactly how blockchains work. The same input to the hash will always yield the same output. As a recap, hashes are deterministic. So the same data input will always yield the same output. If you look here, C5D blah blah blah. I remove it, it's E C37. If I put it back, it produces the same hash.

It's unique. Each data input creates a different hash. You can sometimes get hash collisions where different inputs yield the same hash, but this is extremely unlikely to occur and you can assume for now impossible. It's a one-way function. So given some hash, you cannot retrieve the data input. There is no reverse function. You cannot go backwards. And finally, we have the avalanche effect. So one small change changes the hash dramatically in an unpredictable way. Two distinct hashes being similar does not imply that the inputs were similar. For two similar inputs, the hashes are not related.

Hopefully now we understand hashing pretty well because we've had two explanations of what's going on. Obviously, that was only a very quick recap. If we move on to the block hashing tab, then we'll see that this is exactly the same as before pretty much. This is also going to be familiar. So instead of hashing arbitrary data, we now hash the data in the block block number and whatever the data is. It can be anything. Hello world. This is some data in the block or it could be Kira sending some Ethereum to Sarah of the value $1. When our node operators, which in this instance they are now called validators, why they are called validators will become clear very shortly. When they are creating these blocks, they have to calculate the block hash exactly the same as before. So that

we can have a unique fingerprint for all of that block data where if we change something in the block, the block hash will change and we'd have to recalculate the hash to make sure that the block information corresponds to the block hash. And all of the blocks are linked together using this hash. The next tab is completely different now. So instead of mining, solving that computational problem, finding a nons, you'll see that we no longer have a nons field. And instead of mining, we now have this signing operation. And this is because proof ofstake blockchains work differently. There's no computational puzzle to solve, no race to find the correct nons. Instead, there is a validator that is going to check the transaction details. Do these senders have enough balance to send this amount

of ETH? Are the signatures for these transactions valid? Do the state changes make sense? So all of the balances before and the balances after, do they make sense with all of the like decrements and increments and all of that? If everything looks good, the validator creating the block will sign the block. And you'll see here that now we have this signature with the signed hash, so the hash of the block and the person who signed the data. And we learned before with signing that this proves two things. We can prove who signed the block and whether they know the private key for this validator. And we can prove that this in fact was the message that they signed. So if someone came along and tried to change the block data, the signature would become invalid

because the message has of course changed. So this is the way that we lock in this block hash. So this block hash now doesn't match the one that was used to create the signature. The data has changed and the signature has become invalid. So, no one can tamper with the block. And we have a little description down here for how block signing works if you're curious. Now, let's see what happens when we chain multiple blocks together on this POS blockchain tab. Just like Bitcoin, each block contains the hash of the previous block. So, you'll see here, this hash matches the hash of this block, and in this block, this hash matches the previous hash in this block, and so on and so forth up

the chain. If the hash of block two changes, so let's say we modify the data in here, someone comes and tampers with it, we now break all of the subsequent blocks in the chain. And that is because the hash that was signed is now different from the block hash because the previous hash would change in this block. Therefore, the block hash would change. Therefore, the signed hash is different from the block hash all of the way up the blockchain from where you changed it. So instead of having to remine the block, we now have to resign the block so that now the signed hash matches the block hash. And we would have to do that all of the way up the chain to make sure that none of the blocks are invalid. But wait, what's to

stop a validator coming in and doing exactly that? We don't have to solve multiple different computational problems all the way up the chain and do that quicker than anyone can add any blocks to the blockchain. And we're not limited by computational resources anymore. So, where's the security come from? What's to prevent a malicious node operator coming along and rewriting history and then just resigning everything? And the answer to that is staking. And it's pretty cool in my opinion. So, let's head to the validators tab. The final tab is going to show us how it all fits together. So, in proof of stake, of course, we don't have these miners, we have validators.

And validators take turns proposing blocks in an orderly fashion. So, instead of racing to create the blocks, they just take turns. If you scroll down here, you can actually see which validators we already have. We can also add validators or add stake to our validators. Ignore that for now. Just look at our validators. So, we currently have three. In reality, there would be uh thousands, but we are going to obviously simplify things. And you'll notice that each one has staked ETH and each of them have this 32 ETH staked. So, what happened was to become a validator, they sent 32 ETH to some contract. It got locked up and that is staking. They lock up their ETH. And this is real money. So, well, it's this is a demo, but you get the point. It

would be real money in the real world. And they have to lock it up to participate. The minimum amount that they have to stake to participate is 32 ETH. They have to have a minimum of that amount in the smart contract at any one time. We can auto select it or just for the sakes of the demo, I can actually select who I want to propose it. And then they can select the transactions that they want to include in their block. And you'll see that the block hash is actually changing because obviously the data in the block is changing. And then Alice can sign and propose the block to the network. And here is the key difference from Bitcoin.

Instead of the other miners competing, the validators just validate Alice's work. They check are these transactions valid? Do the balances add up? Are all the state changes correct? What we were saying before, they do this again and they check the signatures. So this signature that they signed at this certain time, the information in the message that the validator signed, is that correct? Did they try and do anything bad? Basically, and then they will vote, which is called a testing to whether they want to approve this block. So let's say all of the validators say yes with all of their stake because this is the weight that they have in their vote. So this is really important. This isn't a pure democracy where each validator just gets one vote. It's

weighted on their economic stake because they all have 32 ETH. Their attestation is currently equal their power 33.3%. They have a third because there are three. If Bob had staked 64 ETH, his vote would count twice as much. So if we did go through the process of adding, so if we choose Bob, we could add 32 ETH to his stake to give him more power in the network. So, let's not do that for now, but let's say that it's Bob proposing a block. He can sign and propose the block. And let's now say that one person says no. Maybe it says Charlie rejected it. And then two of them say yes. And you'll notice that the block is still added to the blockchain. And this is

because for a block to be added to the blockchain and also to be something called finalized, which we're going to touch on again later, considered irreversible, we need 2/3 of the total staked ETH to vote yes. Not two out of three of the validators, but 2/3 of the economic weight. So you can see now the block is now final. You might be saying that what is to prevent malicious behavior. So you've kind of already understood that and that is because you have to have a majority agree to add your block to the blockchain. So, if we go back to the previous page, if we change the information, if we make this one ETH or something, we have to resign all of the blocks. But you don't just have to resign it. You also have to get everyone to agree. All of the

validators, well, twothirds of the validators to agree to the different state. So, if we refresh the state and go back now, if one of these validators acts maliciously, and here's the real key thing which makes staking so cool. If anyone detects malicious activity, so things like double voting, proposing two blocks for the same slot, we'll talk about slots and everything like that later. If they do anything bad, if they violate any consensus rules, then they will be punished. And this punishment is called slashing. And this is where a portion of their stake is destroyed.

This is called burning. Their stake is taken away from them. And the tokens themselves are just destroyed. They're taken out of circulation. They are burnt. The incentive for the validators to act honestly, to do the right thing is economic. They risk losing this staked ETH if they do anything bad and it's detected. We're going to talk a little bit more about slashing in a second. And I haven't included slashing in this demo because it's just a little bit complicated to show you the sorts of things that they can do wrong. But you can just understand that because we need this twothirds majority to be able to add blocks to the blockchain and the more stake that they have, the more power they have in the network, but also

the more they have at risk for being slashed. Now, this isn't completely technically accurate. This isn't exactly how staking works because in reality, things are just slightly more complicated. But the main thing I want you to understand is that in order for a block to be added to the blockchain, 2thirds of the stake in the network need to agree to the block's validity. In order for someone to come along and attack the network, they would need to have control of 2/3 of the stake in the network. Here we'd only need 2/3 of the total which is 6496 ETH and 2/3 of that is 64 ETH which really isn't very much in reality for Ethereum to have control of 2/3 of the

staked ETH in the system. This would be tens of billions of dollars worth of ETH which is just a ridiculous amount and you're never going to be able to obtain that much. It creates a self-reinforcing system where the more value the network has, because right now you'd only need 64 ETH to be able to control the network. Not very much. The more ETH in the network, the more that's staked, the more it becomes secure. The other thing I wanted to talk about was just validators. So, actually anyone could come along and become a validator. All you need to do is stake a minimum of 32 ETH. The more stake you have, the more voting power you have. On Ethereum, the maximum is 148. So, you can see compared to tens of billions of dollars. Even with the maximum amount, your weight isn't massive. Of course, you could just

run multiple multiple validators, which some node operators do, but still it's cool that anyone can just become a validator and then participate in the network doing things like proposing blocks and validating them. So, let's just recap what happens. So, first of all, we talked about hashing, how the data in the block is hashed, and we don't have a nonce anymore. And the reason we don't have a nons anymore is because the block is now signed to lock in this block hash. The blocks are still linked to the previous blocks through signing where the message in the signature will change. If the hash changes, the hash in the message for the signature doesn't match the block hash and therefore it would break all of the subsequent blocks. And the way to participate in the network is that

validators take turns proposing blocks and then voting on whether they agree that the proposed block is valid called a testing. And a block needs twothirds of the staked ETH to agree that the block is valid for it to be added to the blockchain. And they need a minimum of 32 ETH to be able to participate in the network. And to be able to control what happens in the network, whether we can resign these blocks, whether we can add new blocks is determined by whether you have control of 2/3 of the stake in the network, which for Ethereum you're not going to be able to do. How does proof of stake achieve finality? So validators of course take turns proposing blocks and they are pseudo randomly so like

almost randomly selected using a algorithm called rando. It's pseudo random because technically there's some predictability but don't worry about that. And the timing works a little bit like this. So every 12 seconds a validator proposes a block. This 12cond period of time is called a slot and every 32 slots is called an epoch. This is about 6.4 minutes. We already know that during each 12-cond slot, a validator proposes a new block and then the other validators technically actually a subset of all of the validators in the system called a committee will attest to whether they agree that the block is valid or not.

These attestations are just signatures and they're aggregated into one single signature. If twothirds agree, then it's added to the blockchain. Each epoch, so 32 slots, all of the validators in the system will then vote on pairs of blocks and whether they are valid. If they agree, then the earlier of the two blocks is considered final and absolutely irreversible and the later of the two considered justified. Again, this requires twothirds of the stake to agree. And then in the next epoch, the justified block will then become hopefully finalized. So that demo gave you a hands-on feel for how proof of stake works. The real Ethereum network doesn't have just three validators. It has thousands of them and they process transactions every 12 seconds. The

validators take turn proposing blocks and each block is cryptographically linked together through hashes. Instead of computational work, proposed blocks get validated through economic consensus. If 2/3 of the staked ETH agrees, the block gets added and eventually becomes final. In order to rewrite history, you'd need 2/3 of the staked ETH to agree. Instead of burning electricity as with proof of work, we're leveraging game theory and economic incentives to secure the network. it would cost a lot more to attack the network than you would ever gain from it. In the demo, we kind of touched briefly on staking. Let's go into things in a little bit more depth very quickly.

Staking is what incentivizes the validators to act honestly. They have to stake a minimum of 32 ETH to be able to participate in the system, like we've already said. And if they act dishonestly, they are slashed. So, a portion or all of their stake is burnt. It's taken out of supply. It's taken away from them. it's destroyed. Slashing is the penalty mechanism in proof of stake to economically punish the validators if they act dishonestly, if they break the rules. It's a financial deterrence that maintains the security of the system. When a validator commits offenses like double signing blocks, making contradictory attestations, this is called surround voting, or going offline for extended periods, other

validators can submit cryptographic evidence of these violations to trigger the slashing penalties. And then, as we said, a percentage of the offending validators stake is burned depending on the severity of the offense. Slashing is an economic incentive for honest behavior because the validators are risking their own money for misbehaving. But it fundamentally relies on an honest majority controlling the network to detect the offenses and then submit evidence. So now that we've learned how blockchains work, both proof of stake and proof of work, and how they come to consensus and finality, in this lesson, we're going to explore something very, very important, and that is how blockchains can actually be attacked.

For both Bitcoin and Ethereum, all of the attacks discussed in this lesson are economically infeasible, and most of them have never actually occurred. But for some smaller blockchains where there are fewer nodes, there's fewer economic stake, there's less computational work. Depending on the mechanism used, these attacks can actually happen. I am going to be keeping this lesson extremely high level. Some of these attacks are actually quite complicated to understand, but I am going to leave some resources in the resources section of this course. And if you're an aspiring developer, I do recommend that you do go and read those because it is really important to understand so that you can protect yourself against these vulnerabilities. You really need to make sure that you understand them. But the main thing I want you to take away from this lesson is just the terminology. I want you to understand from a high level

what these different attacks mean, how they actually happen. You can look at for instance the Ethereum documentation for proof of stake as that is a fantastic resource. Let's do a little recap of what a civil attack is. A civil attack is where one entity pretends to be multiple entities to gain a majority control over the system. In a blockchain, this could involve creating multiple multiple nodes in order to outvote everybody else. If successful, they could then control the network. They could approve fake transactions, double spend where they may spend their tokens, do something like withdraw them for real money to their bank, and then reverse that transaction. So, they still hold the tokens in their wallet, but then they also have the dollars in their

bank account if they have control of the network. They could also block transactions, reorder them, do anything that they like, reverse history, and so on. Bitcoin and Ethereum use civil resistance mechanisms to make this nearly impossible. And that is of course proof of work and proof of stake. Bitcoin uses proof of work and says, "I don't care how many computers you have. What really matters is how much electricity you're burning to solve the computational problems." You can't fake computational work. Ethereum uses proof of stake and says, "We don't care about having multiple nodes and fake identities. What matters is how much economic stake you're putting at risk.

You can't fake owning cryptocurrency." But what happens when someone does gain too much power in the network? Let's say they do have loads of computational power. Let's say they do have lots of economic stake. This is where the famous 51% attack comes in. In proof of work, if someone controls more than half of the computational power in the system, they can actually rewrite history. And then they could do things like double spend. They could withdraw their money to buy a car. They could then keep that car, rewrite history, and keep their Bitcoin. A 51% attack in proof of stake happens when someone has control of over 50% of the staked value in the system. So for Ethereum, of course, this is staked ETH.

If someone controls more than 50% of the staked ETH, they can manipulate Ethereum's fork choice algorithm. We're going to come back to forks and what they are in a second, but this algorithm essentially just determines if validators disagree on the valid state of the blockchain, which state, which version of the blockchain they're all going to come to an agreement on. If there are these different versions of the blockchains where the most recent blocks are a little bit different, the chain that is accepted is the one with the most attestations. If someone has more than 50% of the voting power, the attacker can force their preferred version of the blockchain to be accepted and become final. And this allows them to rewrite recent history, exclude certain transactions or reorder them for profit. But they haven't got the ability

to reverse finality or finalize any blocks that they like. This only happens if they have at least 2/3 of the staked ETH in the system because this is the threshold needed for finality. If someone has control of more than 2/3 or 66.66 recurring percent of the staked ETH in the system, they have complete control over consensus. So they can finalize any blocks that they like or even rewrite history and not just short-term. However, both of these attacks, so 51% or 66.6 recurring percent would cost tens of billions of dollars and it would likely backfire because the Ethereum community would just abandon the compromised chain and switch to a new version which doesn't

include these malicious blocks. So this huge investment, these tens of billions of dollars would end up becoming worthless. Anyway, this is called a hard fork and is the subject of the next lesson of this section. And this system where the community comes together and creates a new version of the chain is called the social layer. A 51% or 66.6 recurring percent attack would be like spending an absolute fortune to rob a bank only to find out that your robbery made all of the money inside the bank worthless. Anyway, Ethereum has never successfully been 51% attacked. Larger chains like Ethereum with more state ETH are more secure because you need more ETH to be able to have a majority

control. Mathematically possible but economically insane. There are lots of technical details about what you can do with different percentages of control over the network in Ethereum and how the participants are actually punished via slashing and how this works. And these details are explained in depth in the Ethereum documentation which I have linked in the resources section. And if you are an aspiring developer, I do recommend that you do check this out. So if an attacker has got a majority control over the network, 51% of the mining power or twothirds of the stake, they are theoretically able to change history. By the way, this has never happened in Bitcoin or Ethereum's history. When history gets rewritten, we call this a blockchain reorganization or reorg. Reorgs happen actually all the

time naturally in proof of work. When those two miners solve the computational problem at the same time and then the blockchain splits temporarily. This is called a fork. One blockchain eventually becomes longer and wins. And this is why we use confirmations. The deeper your transaction is in the blockchain, the harder it is for a reorg to undo it. The less likely that there will be a competing chain that eventually becomes longer. In Ethereum and proof of stake, blockchain reorgs are even harder. You need to control 2/3 of the staked ETH, which is tens of billions worth of dollars. And that obviously far outweighs any benefit from performing a blockchain reorg.

MEV is another attack that doesn't require a majority control of the network and does actually occur even on Ethereum. When you submit a transaction, it doesn't instantly get added to the blockchain. Instead, it sits in a waiting room called the memple. A memple is just where pending transactions sit. It's like a waiting room for transactions, but we're going to go into the memple and what it is actually later on in this course. The person building the block gets to choose the order of transactions. This creates opportunities for something called sandwich attacks. And this is a type of maximal extractable value attack or MEV. Here's an example of how it might work. Let's say you decide to buy a lot of some cryptocurrency. You send the transaction and it gets sent to the mempool. A bot may see this transaction pending in the

mele. They then add a transaction that buys crypto right before you. They do this by sending it with a higher gas fee, which we're going to talk about in a future lesson. It's like paying more for a VIP ticket. This then pushes the price of the cryptocurrency up. Your transaction then executes at a higher price for the cryptocurrency. The bot would then immediately sell their cryptocurrency at the peak for a profit. You end up paying more than you expected, and the bot makes money. It's actually completely legal, but is pretty unfair. It's like someone cutting in the line because they can run faster. and decentralized exchanges, which is what you use to buy and swap crypto, do have safeguards against these attacks. We're going to go into what a DEX is later in the next section of the course.

Sometimes the problem with blockchains isn't with the system itself. Sometimes it's actually the code that the nodes run. Blockchain software is written by humans and increasingly AI. And both humans and AI make mistakes. One of the most famous examples is in 2010. Someone found a bug that allowed them to create 184 billion coins out of nowhere. And Bitcoin, of course, is only supposed to have a maximum supply of 21 million. The community had to act fast. They fixed the bug and essentially rewound the blockchain to erase these faked coins.

These bugs are actually really scary because they allow us to do things that you otherwise wouldn't be able to do like create millions and billions worth of coins out of nowhere or do things like reverse transactions. And this is why changes to the protocol code, the code that the nodes are running to do the actions like proposing blocks etc. This is called the client code and it must go through extensive auditing and checks. Let's go through one more attack and this is replay attacks. We can have replay attacks in smart contract code, but we can also have replay attacks with blockchains. Let's just focus on the blockchain part for this lesson. Imagine someone signs a check and then someone else photocopies this check. That's essentially a replay attack. Reusing valid signatures or valid transactions in different

contexts. For example, using the same transaction on Ethereum and then using it on a different chain like Arbitum or Optimism or ZKYNC. And then they'd send that transaction again. And this actually can happen or used to be able to happen across different similar blockchains. If you sign a transaction on Ethereum, it could also be used on an Ethereum compatible chain. That is without the proper protections. This is why now we make transactions blockchain specific. And we do this by adding in the chain ID to the transaction information to make sure that it's only able to be used on that one blockchain with that one chain ID. For instance, one for Ethereum to stop the transaction being replayed on the same chain. This is why the transaction also includes a nons to make sure the same transaction with the same nons cannot be used again

on the same blockchain. We actually have a whole article breaking down replay attacks in detail on the siphon blog which I'm going to link in the resources section. Most of the attacks that we've talked about in this lesson are theoretically possible but completely impractical on most major networks. Why? Because it would cost way more to attack than you could possibly steal. To attack Bitcoin, you'd need billions of dollars worth of electricity. To attack Ethereum, you'd need to risk billions of dollars worth of ETH. And even if an attacker somehow succeeded, the community would never accept it. The other nodes would all just come together and build a different version of the blockchain that didn't contain the malicious block. This is called a hard fork and creates two distinct blockchains. The attacker would

have their own chain now, which would eventually be abandoned by the community. So you'd spend billions of dollars to attack the network, which eventually would be made worthless because no one would be using it anyway. It's like buying a company only to burn it down. So to summarize, blockchains don't make these attacks impossible, they make them completely irrational. The system is designed so that being honest is always more profitable than cheating. And as a user, understanding these concepts helps you to understand why confirmations are so important when you're sending a transaction on Bitcoin or proofof work blockchains and why major blockchains are considered secure, why newer, smaller blockchains with fewer nodes and fewer staked ETH or less computational power are considered riskier, and how the underlying

economics actually protect you. And in the next lesson, we're going to go into a little bit more about protocol changes. How do we change the underlying rules of the blockchain? How did Ethereum switch from proof of work to proof of stake? And what are these hard forks that we talked about? [music] So, we know that a blockchain is decentralized and immutable, but what about if we need to change the way things work? What if we want to upgrade the blockchain? How does Ethereum upgrade itself with no central authority to control things? Or when the community disagrees or the changes go wrong, what actually happens? In this lesson, we are going to be going through exactly that.

Ethereum protocol upgrades and hard forks. We'll explain what they are, what happens, how they work, and most importantly, what you actually need to know if you want to get a job in blockchain. A blockchain or protocol upgrade is a coordinated change to the rules that govern how Ethereum works. You can think of it the same as updating your phone's operating system, except that in the blockchain, there's no company controlling the upgrade. Instead, of course, all the network participants need to agree to implement it. The things that protocol upgrades can change include how transactions are processed, the gas fee mechanisms, like when we learned about the changes from the types of transactions, the consensus mechanism such as when Ethereum moved

from proof of work to proof ofstake based consensus, the capabilities of a smart contract, and different security features. And the crazy part here is that all of these changes happen while the network is still running. So, what about a hard fork? What's that? Ethereum upgrades are implemented using hard forks. A hard fork is a change to the protocol that isn't backwards compatible. The old nodes need to upgrade their software as they won't be able to validate the new blocks under the new rules. And here's how these protocol upgrades, these hard forks work. Firstly, the community agrees to the changes. Everyone agrees on a predetermined block at which everything is going to change. And in general, we follow with a single chain following these new rules. Examples of such

changes include the merge where Ethereum moved from proof of work to proof of stake. The London upgrade was where we introduced these type 2 transactions with that fee burning mechanism that made ETH deflationary and changing how we structured the gas fees and Cancun which enabled scalability and layer 2 which we're going to talk about shortly. But sometimes the community also disagrees to the changes and this can result in a permanent split in the chain such as the DAO fork in 2016. In 2016, an hacker attacked the DAO, which was a smart contract, and they stole around $150 million worth of ETH, and the community were kind of split as to whether to reverse the attack because of decentralization and credible neutrality permissionless immutable.

Lots of people thought the transaction should not be reversed. However, a load of other people also said this was a malicious attack. It wasn't fair and therefore we should reverse it. The majority ended up supporting the reverse and that is Ethereum today which does not include this malicious transaction and the minority actually continued on the original chain and this is called Ethereum Classic and both actually still exist today. Hard forks are just Ethereum's ultimate defense mechanism. If someone successfully gained a control of a majority of the staked ETH, the community just wouldn't accept it.

Instead, they communicate offchain and coordinate together to reverse the transaction and agree on a block to continue from before the attack happened. They would then create a fork and abandon the old chain with the malicious block. The attacker would then control a chain that no one actually was using. But how do these upgrades actually happen? Everything with an upgrade starts with an EIP, which stands for an Ethereum improvement proposal. This is a technical document that specifies the proposed changes to Ethereum. anyone can actually create these EIPs and it goes through stages.

First, it's drafted, then it's in review. It moves to a last call and then it becomes final once everyone has agreed that they want to accept the changes. This process can take months or even years. But once it is accepted, multiple independent teams who actually write the code that the nodes run. So the nodes themselves are running code to do all of their consensus stuff like proposing blocks, validating, the testing, all of that. That is all code that they are running and teams exist that write the code like GU or nethermind and they need to actually implement these changes proposed in the EIPs. Interestingly, they are all written in different programming languages and this prevents a bug in one of the code braces breaking the entire

chain. Then the changes are tested on testnet and the core Ethereum developers set a specific block for mainet activation giving the operators two to four weeks to update their software. The updated nodes would then follow these new rules and the non-updated nodes would get left behind. So let's talk about all the different participants who are in this process of creating upgrades to the protocol. First we have these core Ethereum developers. These core developers are the ones writing the code that the node operators actually run. Then we have the node operators.

Effectively these are the real decision makers. They choose whether they want to run the software or not and collectively will determine the network rules. Then we have the application developers who are writing smart contracts etc. They'll provide feedback on all of the changes and whether things are running smoothly. Then we have all of the blockchain users and they ultimately get to vote using their wallet by whether they continue to interact with the network or not. So now you can understand from a high level a little bit about how these protocol upgrades happen and how we can evolve Ethereum without needing a central control. When coordination succeeds, we can get seamless improvements like cheaper transactions or better security.

But when people disagree, we can actually end up with two versions of history via these two different forks. And a fork is just when the blockchain splits. And there are two different versions of history. In the next lesson, we're going to talk a little bit more about EIPs and also something called ERC's because I think these are two things which are very important to understand what they are if you're going to go and get a job in the blockchain industry. and it was something that I found a little bit confusing when I started out. Two acronyms that you're going to hear a lot in the blockchain industry are EIP and ERC's. When I first started learning, I got so confused between the difference and what the hell was going on. And in this lesson, we are going to cover just that. So, when you join your

first meetings and you hear these terms, you are not confused. Let's start with EIPs. EIP stands for Ethereum improvement proposal. And we've covered this very briefly in the previous lesson. EIP are like a formal suggestion for how to improve or change the Ethereum network. They're like the blueprint that describes new features, new processes, or new standards that could improve or make Ethereum better. And actually, anyone can write an EIP. Developers, researchers, or even regular users. If you have a good idea, you can write one. Let's follow an EIP through its stages and how they're created and then how it's eventually implemented.

Initially, it's in the draft stage. This is when someone is actually writing it. Someone has an idea. They write up their proposal with technical specifications and they submit it as a draft EIP. It then moves into review. The Ethereum community, so the developers, the researchers, the users review the proposal. Is it technically feasible? Does it solve a real problem? Does it break existing applications? Does it have any security implications? If the proposal gains support, it enters last call. This is like a final review period where any remaining concerns are addressed. Once it's approved, the EIP becomes final. It's now an official Ethereum standard that developers can implement. And if they are something called a core EIP, which is a protocol level change to Ethereum that would

require a hard fork, the EIP is considered final when it is implemented on mainet. There are actually other types of EIPs other than core like networking which concerns how the nodes communicate with each other. Interface which standardizes how applications interact or interface with Ethereum meta which actually changes how the EIP process works itself. Informational and finally ERC which we're going to go into in a second. Don't worry about all these different types of EIPs. You can read up on the different types at EIP.ethereum.org.

And we actually also have a blog on the Siphon website where you can read all about EIPs. Let's go into ERC's now. ERC stands for Ethereum request for comment and they are a type of EIP. ERC's proposed standards for how applications on Ethereum should work together. An EIP is like any improvement to Ethereum. Whereas an ERC is specifically how do we ensure compatibility between applications. Think of it a bit like how all squares are rectangles but not all rectangles are squares. All ERC's are EIPs, but not all EIPs are ERC's. But why do we need the ERC's? Why do we need standards? Without these standards, the blockchain world will become a little bit chaotic to interact with. For instance, how does MetaMask know how to

display the information for different tokens written by different developers? How do you trade tokens that all work a little bit differently? How do NFT marketplaces like Open Seed display the NFT information? So, we create standards so that they all work the same. Let's go into some examples. ERC20, ERC1 1155 and ERC 721 are all different types of token standard. We're going to go into these token standards in the next section of this course when we go through blockchain applications. We also have ERC165 which is for standard interface detection. It's how a smart contract announces which standards it implements so the other smart contracts know how to interact with it. We also have ERC 4626 which is tokenized vaults and

standardizes how yield generating vaults work in decentralized finance or defy and that makes it easier for applications to interact with them and integrate with them. And then we also have ERC 712 which standardizes Ethereum signed messages and includes fields to prevent replay attacks, prevent someone taking this signed message and using it in a different context. Unlike traditional industries where standards are set by committees or big corporations, anyone can come and improve the blockchain by submitting an EIP. And in the next lesson, we're going to be looking at a very important EIP and that is EIP559.

And this changed how gas fees worked on Ethereum. Now that we know how blockchains work under the hood, we know what ERC's and EIPs are. Let's take a little dive and look under the hood at transactions specifically, how they work, how gas works, how they actually get added to the blockchain. [clears throat] For this lesson and subsequent lessons, we are going to focus specifically on Ethereum and proof of stake, unless we specify otherwise. In this lesson specifically, we're going to focus on gas. Gas and gas fees can be a little bit complicated to understand initially, so don't worry if you find this lesson a little bit confusing. We are going to be going through some real world examples.

So hopefully it should all start to make a little bit of sense. But if you take one thing away from this lesson, I want it to be this. The more usage there is on a blockchain, the more people that there are sending transactions, the more expensive it's going to be. Why do we need gas fees? So in the previous section with Jess, we learned that we need these gas fees to pay for our transactions. This of course makes sense because we need to pay the validators for the computation they did to execute our transaction and actually add it to the blockchain to produce the block. Gas fees also prevent someone from spamming the network. Without any fees, attackers could send millions of transactions filling up all of the block space and preventing anyone else from sending a transaction. Not particularly ideal.

Remember in section two we described Ethereum as a cheering complete virtual machine except for one caveat. As a reminder, Turing completeness just means that with unlimited computational power, it can solve any problem that a computer can solve. The caveat, of course, is that for Athereum, the computational power is not unlimited. It's limited by these gas fees. Anyway, not important to understand. That was just a little side tangent because I find it interesting. Don't worry at all if that meant nothing to you. Let's take a look at gas. You can think of gas as like fuel for your car. Just as your car needs gas to run, Ethereum needs gas to execute your transactions. gas pay for computational work on the blockchain. Even though our chain is proof of stake, we still need

to perform some work to actually execute the transactions to change the state of the blockchain. And gas is just simply a measure of this computational work that is executed. But what actually is a transaction? A transaction is just the instruction that a user sends and it dictates the action that they want to execute to interact with the blockchain. For example, a transaction could say, I want to send 10 ETH to Patrick. And the transaction would need to contain the following information. Patrick's address, who is the transaction being sent to? The action I want to perform, send ETH to Patrick. The value 10, and the associated gas fees. The transaction is initiated from my wallet, like MetaMask, from my account, exactly as you did in the previous section with Jess. Let's take a look at these gas

fees and how we specify them. Gas fees change all of the time. If we look on siphon.tools, tools, you can see that the gas price per unit computation for different chains is changing all of the time. But why does it need to change? Why isn't there just a standard price? The answer lies in demand. A block can only contain a certain number of transactions. It's like a bus with only a limited number of seats. Once the seats on the bus are full, no other person can jump on the bus. Once the block is full, no more transactions can be included. You can also imagine that the bus driver is more likely to have the people on the bus who pay more to be there. And this would leave the ones who paid less on the side of the road unable to get on the bus. This is kind of the

same as blocks on Ethereum. But here's the problem. In the early days, this created chaos. These are type0ero transactions. There are actually different types of transactions like these type zero transactions I was just talking about. And the type of the transaction defines the different fields in the transaction itself. You can think of these different types of transactions a bit like the evolution of email. We started with plain text emails. Then we added HTML so that we had some formatting. You could add in images and things like that. Now we have full advanced features in email and advanced formatting. Each maintained compatibility with the old one while adding new features. We started with type zero transactions and these are legacy transactions. They still work but they are very outdated. Here's what the structure looked like. Notice that you

specify the gas price which is the price per unit gas computational work and then also a gas limit which is the maximum number of units of gas that you're willing to spend. This is a measure of the computational effort. Then eventually the gas that you pay will be the gas used which will be less than the gas limit times the gas price that you specified. You bid once for this gas price and just have to hope for the best. Let's go back to our bus analogy. Once everyone in the queue makes a bid for a seat, the highest price biders get to enter the bus. This is the same as with transactions. You had to guess the price. You often overpaid because you guessed that other people were also going to pay a high price. Or if you paid too low, your transaction wouldn't ever be included. The problem was that

during busy busy times, gas prices would peak extremely high. Lots of users got stuck because they underpaid. It's a bit like trying to get a taxi during rush hour. Next, we had type one transactions. We're not going to focus very much here because they're not particularly relevant. They were very similar to type zero except they added the concept of an access list which allowed you to prespecify what data you were going to be accessing. It just decreased these gas fees a little bit, but they were very quickly overshadowed by type two transactions, which is where we're now going to focus. Type two transactions changed how these gas fees were structured to make things a little more logical. Let's go back to our bus analogy for a final time. What if there was a way to guarantee that everyone was going to get a seat by introducing a

minimum bus ticket? If anyone wanted to tip the driver, they could of course jump the queue. This is exactly what type two transactions and they change this minimum amount for the bus ticket depending on the number of people in the queue. Type two transactions were introduced by EIP1559 and it changed the way that we split these gas fees and we split that into a base and a priority fee. This is like the minimum bus seat price plus an additional optional tip. Let's go into the different components. First of all, we have the base fee. This guarantees you a spot on the blockchain. It is adjusted automatically based on the demand. So, the number of transactions being spent. Ethereum aims to keep blocks 50% full. If the block is more than 50% full, the base fee will

increase. If the block is less than 50% full, the base fee will decrease. At any one time though, the base fee is the same for everybody. When a transaction gets included in the block, the base fee gets burned. It gets destroyed forever. Next, we have the priority fee. And this is like the tip to the node operators. It allows your transaction to be included sooner. It allows you to jump the queue. This tip goes to the validator itself. And you can choose how much priority fee you're going to pay. So, why is this system better? It makes the fees more predictable. It meant that you don't have to overpay anymore because you're not blindly guessing. You know that if you pay the base fee, your transaction will eventually be included and this allows for a better user experience because your wallet can more

accurately estimate the fees required. There are also type three and type four transactions, but these are a little bit more complicated and so not going to be a topic for this lesson. Most of the time when you're sending transactions at the moment of recording, they are going to be type two transactions. Let's look back at our real transaction, have a look at Ether Scan and see how these fees are working in real time. Let's look at our real transaction that we made with Jess on Etherscan to see this in action. So, if we head to the Sapolia etherscan.io/tx/ and then the transaction hash for the transaction that you sent. Jess has already been through this a little bit about what this transaction fee is and what this gas price is. So, this transaction fee is the total amount that

we spent on the transaction, the price per unit of computation times the amount of gas used. This is the amount of gas that we spent to send our transaction. Now, we can actually click this click to show more button to see a more granular breakdown and we're going to go through all of this information. So, right down the bottom here under other attributes, you'll see that the transaction type is of type zero or EIP1559. This is what we just learned about. We know now that we're going to have a base fee and a priority fee, which actually you can see right here. So first of all we have this gas limit and gas usage by transaction. This means we said I am okay to use up to 21,000 units of gas and that is the maximum that I am

willing to spend. And then the second number here is the actual number of units that were actually spent. So here we can see we used 100% of the gas limit that we specified. These numbers have no units because they're just measured in units of gas. This is just the number of units that we are willing to spend. Most of the time, this gas limit is calculated manually for you by MetaMask or whatever wallet you're using. Although you can turn on advanced configurations that you can set it yourself, but in for most instances, you're not going to need to do that. Let's look now at these gas fees. So, this base, this is just that minimum gas price we talked about that gets burned.

And it's measured here, as you can see, in something called guay. Let's understand what this is. Before we continue, we need to understand Ethereum's native token units. Just like dollars have cents, Ethereum also has smaller units. And actually, we can visualize this and do all of the conversions between the units at tools.sciphin.io, where you've got lots of different helpful tools that you'll probably get used to using. So, if we click on the way converter, you can enter one ETH and it will convert to you how many guay that is and then how many way that is. You can think of guay and we as just like a more granular version of ETH to deal with smaller units. So we can see that one ETH is one with nine zeros gay.

It's also equal to one with 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 zeros in zeros. We guay are just a fraction of ETH. This is exactly the same as saying that for every 1 kilometer there are 1,000 meters and 100,000 cm and 1 million mm. It's exactly the same principle but for units of ether. Let's say our gas price was 40 gay. This is 04 ETH. We wouldn't want to say that.

Instead, we say 40 GU. So, let's head back to our transaction. Now, if we look back on Ether Scan, we can see that our base fee is 0.008 0008 guay or 0 point with lots of zero 859 blah blah ETH. Next we have max. This is the maximum total fee that we said that we were willing to spend for our transaction. So the base fee plus the priority fee. Now if we did a calculation, we added up this number and this number. This number, the max priority fee would be a little bit higher. And why is that? So when you set the max fee, you're essentially saying I'm willing to pay up to this amount. And this includes a buffer for in case the base fee increases while you're waiting for your transaction to be included. It also

includes the tip, so the priority fee, but you only end up paying for what you actually needed. The rest gets refunded. And remember, all of these are measured in per unit gas. So when we actually calculate the transaction fee is of course the gas price that we ended up using times the gas used. So then of course we have the max priority. This is that maximum tip that we said we were willing to spend. Then we can also see how much ETH was actually burned. And this is calculated as the base fee times the number of gas used. So we open up our calculator and then times that by the number of gas used, which is 21,000.

We'll see this is 180.558 guay. Then you'll see that this number is the same as the number which is burnt just with the conversion from guay to ETH. So that amount of ETH was actually burnt because of course the base portion of the fee is burnt is taken out of supply. So the gas burned is the base fee times the number of gas that we used. This means that whenever you send a transaction of course a little bit of the ETH is removed from circulation forever. And this is exactly what burning is. And then the other part of course goes to the validators. Let's figure out exactly how much went to the validators. So if we take the amount that we actually spent. So, this number up here. And I'm actually going to open

up a calculator in a tab just to make it a little easier. And I'm going to take away the amount that we actually burnt, which is the base fee. Well, it's the base fee times the amount used. And then I'm going to minus that. And here we have 3.15 * 10us 5 in e. This amount of guay here is the total amount that we spent to send to the validator. So now if we take this number 31500 0 31500 0 and we divide it by the number of gas used, you'll see that we get 1.5, which is exactly the amount that we specified that we wanted to pay for our priority fee. Now we can actually set all of these pieces of data ourselves.

So if we head back up into MetaMask and we pretend that we're going to send Ether to someone. Let's say I choose my other account. This is of course a dummy account. enter the amount that we want to send. Let's say 0.1 ETH on Sapolia. Click continue. Then you can actually set these values yourself. So if we click this little pencil by the network fee, then we can choose which fee we want to pay. So low, market, and aggressive. And this would be the max fee that we are specifying. So the base fee plus the priority fee plus a little buffer in case the base fee increases by the time we actually include the transaction. And we can actually hit advanced, which means that we can specify the max base fee that we want to spend, the max priority fee that we want

to spend, and we can also edit the gas limit. So this is the maximum number of units of gas that we want to spend. For sending ETH directly, it's always just going to be 21,000. We can specify the exact base fee, so the V per unit gas we want to spend and the max fee that we want to send to the validators to include our transaction more quickly. And this is of course again measured in guay per units of gas. And then if your max base fee that you specify is higher than the base fee that you end up paying, you get refunded the difference. So gas fees are a little bit complicated. So if you feel confused, don't worry. I found it super confusing too when I was first starting. And in this lesson, we learned about the different types of transactions, how gas

fees are specified, how type two transactions are split into the base and priority fee, and how the base fee adjusts based on the demand. If the cost of your transaction is less than the maximum that you specify, you get refunded the difference. And most importantly, the more usage there is on the blockchain, the more it will cost to send your transaction. Let's now quickly go through what happens when you actually send a transaction. What is the life cycle of this transaction? Let's look at the journey for an Ethereum transaction from the moment that you click send in your wallet to the moment it becomes permanent on the blockchain. When a transaction is sent to the blockchain, the state of the blockchain is altered. When we refer to the state, we purely mean the

information that is stored on the blockchain. If I send Patrick one ETH, my account should be debited by one ETH and his should be increased by one ETH. Our different balances are the state of the blockchain. Any information changes on the blockchain are alterations to the state. When someone sends a transaction, they are altering the state of the blockchain and all nodes in the system need to be updated with this state change. Let's go through how this works step by step. First of course, we create the transaction. This happens automatically in your wallet like MetaMask. And here lots of different fields are populated by your wallet. For instance, this is the chain ID. This prevents the transaction being used on a different chain. For example, one for Ethereum mainet, 111 55511

for Sapoleia. Then we have the nons which prevents this transaction being sent again on the same chain. Non stands for number used once. Then we have our gas related parameters. We have our max priority fee per gas, the maximum amount of tip that we're willing to send, the max fee per gas, so the maximum base fee plus the priority fee, and the gas limit. How many units of gas are we willing to spend? Then we have some transaction specific information like the two address, the amount of value we wish to send, the data for instance if we're calling a smart contract, the function that we want to call and any parameters are part of this data and the access list which is from type one transactions. Don't worry about that.

Next, we need to sign this transaction. So we take all of that transaction data, we put it in a standard format that Ethereum can understand, and then we hash it. And this resulting hash is called our transaction hash. And this is what we use to look up our transaction on Etherscan. It uniquely identifies your transaction. Then we sign this transaction to authorize it to say yes, I own this account and yes, I want to do this action. The nodes can then prove that this transaction did in fact come from you. Your wallet then shares it with the Ethereum network. This is called broadcasting and it happens through something called an RPC endpoint. If you look inside MetaMask, you can actually see the RPC endpoint.

And this is like the URL that allows your wallet to send transactions to Ethereum nodes. It's a bit like a telephone line that we can like call up the nodes and tell them that we want to send this transaction. When your nodes receive it, they then perform validation checks. If any of the checks fails, the nodes then reject the transaction. If it passes all of the checks, it then enters the mempool. This is short for memory pool. It's like the waiting room where transactions sit and wait to be included in a block. Each node maintains its own mem pool where they constantly share transactions through peer-to-peer networking. The validators then look all the transactions in the pool and decide which ones to include, probably the ones with the highest priority fee. The block producer then orders their selected transactions, validates them, so checking all the signatures, checks the

gas limit, the nons. It then executes all of these transactions to create the updated state. It then creates the block hash by hashing together all of the data and signs the block to lock it all in. They then propose this block to the network. The other nodes in the committee, so a subsection of all of the nodes, then attest to the block. They re-execute all of the transactions to check the state changes. They verify all the signatures. So the block produces signature and then also all the transaction signatures. And if twothirds of the stake agree, then the block is added to the blockchain. If after each epoch, the block is considered justified and then final. So of all of the nodes in the network, they all agree or twothirds of all of the staked ETH agree not just in the committee but all of the

validators agree that the block is finally considered final and so is your transaction. So through this different process your transaction itself goes through different stages. Initially when it's in the meool it's considered pending. When it's in the block but not finalized it's considered confirmed. When it's irreversible it's final. If it gets removed from the memp pool, if your gas price is too low or you send another transaction with the same nons, it's called dropped. And if it executed but failed, it's called reverted. And we can actually see this status in ether scan. And this happens in about 12 seconds for inclusion. And then about 12 to 16 minutes, so two epochs for finalization.

And that is the life cycle of our transaction. And now we've got lessons about Ethereum accounts. We have looked a little bit at Ethereum accounts. So, our public and private key, which are managed by a wallet like MetaMask, but there's actually another sneaky type of account. And you may have heard this before because it's a little bit of a buzz word, and that is smart contract accounts, which are enabled via account abstraction, and that is the topic for the next lesson. We are finally on to the final lesson of this section. I know it's been a big one, but just hold your horses because this is quite an exciting lesson, and this is account abstraction. Blockchains are still reasonably hard to use. I mean, I know we interacted with them in the previous section. It wasn't too difficult. Even still, there are still some hiccups. We still need to have some

funds to be able to interact with the blockchain. We lose access to our wallet. There's no customer service. There's no recovery mechanism. If someone has your private key, they can use your account. The end. All your funds are compromised. The solution to this is account abstraction. And by the end of this, you'll understand how this does, in fact, make things easier. It makes blockchains a lot more accessible, even your grandma. And speaking of grandma, getting your grandma into crypto is a little bit of a meme. It's kind of like an in joke. It's like why we need better UX so you can get your grandma into crypto. It's something we all say. It's a bit of a cliche now. So, I just want to let you know you're part of the club as well. But anyway, let's first look at the different types of Ethereum accounts. On Ethereum, we have

two types of accounts. The first we have used already, and this is something called an externallyowned account or EOA. And this is what you've been using for the entire course so far, your MetaMask. It's controlled by a private key and can initiate transactions. Your account is identified by your public address which is derived from your private key. We also have another type of account called smart contract accounts. These are accounts which are of course controlled by smart contracts. In fact, they are smart contracts themselves. The logic of the account is dictated by the code of this smart contract. And the address of this smart contract is how the account can be called. For instance, if I wanted to send an account some funds, I would use this smart contract address. They can hold funds. They can have programmable logic. For instance, when you want to

send a transaction, maybe it requires multiple different signers so that if one of the accounts get compromised, it doesn't matter. But the key thing is that they only respond when called by an EOA. This creates a problem. Only EOAs can initiate transactions. Smart contract accounts just sit there dormant until an EOA activates them. EOAs have the power to initiate transactions, but they are not programmable. Smart contract accounts are programmable but no power to initiate transactions. The solution to this is account abstraction. Account abstraction is the idea that we should abstract away the differences between these two accounts. It enables us to use smart contract accounts as our main account. We can create a system where the smart contracts can be programmed but also can be used to

initiate transactions. This makes these smart contract accounts controlled by smart wallets actually usable without requiring an EOA to interact with them. Your smart wallet is a smart contract that you yourself control. And this allows you to have things like custom authentication logic, account recovery, spending limits, anything that you can program in code. These smart wallets have the programmability of smart contracts, and the functionality of an EOA. Let's look at how it solves some of the problems with blockchains and EOAs. With EOS, your private key is everything. Lose it and you lose access to your account. If someone accesses your private key, they can access your account. There's no recovery mechanism.

No, forgot your password button. It's like having a safe with no backup key. With smart wallets, you can program guardians, trusted friends or family members, or even other devices. You can have a system where if three of these guardians sign a message, they can unlock your account. No single person can come along and steal your funds, but they can help you recover it. With EOAs, you of course need to have fees in your wallet initially to be able to send transactions and pay for gas fees. It's like someone giving you a gift card, but then saying you need to buy some special stamps first in order to be able to use it. With smart wallets, you can set up something called pay masters, where these are special services that will actually pay for the gas fees for you.

And these are things like subscription services that you can sign up to. And they handle the gas fees automatically without you having to hold it in your account. And this abstracts away all of the complexities of gas fees. With EOAs, you have to sign every single transaction. Every single step that you want to take on the blockchain has to be an individual transaction that needs to be signed. Let's say you're playing a blockchain game. Every time you want to do anything in the game, buy an in-game item, unlock an achievement. I'm not a gamer, so I don't know, but you have to sign a transaction every single time, and this will interrupt the game flow.

Instead, with smart wallets, you can actually batch transactions together. You could swap tokens and stake them all in one click. You can do things that are pretty cool like session keys where an EOA is created only temporarily where it will only have access to your smart wallet for one hour or the duration of your game. With EOAs, you sign a transaction once and if you didn't validate the data properly, if you didn't check that this transaction was legitimate, you could lose access to all of your funds. With smart wallets, you can require multiple transactions where multiple people would have to verify the transaction to check that it's all okay to make sure that you safeguard your funds. But how does this all actually work? The current implementation is specified in EIP4337.

And this adds account abstraction to Ethereum without actually having to change how Ethereum works. Instead of sending transactions to Ethereum, you create what's called user operations. And these are like very special account abstraction transactions. And instead of sending them directly to the nodes, you send them to some very special nodes called bundlers. And they're just like specialized versions of validators that know how to handle these user operations. Instead of sending your user operations to the memp pool, you send them to an altme poolool. This is like again a waiting room for transactions except it's a waiting room for user operations. The bundlers then package these user operations together and send them to Ethereum by a smart contract called the entry point contract. And then Ethereum is able to process these

user operations via the entry point contract as usual. and then it gets added to the blockchain, finalized, and your action is executed and included. Don't worry if that's a little bit confusing. To be honest, account abstraction is confusing. All that you really need to understand is that the system works pretty much exactly the same. It's slightly modified and it just uses a separate but very similar system. Instead of having transactions, we have user operations. Instead of having validators, we have specialized bundlers. Instead of having a mempool, we have an altmpool. Instead of sending them directly to the blockchain, we send them via the entry point contract. Let's go through some smart wallet examples that use account abstraction already.

The most famous is safe, but there's also Argent. And both of them allow you to do things like set up social recovery. Don't require you to store seed phrases or anything like that. Developers are also able to build smart wallets using infrastructure providers like Bconomy, Alchemy, and Pimlo. Account abstraction is the key to unlocking mainstream adoption. Rather than having to deal with gas fees, worry about losing your private key and signing every single transaction. Instead, account abstraction makes all of these things much, much easier. There's multiple recovery options, anything that you can program into code, invisible gas handling via pay masters, and batching of transactions to mean that you only have to click once to perform multiple different actions. And that is the end of our blockchain architecture section. I know that was a

lot, particularly this last lesson on account abstraction. To be honest, account abstraction is pretty complicated. So, if all of that made no sense to you, all that you really need to understand is that account abstraction allows us to use smart contracts as accounts rather than just our EOAs. If you'd like to read more, we do have an article on account abstraction on our Ciphin blog. And also, Patrick has made a very cool video on account abstraction if you'd like to understand it in a little bit more depth. I'm going to link both in the resources section of this course. The problem with account abstraction and using smart wallets is that it requires us to get a completely new wallet. We can't just use our MetaMask for instance. We have to get a completely new wallet, get used to a new UI, port over all of our funds, etc. to be able

to get the benefits of account abstraction, for example, requiring multiple signatures, batching transactions, etc. But what if there was a way for our EOA, so our MetaMask wallet, to behave like a smart wallet, but only for the duration of a single transaction? This is exactly what EIP7702 does and it's already built into MetaMask for you to use today. By the end of this lesson, you will understand what EIP7702 is, how it works, and how to enable these features in your wallet right now. So, first of all, what is EIP7702?

EIP7702 gives your regular EOA wallet superpowers. It allows your EOA to behave like a smart wallet for the duration of a transaction. You're able to keep your original smart wallet address. You don't need to port over any funds. Don't need to learn a new interface. But when you need the smart wallet features, your wallet is able to temporarily borrow them. But how does it work? Usually, when you send a transaction, you sign the transaction, the transaction executes based on Ethereum's rules, and then the state is modified, i.e. your balances are updated or whatever it is that your transaction did. Instead, with 7702, you delegate the execution of the transaction to some smart contract. Delegating just means

that you're letting the smart contract do the execution for you. You delegate the execution of the transaction to the smart contract code temporarily for the duration of the transaction. Let's go through this step by step. Before the transaction, your wallet is just an EOA. Then you sign a special message which says that I want to use this special smart contract to execute my transaction. During the transaction, your EOA can then act like it has the superpowers of this smart contract by delegating its execution there. After the transaction, your wallet is still as it was before. It doesn't have the superpowers of this smart contract anymore. It only persisted for the duration of the transaction itself.

Let's go through an example. Let's say you wanted to swap some tokens and then send ETH to a friend in one go without EIP7702. First, you'd have to approve the token swap. Then you'd have to execute the swap, then you'd send the ETH to your friend. So that would mean sending three different transactions, three lots of gas fees, three clicks, and it's totally annoying and laborious. But with EIP7702, you can instead delegate to a batch transaction smart contract. You then just send one transaction that does all three actions, one click rather than three. EIP7702 defines a new type of transactions. As we said before in a previous lesson,

there are different types of transactions. As a recap, we've got type zero, which is legacy transactions. Type one, which introduced the concept of an access list. Type two, which we spent a bit of time talking about, which had better gas fee handling. Type three we haven't touched on at all, but these are called blob transactions, and they just make things really cheap by compressing transaction information down into something called a blob. We're not going to touch on this. However, I will link in the resources a link to type 3 transactions if you would like to know more. And then now we have type four transactions. These EIP7702 transactions. When you want to use EIP7702, your wallet will create these type four transactions, which will include the

smart contract code that you want to delegate execution to. It's like a special envelope that tells Ethereum, hey, for this transaction only, I want to use this smart contract code to tell you how to execute my transaction rather than just acting like a usual EOA. But for you, the users, all of this is abstracted away. Your wallet will handle all of the complexity for you. And that is because MetaMask has this builtin for you to use already and they've made it incredibly userfriendly. Let's look how to enable temporary smart wallet capabilities by EIP7702 and enable us to send type 4 transactions in MetaMask. So MetaMask have already written this smart contract that they're going to delegate execution to. This is a hardcoded smart contract

that handles common use cases like batching transactions, flexible gas payments, smoother security, etc. Since MetaMask have hardcoded this smart contract, you don't need to worry about writing it yourself. They've handled everything for you, and you don't need to worry about the security. They've done all the technical heavy lifting and have just packaged it into a feature that just works. This also means that you're safeguarded against someone trying to get you to sign a type 4 transaction that calls some arbitrary smart contract code. That would be pretty risky business and we don't want that. So when you enable these features, MetaMask will automatically use their pre-built smart contract. So how do we enable this in MetaMask? First of all, make sure that your plug-in is the most up-to-date version. Then click the three

parallel lines. Click on the little cog settings. Then click advanced. Then if you scroll down, you can see smart transactions. Toggle this to on. You can also see how you could learn more if you want to understand a little bit more about their pre-built smart contract that we are going to be delegating to when we send type transactions. Note that MetaMask might update their UI. This exact process might change slightly, but make sure that you're looking for anything like smart transactions, enhanced features, something like that. Feel free to also just turn this off, but if you have this on, you'll also notice fewer pop-ups.

flexible gas options and smoother interactions. And all of this works completely invisibly. EIP7702 is bridging the gap to better UX so that it is much easier for you to use blockchain technology today. While full account abstraction requires us to use different wallets, EIP7702 allows everyone to get some of the benefits of smart wallets for the duration of a single transaction in your existing EOA. In the next section, we're going to take a little change of pace. So, if this complicated, overwhelming technical section was just a little bit too much for you, then hold tight because the next one is on blockchain use cases and we're going to go into things like tokens, DeFi, exchanges, NFTts, stable coins, RWA, just to name a

few. This is going to be a super fun section. So, have a little break, let that all digest. Don't worry if you're a bit confused. Just go get a snack, go get an ice cream, go to the gym, come back when you're refreshed, and we'll see how we can use blockchain today to unlock some really cool use cases. In this section, we are going to be looking at some use cases of blockchains and smart contracts. What are people actually doing today? How is it actually being used in the real world? After the craziness that was the last section where we were talking all about blockchain architecture, how things worked, and it was a little bit complicated to be honest, we're going to chill out. calm down and just talk about something that I think is pretty interesting. I mean, I do kind of like the blockchain architecture stuff. I

won't lie. But I do think that this is a little change of pace. So hopefully things should be a little bit more chilled, a little bit easier to digest. So I hope you feel refreshed after that hefty hefty section. And let's get started. So in this section we are going to be covering DeFi. What is the world of DeFi? What can you do with DeFi? What is happening today? tokens, all the different types of tokens, fungeible and nonfgeible tokens like NFTs, stable coins, real world assets or RWAs, governance, Dows, and more. So, that was just a quick intro to this section. And in the next lesson, we are going to be talking about the world of DeFi.

What if I told you you could lend money to strangers around the world and earn interest on the money that you lent without having to trust them? What if you could take out a loan within seconds without having to fill out a load of paperwork or having to wait for approval? What if you could trade any asset 24/7 without a broker coming in and taking a massive cut? This is exactly what decentralized finance or DeFi as we call it achieves. DeFi is one of the biggest and most successful use cases of blockchains today. And in this lesson, we are going to be learning all about DeFi, what it is, and what it allows you to do. If you don't know too much about traditional finance and things like lending and borrowing, interest, collateral, terms like this, this lesson might be a little bit

confusing to you. But if you already understand what you can do in the traditional finance world, then this lesson might be a little bit more interesting. DeFi encompasses all of the protocols, all of the services and applications that allow you to interact with money in a decentralized way. It's a new financial system built from the ground up using blockchain technology and of course, smart contracts. In the blockchain industry, we refer to the world of traditional finance as tradfi. I actually found this acronym a little bit confusing at the start. So, I just wanted to clarify that. And this is everything that you're already used to. Banks, insurance companies, stock exchanges, brokers, and all of the institutions that control how money moves around the world. And DeFi can do pretty much anything that Trad can do.

But it leverages blockchain technology for decentralization, transparency, immutability. It's obviously permissionless and all of the benefits of blockchains. Instead of trusting the institutions, of course, you trust code. And as we've been saying all along, instead of trusting the banks not to freeze your assets to allow you to do what you actually want to do, you rely on smart contracts that execute deterministically. We need DeFi for all of the reasons that we've talked about in section two. Let me just go over them again very, very quickly to make sure that it's really drilled in there. Treadfi is of course permissioned. You need a bank account, which requires an address, identification, an approval.

Companies can deny you loans based on where you live, your credit history, or even your age. And not everybody has access to the same financial tools and opportunities. DeFi, on the other hand, is of course permissionless because it exists on the blockchain, and the blockchain is inherently permissionless. Tradfi is centralized. Banks can freeze your accounts, block your transactions, or change the rules whenever they like. And actually during the 2008 financial crisis, banks literally ran out of money and couldn't honor withdrawals. Your money isn't really yours when somebody else has access to it. In DeFi, it is of course decentralized. It's decentralized finance. It exists on the blockchain and the blockchain is decentralized. Tradfi is opaque. We have no idea what banks

are actually doing with our money. When you deposit your funds into a savings account, for instance, the bank just pulls everybody's money together and they use that to make loans. but you can't actually see their books and you can't actually verify that they really have your money that you need when you want to withdraw it. You're trusting the bank to not make excessive risk with your funds. You can't actually see what's going on. DeFi, on the other hand, is of course transparent because the blockchain is inherently transparent. DeFi applications or protocols are just smart contracts or systems of smart contracts that exist on the blockchain and they contain the logic for the financial services that they want to create. Examples include staking, trading, lending and borrowing, investing to name just a few. And since the logic is written into smart

contracts, the terms of how these applications function are baked into code. As we were saying in section two, if you meet the coded requirements, you get the loan. For instance, there's no human bias, no terms that can change, and no bureaucracy. Let's very quickly go through some examples of DeFi applications. First of all, decentralized exchanges. And we're actually going to have a whole lesson on decentralized exchanges later on in this section. Applications like unis swap and curve let you trade tokens for other tokens without having to use any central authority. You don't have to make an account. There's no KYC and there's no government restrictions. Next, we have lending and borrowing. Protocols like Ave and Compound let you lend your tokens to earn interest or borrow

against your crypto as collateral. Derivatives and trading platforms like GMX provide leveraged perpetual trading. Next, we have yield farming and liquidity mining. And this is where protocols reward users for providing liquidity or participating in their ecosystems. And then users will find all of these different applications and participate in as many different ecosystems as possible. There's also asset management platforms like Year Finance which automatically optimize your yield across different protocols using different strategies. And these different DeFi protocols are like Lego bricks. I can't tell you how many times I had to say Lego bricks. It said it wrong like a million times. And they can be combined together and built on top of each other. You might deposit your ETH into Ave and earn some interest. They'll

then give you an interestbearing token which you can then use as collateral in another protocol. Then you could provide that as liquidity to a decentralized exchange which would allow you to earn trading fees on top of your original lending yield. Don't worry if you don't know too much about traditional finance and all of these words I just said don't really mean too much to you. Essentially all I'm saying that there are so many different use cases in DeFi that you can get involved in today. And this is because DeFi is recreating the entire financial system with complete transparency accessibility and programmability that traditional finance simply cannot match. Now, I've said this word tokens a lot and we know a little bit about what tokens are. And DeFi revolves entirely around tokens. And they're actually more than just digital

money. They can be used for lots of different use cases. They are programmable assets that can represent things like currency, but also things like ownership rights, certificates, voting power, and access to different services. And they are crucial to DeFi. They are exactly what we are trading, what we're lending, what we're borrowing, what we're earning interest on. And so, in the next lesson, we're going to take a deep dive into tokens, into the different types, and what they are useful for. What actually are tokens and what are the different types? You might have heard of NFTts before. This is a type of token. Have you also heard of ERC20s?

Because they are also another type of token. But why do you really care? That's because they're really cool and they have lots of really cool use cases. And if you're going to get into the blockchain industry, you're going to be hearing about these tokens a lot. So, it's important to know. And that's exactly what we're going to be talking about in this lesson. Let's get started. So token is just a digital representation of value of some description or utility on the blockchain. They are just digital blockchain assets most of which are programmable that can represent anything from currencies to ownership rights, voting power or access to services and of course lots lots more. In general, tokens are managed by smart contracts with the caveat of native tokens and they tend to follow specific standards.

those ERC's that we were talking about in the previous section. As a little recap for you, ERC's just define the technical standards that specify how smart contracts should be written and how they should behave for a specific use case. And there are several different token ERC standards, which we're going to be going through in this lesson. There are several different categories of tokens, and each of them have slightly different use cases and benefits in the blockchain ecosystem. Let's go into each one. Starting with native tokens. We've already heard a little bit about these, but let's just go and have a little recap. Native tokens are not created by smart contracts. They are baked into the blockchain itself. And every blockchain network has its own native token. So,

just like Jess was saying, you can think of this like the network's official currency. Ethereum has ETH. And by the way, all the Ethereum L2s also have the native token of ETH. So, like Optimism, ZKYNC, Arbitum, etc., they all have ETH as well. So, it' be like Arbitum ETH, ZKYNC ETH, etc. This will make more sense in our scalability and L2's lesson later. So don't worry. Bitcoin has BTC, Salana has SOL and so on. But from now on, we are going to be focusing on the Ethereum ecosystem as we have done up until now in this course. But what are native tokens used for? We've kind of already seen this. Most importantly, they're just used as money within their ecosystem and they can be used to interact with protocols to do things like making payments, doing things like trading. They are also used to pay for

gas fees. Of course, anytime you interact with the blockchain, anytime you send a transaction, you have to pay these gas fees and that is paid in native tokens to pay for the computational work that you did. In proof ofstake blockchains like Ethereum, native tokens provide security via staking and some other networks also use the native tokens for governance. So, token holders have voting power to be able to vote on protocol upgrades and changes. The more tokens you hold, the more say you have in the protocol's future. And native tokens are a type of fungeable token. And this is the next category. Native tokens are digital assets that are interchangeable. Just like traditional money, my $1 bill has the same value as your $1 bill. If I give you my dollar and you give yours to

me, the value we now hold is still the same as we originally had. Each dollar bill is indistinguishable in value to another. So yes, native tokens are a type of fungeible token, but we can also create fungeible tokens using smart contracts. Most smart contractbased fungeible tokens follow the ERC20 standard. And by following this standard, it just ensures that they work seamlessly with different applications, wallets, and exchanges across the Ethereum ecosystem. We refer to these tokens simply as ERC20s. And this standard defines how to do things like transfer, how to get your balance, how to allow someone else to spend your tokens through something called an approval. And there are several different types of fungeible tokens.

There are stable coins like USDC. For these tokens, the value is fixed to some other asset like the dollar. We're actually going to be looking at stable coins later in this lesson. There's utility tokens that grant access to services. For example, link tokens pay for chain link services. It pays the node operators to provide your smart contract with real world data. There's governance tokens that provide voting rights in decentralized organizations or Dows, which we're going to be talking about in a different lesson. For example, UNI tokens allow users to vote on changes in the Unis swap protocol.

And there are reward tokens that can be earned through participation in protocols. For example, if you lent your tokens to a protocol, you could earn reward tokens for providing that liquidity. Some tokens can also serve multiple purposes. For example, those UNI tokens we were talking about do allow you to participate in governance, but they are also given as rewards for participating in the unis swap protocol. Fungeible tokens are divisible. So you could send like 5.5 tokens exactly. You could split payments upon multiple recipients. You can pull tokens together. And with smart contracts, they're of course completely programmable. So they could be automatically distributed, locked up for specific periods, or used as collateral for loans to name just a few things that

you could program them to do. Next, we have nonfgeable tokens or those mystical NFTts that everyone likes to talk about. NFTts are unique digital tokens. They have unique properties which means that they are not interchangeable. My NFT is different from your NFT. Therefore, if you give me yours and I give you mine, the value we hold after swapping is not the same as we had before. They're a bit like a digital certificate of authenticity that prove ownership of something unique. Every NFT has its own unique identifier or token ID, and this is what distinguishes it from all the other tokens. and the ID is permanently linked to that token's metadata. This metadata defines the NFT's properties.

Things like the name, the description, the image, attributes, rarity, and any other characteristics that you'd like. And this image in the metadata is what you might have heard of when they say, "Oh, they're just JPEGs." No, they're not because they are unique from each other using this token ID. NFTs are not divisible. You own either the whole token or you own none of it. NFTs are most often created and managed by smart contracts that follow the ERC 721 standard. And this of course defines the interface for doing actions like transferring, getting a balance, and how to create or mint and destroy or burn these tokens to do things like transferring, getting which token IDs a specific user owns, and the total supply

of NFTs in a contract. NFTs gained fame through digital artwork like crypto punks and board apes. And these types of digital collections allow artists to create digital ownership of oneofone artworks. But the applications of NFTs actually go way beyond just digital artwork. They are actually also used for things like ENS domains like Kira Nightingale. And these are like tags for your Ethereum address. So that ox blah blah blah. You can associate it with one of these ENS domains. And then this can be used to send you funds and identify you on the blockchain. And NFTTS are used to represent ownership of this web 3 address. NFTs are also used for in-game assets on the blockchain. Any

unique items like characters, unique skins or virtual land are just NFTs that you can own and then trade. And you can even take them outside of the game. NFTs just represent provable transferable ownership of digital and increasingly physical items. things like real estate even, but we're actually going to come back to just that in a little bit later in this lesson. The final type of token that we are going to cover is semifable tokens. And these represent one of many items where there are multiple copies of each of these token IDs. Think of it a bit like this. If NFTts are unique paintings where each painting is just one of a kind, semifundable tokens are like digital prints. There are many of each of the prints, but each of the

prints are actually unique from each other. So there are many different NFTs, each with their own token ID, but each token ID can have its own supply. In a smart contract, each semi fungeible token has its own token ID. But multiple tokens can exist for that one token ID. For instance, you could own five tokens of token ID 3. And the maximum supply of each token ID could be capped if you choose to do so. It's completely programmable. So if you wanted it to be unlimited, you could also do that. It's customizable. It's code, so you can code it to your use case. And all tokens with the same ID have the same metadata. So all of their properties, their name, their image, etc. is all the same. The ERC 1155 standard is what is most often used to create and manage semifungeable

tokens within a smart contract. But interestingly, this token standard can also be used to create non-f fungeible tokens just by limiting the supply of each token ID to one. But what would we use ERC 1155 semifable tokens for? Firstly, token gating. You could have different stages or levels of access where multiple people could access the same tier. You can imagine early access to an e-commerce drop where only people with the token ID of zero could access your site on the 1st of September and anyone with the token ID of one could access your site on the 10th of September. They can also be used for event ticketing. Many people can hold the same ticket to the same event with a capped supply where you have the regular seats but then you also have VIP entry

tickets where these tickets are now provably authentic and also transferable. They can be used for in-game items. For instance, there might be a thousand copies of the legendary sword, 50 healing potions, but each item is still individually owned and tradable. Back to e-commerce, you could also use tokenization representing ownership of the physical items in your shop, like 5,000 limited edition sneaker NFTts or trainers if you're from the UK. That felt very wrong to say. Each token would represent one pair and all pairs would share the same properties. They can also be used for things like academic credentials. You could create tamperproof diplomas or any kind of certification you like, like a driving certificate. Let's just recap the differences between these three types of

tokens. fungeible tokens, NFTts, and semifable tokens. Fungeible tokens are completely identical to each other. They are divisible and they are used for things like currency, utility tokens, and governance. NFTs are one of items that are unique to each other and can be used for things like employee IDs, specific contracts, or unique artworks. Semi-fundable tokens are one of many tokens and can be used for things like access passes, event tickets, product inventories, and certificates. These tokens can be used to represent things in the physical real world. And we've actually mentioned a few already in this lesson. Things like real estate. This is referred to as the tokenization of real world assets or just normally referred to as RWAS. RWAS represent physical or

traditional financial assets on the blockchain. And they are actually starting to be used already to bridge the gap between trad. And they are represented on the blockchain as tokens. And many different assets are starting to be represented on the blockchain as an RWA. Things like real estate, having provable ownership of your house as a real world asset on the blockchain. But why do we need RWA? As we already know, traditional assets already have massive inefficiencies. If you wanted to buy, for instance, US Treasury bonds, you'd need to go through a broker. You'd need to do so during market hours, and settlement would take a long time. If you would like to sell your house, this process takes an incredibly long amount of time. lots of paperwork,

intermediaries, and it often falls through. But what if you could trade Treasury bonds 24/7, just like crypto? What if you could sell a fraction of your house just as easily as sending a text? What if you could transfer some gold that's just sitting in a vault across the world without having to move a single bar? This is exactly what RWA's achieves. Let's go through some examples that already exist. Black Rockck, the world's largest asset manager, launched Bidd, a tokenized money market fund on Ethereum. Franklin Templeton has a tokenized US government money fund. Paxos has built tokenized gold, Paxos Gold, where each token represents one ounce in a vault. And there's already approximately $15 billion worth of tokenized real world assets on chain

today. And major banks are predicting this is going to hit the trillions in the next decade. So, it's really one to be watching out for at the moment. They are making traditionally illquid assets more accessible and tradable. And this is the key thing to understand about RWAS and why they are so important. Another really important use case of tokens is stable coins which we have mentioned a couple of times through this course. They are a type of cryptocurrency that is created to maintain a stable value relative to a reference asset like the US dollar. USDC for example should always equal $1.

Stable coins can do things like combine the relative stability of traditional currencies with the benefits of blockchains. You could send someone money at 3:00 a.m. on a Sunday without having to own a bank account to someone the other side of the world. You don't need a bank account. You just need an internet connection. And because it's on the blockchain, it's of course credibly neutral permissionless transparent immutable, decentralized. You can program stable coins into smart contracts for automatic payments. And every single transaction is visible on the blockchain. Let's talk about some use cases for stable coins.

International businesses are using them to pay for suppliers without having to deal with wire transfers. Freelancers are receiving payments from clients the other side of the world. In countries that experience high inflation, people are using stable coins to protect their savings from devaluation. There are a couple of different types of stable coins. I'm not going to go into this in loads and loads of detail cuz it's a little bit complex, but let's just go through it from a high level. The biggest ones like USDC and USDT are fiatbacked. So this means that for every US dollar which backs them, there is an actual US dollar that is sitting in the bank. Circle, the company behind USDC, publishes monthly attestations showing that they do have these dollars. It is

centralized, so circle could freeze your USDC if the government tells them to, but that is also why the institutions trust it. Then you have cryptobacked stable coins like D. Instead of having dollars in a bank, D is backed by cryptocurrencies locked in a smart contract. If you want some dye, you can lock up some ETH worth more than the dye you're receiving. This is called overcolateralized when you have to deposit more than you are getting back in value. Patrick actually has a really, really good lesson on this, which I'm going to link in the resources section of this course. These types of stable coins are decentralized, so no one can come in and freeze or die, but they can be a little bit more volatile during market crashes. And finally, we have algorithmic stable coins. I'm not going to say too much about these, but they

use market mechanisms to maintain their value relative to another asset. Beyond these financial applications, tokens, as we said, are used for multiple different things like gaming assets, token gating, ticketed events, certifications, digital artwork, owning real estate, and other RWAs, decentralized governance, and so much more. In DeFi specifically, these tokens work together to create interconnected systems just like we were talking about in the previous lesson. Let's zone in on ERC20s for a second. How do you actually get and own and trade these tokens? There are actually two options. You have centralized exchanges like Coinbase and Binance and decentralized exchanges like Curve and Unis swap that let you trade directly

from your wallet using smart contracts. The differences between centralized exchanges and decentralized exchanges is the topic of the next lesson. In the previous lesson, we learned all about the different types of tokens. Things like NFTts, semifable tokens, native tokens, and fungeible tokens. We're going to zone in on fungeible tokens for a second. So, ERC20s and native tokens. ERC20 tokens are funible tokens created by smart contracts. Native tokens are baked into the blockchain itself. It's the native currency of that blockchain. For instance, ETH for Ethereum, BTC for Bitcoin. How do we actually get these fungeible tokens? How do I swap my ETH for a stable coin like USDC? How do I

buy that governance token so I can participate in a vote? The answer to this is using an exchange. Exchanges generally fall into two categories, centralized exchanges or decentralized exchanges. And it's really important to understand their differences and when you should use them. Let's start with centralized exchanges. These exchanges work a bit like traditional stock brokers. Examples of centralized exchanges include companies like Coinbase and Binance. To use them, you need to create an account, go through KYC verification, where you have to provide identity documentations, and then you can deposit your funds into the platform. This is done via something called an on-ramp where you connect your bank account to the centralized exchange, and we're going to talk about

that in a second. Then you can use your money to buy these fungeible tokens. I could buy ETH. I could buy USDC or any ERC20 I like. And then when you want to buy or sell your tokens, you have to place an order that will get matched with another user's order via an order book system. The key thing I want you to understand here is that when your funds are on the centralized exchange, you don't actually control them. The exchange does. You're actually just going to have to trust them that they're going to hold your tokens safe and let you withdraw when you want to. And this is because under the hood, your assets are being stored in a wallet that the exchange controls. They have the private key. And we actually have a phrase for this. We say not your keys, not your coins. You don't actually hold the

private key, so you don't actually control the account. However, there are some advantages to centralized exchanges. They are fast, so trades can execute almost immediately. They often have deep liquidity for major tokens. This means that you can trade large amounts without impacting the price. The user experience is often very polished. And crucially, they offer on-ramps and off-ramps. Let's go into what that means. An on-ramp is a service that allows you to convert your traditional money like dollars in your bank into cryptocurrency. And an off-ramp is the reverse. Convert your crypto back into traditional money that you can put in your bank. If exchanges offer on and offramps the ability to buy crypto with your credit card or bank, it's pretty

likely to be centralized. Dexes being smart contracts, which you're going to learn about in a second, can't actually interact with traditional banking systems in most instances. Coinbase and Binance are perfect examples here. You can link your bank account with the platform and use that to buy ETH or any ERC20 token that you want to buy. When you want to cash out, you can sell your ETH and withdraw your dollars back to your bank account. And this is how most people first buy their crypto on board to the blockchain and then eventually withdraw their gains. Hopefully eventually the whole world will be onboarded to crypto and you'll just be able to pay for everything in crypto and it'll be fantastic. But at the moment because the world is still working with traditional currencies quite often people also want to offramp. There are

also alternatives that aren't centralized. Decentralized options like ZK P2P and they work by directly connecting people peerto-peer to trade stable coins. And this is actually done using something called zero knowledge proofs to keep their payment details private. This is actually a cryptographic method that allows you to prove something without revealing the thing itself. prove I know the details for my bank account without revealing it. And we actually have a whole course for zero knowledge proofs that I'm going to talk about at the end of this course. Let's now move on to decentralized exchanges. Woohoo. Decentralized exchanges or dexes as they are often referred to let you trade your tokens directly from your wallet that you own and hopefully you haven't shared the private key with anyone without any

company being in the middle controlling anything. You are the only one with your private key and there's no central authority. Instead of a central company holding your funds and facilitating the trades, you have smart contracts that facilitate these trades deterministically and transparently. With a DEX, you don't need to create an account. You don't need to do KYC and provide identity verification. You don't have to make a deposit. You simply connect your wallet to the protocol and can immediately start trading with the funds in your wallet. The entire process is permissionless and censorship resistant because it is built with smart contracts. If you have tokens already in your wallet because someone sent them to you. For instance, if you won poker at a cipher offsite and you got some USDC,

you can trade them 24/7 anywhere in the world at any time. UniS swap is the largest decks and has facilitated trillions in trading volume. And yes, that's trillion with a T. So, they're pretty massive. Now, there's also something else I want to touch on, and that is automated market makers. Traditional exchanges use order books where buyers and sellers place orders that get matched up. Dexes instead use automatic market makers or AMMs and they work very differently. Instead of matching buyers with sellers, trades happen with something called liquidity pools. This is pools of tokens which we call liquidity. Someone who deposits tokens into the pool is called a

liquidity provider. And they deposit equal values of two different tokens, let's say ETH and USDC. When you want to make a trade, you're actually swapping with the tokens that are already in the pool, not with another person. The smart contract then uses a mathematical formula to determine the price of an asset based on the ratio of tokens in the pool. As people buy more ETH from the pool, there's less relative ETH in the pool and more relative USDC. Therefore, ETH is more scarce and the price of ETH goes up. As they sell more ETH to the pool, there's relatively more ETH and relatively less USDC. So, the price of ETH goes down. It's a self-balancing system that adjusts the price automatically based on the supply

and demand. And it actually works for any pair of tokens regardless of the trading volume. As long as someone's there to provide liquidity, you can trade. No need to wait for matching buyers and sellers. There are lots of different dexes that optimize for different use cases. Unis swap, as I said, is the biggest dex that allows you to trade almost any ERC20 token. Curve specializes in stable coins and similar assets such as ETH and wrapped ETH. Balancer allows pools with multiple tokens and custom weights. And there are also things like DEX aggregators like 1 in and matcher that route your trade through multiple dexes to get you the best price. Many people assume that dexes are automatically more secure because you're allowed to control your

own funds, but it's actually a little bit more nuanced than that because we don't live in a perfect world. Of course, with centralized exchanges, you are exposed to a custodial risk. The exchange could get hacked, go bankrupt, or freeze your funds cuz it's centralized. We've even seen this with major centralized exchanges like FTX collapsing, taking up billions in user funds with them. With Dexes, you don't have this custodial risk because of course you still own your private key and you never give up control of your tokens, but instead you're exposed to a smart contract risk. The protocol could have bugs in the smart contract. And that is why blockchain security is so important. And these projects go through massive amounts of audits, code checks at companies like Siphon. And now that

we understand how to get funible tokens and how to trade them in our next lesson, we're actually going to get hands-on and use a DEX ourself, we're going to use UniS swap. So that's super exciting and I will see you in the next lesson. In this lesson, we are going to use UniS swap to switch one token for another token. UniS swap is a decentralized exchange like we learned about in the previous lesson. So, it's a protocol that's built on top of the Ethereum blockchain and it allows you to trade one cryptocurrency for another without using any intermediaries. It uses something called an automated market maker or AMM system. And this system relies on liquidity pools and smart contracts to allow you to swap tokens one for another. Don't worry too

much about how it works. And this demo is actually optional for you to follow along with. And the reason it is optional is because we're going to be doing it on test net with Solia ETH. I know that Sapoleia ETH is extremely hard to come by. So if you do want to just watch along, then that's okay. If you do have some Solo ETH, then I also recommend that you do follow along. But anyway, let's get on with it. So the first thing we need to do is head to the Uniswap app. So it's app.uniswap.org/swap. Then we can hit the connect button and we can connect our MetaMask. Then we click connect. And now our address will be shown up in the right hand corner. If we click on that and then we click this little cog button here, then we can toggle this test net mode to on. And

this allows us to try the features without of course using any real value because test net tokens do not hold any real value. Like this little pop-up is saying here. So you can just close that out. And then we can I mean we could set this to night mode. Actually that's a little bit nicer. Oh, also the other thing I'm going to do is just zoom in a touch. There we go. And now you can see this little user interface where we can swap one token for another. So we can select the token that we would like to swap. So in my wallet I only have Ethereum and USDC. So I am going to click Sapoleia ETH or just Ethereum the native tokens. And I have a balance of 0.489.

So let's say I want to swap 0.2 Solia ETH. And I can select a token that I want to swap that for. And I am going to swap that for USDC. You can learn more to find out about this little warning. But I am going to just click continue for now. And then I can review my transaction to check that all the details are correct to swap 0.2 ETH for USDC. And because I don't actually want to get rid of too much of my Superior ETH, I'm actually going to do a smaller amount. 0.05 review. Click to show more. And you can see the fee. You can see the network cost, the rate, so how much USDC I'm going to get for my ETH. The max slippage, which is if the price changes,

how much I'm going to allow the price to change before my transaction should revert. The order routing, which is like when it finds the best path for your trade across different liquidity pools to get you the best possible price. And then finally, the price impact. So, how much is my swap going to impact the price of the pool? So, I can click swap if everything looks correct. Now we need to review that the transaction details are correct. So the domain is correct is app.unis swap.org. This address it is marking as suspicious at the moment but if you copy it and then look in the unis swap documentation we can actually see all the addresses that are supposed to be the correct ones on mainet and then also on ethereum polia. So we could check the router. If I hit command f and

then command v to paste in the address then I can see that it is an exact match for the universal router. So I don't know why that it is flagging it as malicious. It's not because this is definitely the correct address. It's in the unis swap documentation. So we verify this address is correct. We know it's coming from the correct domain. And this method execute is in fact the method that we want to call. If we were being super verbose, we should go through and verify all of this call data. And to learn how to do that, I'm going to point you towards the wallet security course. So on Updraft, if we head to updraft.siphon.io/care, io/career-tracks then web3 wallet security learn more then you should take these two courses

after you've taken this blockchain basics primarily you definitely need to take this web 3 wallet security basics course so that you can understand how to safely interact with smart contracts and verify transactions before signing them so after this course please take this web 3 wallet security basics course. So now we have verified everything and hopefully you will understand how to verify this call data as well. But because we know that this is the correct address and we know this is the correct function from the correct domain, we can go ahead and hit confirm. But if this is on mainet, you probably should be verbose and check all of this call data. So if we go back over here, we can see here now we have swapped our ETH for USDC. And if we go back up into our wallet, you'll see this execute confirmed. You could view the

transaction on a block explorer. And if I go over to my tokens, I now have 65 USDC. So we have successfully swapped ETH for USDC. And on Maynet, you could do lots more. You can swap other tokens. You can buy tokens. You can sell them. Now we have used DeFi for the first time ever on Sapolia. We have used unis swap to swap our ETH for USDC. And this is a decentralized exchange. So now you have used your first decentralized exchange as well. So that is super exciting. I hope you enjoyed this lesson. We have one more lesson I believe in this section and we're going to learn about decentralized governance. So how do we make decisions? How do we create

organizations in a decentralized way where no one person controls the system? Imagine if you could vote on how your bank operates. Imagine if you could vote on how a company that you really enjoy functions. Imagine if you could vote on what interest rates to offer, which services you want them to provide, and even who gets to run the show. Sounds crazy because they would never give their customers that kind of power, right? On the blockchain, we have what's called decentralized autonomous organizations or Dows, where token holders can vote on proposals that control how the organization functions.

Welcome to decentralized governance, where the token holders become the decision makers. In traditional systems, we have a small group of executives who get to make all the decisions and those decisions affect millions of users. You might go and complain on Twitter or X, but you don't get a real vote on how these companies or organizations operate. Blockchain governance gets to change this so that the community gets to make these decisions transparently on chain instead of executives making decisions behind closed doors. No one can override democracy cuz as we say, it's baked into code. We can even use this for things like voting in elections. No one can override democracy since it's as we say baked into code.

It's literally just smart contracts that execute based on a majority of votes. And these tokens are the tokens we were talking about in the previous lesson that can be used for governance and they are what represent the voting power. And this lets communities vote on the protocols they use like unis swap. And any project or company that employs this decentralized governance is referred to as a decentralized autonomous organization or DAO. So how does this actually work? So firstly, someone submits a proposal. Maybe they want to change the interest rates or add a new feature. The proposal gets formatted into code specifying exactly what changes will be made and then there is a voting period where token holders can connect their wallet and cast their votes by signing blockchain

transactions. The smart contract then tracks the votes and how many tokens back it. The more tokens someone holds, the more weight that their vote has. When the voting ends, the smart contract tallies up all of the results. And if the proposal passes, the changes will be implemented. No CEO can override the vote. No board can reverse the decision. It's decentralized and autonomous. The code executes exactly what the community decides. Let's look back at the example of unis swap. Uni token holders get to vote on new features, grant distributions, and whether to collect fees. And when these unis swap voters approve new changes, you get to see them in the interface that you're using.

Compound allows users to vote with comp tokens that can impact things like interest rates or risk parameters. And this creates something that economists call skin in the game. Token holders aren't just expressing their preferences. They're voting with their own money on the line. Bad decisions could impact their token's value. Good decisions could attract more users and make their tokens more valuable. You have direct impact on the organization that you hold the tokens for. It's pretty cool. There are some challenges. Things like when people own the tokens but don't actually cast votes. Buying the tokens for the price appreciation rather than the voting rights. And this could give large holders outsized influence. There's also technical complexity. Reading these governance proposals can sometimes require

understanding of reading smart contracts and more likely the economic models because most often it'll be formatted nicely for you. But voting does cost gas fees and sometimes your tokens are locked during the proposal period. But blockchain governance does offer something new where code implements collective decisions and stakeholders directly control the organizations they use. If you're curious about how to actually build a DAO, this is something we teach in the advanced foundry course if you're interested in becoming a blockchain developer. But if you're not a developer, then hopefully this lesson has been interesting to you and now you have a little bit of understanding about how Dows and decentralized governance actually works. So now if you hear those terms, you know what they mean. And this is actually the end of this section

where we are talking all about the use cases of blockchains. We've talked about DeFi. We've talked about tokens, NFTts, RWAS, stable coins, decentralized exchanges. We've used a decentralized exchange and we've talked about Dows. So, I hope that you enjoyed that. And we have one more section where we are going to learn all about scaling Ethereum L2s, rollups, a little bit about ZK, and we're going to do our very first L2 transaction. So, get excited for that. It's a fun one. And I will see you very shortly. Throughout this course so far, we've mentioned a couple of terms, layer 1 ones, layer 2s and rollups. We also worked on sepoleia testn net earlier and throughout updraft

we said we would be deploying on zk sync or sepoleia. I have mentioned briefly what these layer ones and layer twos are but in this lesson we're going to go into a little bit more detail. Ethereum mainet is a layer 1 or L1 blockchain. Solia is a testnet L1 blockchain. ZKSync mainet is a layer 2 or L2 rollup. ZKsync Sapoleia is a testnet L2 roll up. But what do these terms actually mean? A layer 1 or L1 is a blockchain in its purest form where the nodes contribute to civil resistance and help the chain reach consensus. The L1 is the base layer of the blockchain ecosystem and it works without needing anything

additional. It's often referred to as the settlement layer, and that's because it's the layer of the blockchain ecosystem that all extra layers or additional components eventually write back to. Examples of L1 chains include, of course, Bitcoin and Ethereum, but there's also others like Salana and BNB chain. Ethereum, however, is the chain that we are going to continue to focus on in this lesson and all of the other lessons. So, from now on, when we say layer 1 or L1, we are most often referring to Ethereum. You can think of the L1 as like the hub of the ecosystem. For instance, in the EVM ecosystem, Ethereum is that hub. Anything that hooks back into Ethereum is called a layer 2. A layer 2 blockchain is a network that is built on top of a layer

1 and it extends its capabilities. This kind of makes sense, right? The layer 1 is the first layer and the layer 2 is the second layer. I just want to note here though that any apps deployed to the L1 are not considered L2s. For example, unis swap is not considered an L2. Instead, it's an app deployed on Ethereum. It's powered by smart contracts that are deployed on Ethereum. These layer 2 blockchains are referred to as roll-ups. But what actually is a rollup? Apart from the fruit snack for you Americans out there, blockchain roll-ups are L2 scaling solutions that increase the amount of transactions on Ethereum without increasing the gas costs. Sounds crazy, right? In the previous lessons, we've said that the more transactions there are on Ethereum, the higher the gas costs. This is true,

and this is why we process the transactions off of Ethereum so that we don't impact the gas price. It's achieved by bundling together, rolling up multiple transactions into one, hence the name rollup. We're going to explain a little bit more how this works in a second, but first, let's go back a second and work out why we actually need roll-ups. And this is because of the blockchain trillemma. In an ideal world, we need a blockchain to have three primary properties. We need it to, of course, be decentralized, so not controlled by one single entity. We need it to be secure. We need to be protected against all of those vulnerabilities we talked about like 51% attacks, civil attacks, replay attacks, and more. And the third property is scalability. We need the system to be able to grow

without sacrificing either speed or cost. And these three properties together are known as the blockchain trillemma which states that a blockchain can only ever have two out of three of these properties. For instance, if the system is decentralized and secure, then we will be sacrificing scalability as is the case with Ethereum. Ethereum inherently has a scalability problem. It can only process approximately 15 transactions per second. And as Ethereum is increasing in popularity, the number of transaction requests is also increasing. and therefore the gas costs associated with these transactions are also increasing as there are more people who want to jump the queue and avoid long wait times. If these blockchain systems are to reach mainstream adoption, gas prices need to be reduced

even in the face of high transaction volumes. Enter rollups. Roll-ups aim to solve the blockchain trillemma by increasing the throughput of Ethereum without sacrificing either the security or decentralization of the system. This is achieved by processing the transactions off of the L1 blockchain. Here's how it works. When a user submits a transaction to a rollup like ZKYNC, an operator will pick up this transaction. An operator is like a general term. It can refer to a node, a set of components, or just any entity responsible for processing transactions.

This general operator's job is to do multiple things. Order them, execute them, bundle them together, and submit this batch of transactions back to the L1 like Ethereum. And because the batch of transactions eventually exists on Ethereum, if Ethereum were to roll back, so does the rollup. Therefore, it inherits the security of Ethereum. The validators on Ethereum who all agree to the valid state of the blockchain also agree to the valid state of the bundle of transactions. It's still directly using the security of this validator system. By bundling the transactions together, rollups can handle transactions more efficiently. And this is because the gas costs associated with sending a transaction are instead split among all of the transactions, all of the users in the batch. The validity of

this bundle of transactions is then checked on the L1 itself. And the way this validity is checked depends on the type of rollup. There are two main types of rollup and the difference between them lies in how the rollup determines the validity of the batch of transactions. How they verify that the transactions are legitimate rather than fraudulent. First we have optimistic roll-ups. Optimistic roll-ups assume the transactions are valid by default. They're pretty optimistic. Here's how it works. Operators propose what they believe to be the valid state of the rollup chain. After this, there's a time period known as the challenge period.

During the challenge period, other operators can challenge the valid state of the blockchain. They do this by sending what's called a challenge. This is where they compute something called a fraud proof. And they do this if they notice a potentially fraudulent transaction. This fraud proof involves the challenging operator playing a call and response game with the other operator until they narrow down the dispute to a single computational step. This computational step alone is then executed on the L1. If executing this step results in a different outcome, i.e. the state of the blockchain is different, the challenging operator wins and the fraud proof succeeds. If the proof succeeds, the rollup will re-execute the batch of transactions and the operator responsible will be penalized. This is usually done through

the staking mechanism, which it works exactly the same as with Ethereum, where their tokens are held as collateral in a smart contract where they're basically saying, "Yep, I promise I'm going to act honestly." And if they don't, their tokens are burnt. If the proposed batch of transactions are not invalidated during the challenge period, then the proposed batch of transactions is assumed to be correct and is added to the blockchain. The second type of rollup is a zero knowledge rollup or ZK rollup. Instead of using fraud proofs to prove the validity of transaction batches, they instead use zero knowledge or ZK proofs, sometimes referred to as validity proofs. Zero knowledge or ZK proofs are a cryptographic technique that allow you to prove something like the state transitions are valid and the computation was done correctly without

revealing any information about it. At this stage, we definitely don't need to understand how they work. Just think of them purely as some math magic that just works a little bit like ECDSA signatures. ZK proofs involve two participants. There's the prover that's trying to prove that they know something, trying to prove that they did some computation correctly. And then there's also the verifier, and they are the entity verifying that the prover does in fact know what they say that they know. In the context of ZK roll-ups, the prover is often some operator, so like some piece of code that generates a proof after performing some computation. And the verifier is a smart contract on the L1. When a batch of transactions is submitted to the L1, a ZK proof is created by the prover and verified by the verifier, the L1 smart

contract. And this ZK proofs succinctly confirms transaction validity. In most ZK roll-ups at the moment, they don't actually use the zero knowledge aspect, hence why they're called validity proofs. Instead, they're used for their succinctness to be able to verify correct computation. we can very quickly and efficiently verify that the state changes are valid and no one has tampered with anything without having to make any assumptions or play any call and response games. Instead, you just generate the proof for every transaction batch and verify it with a call to a smart contract on the L1 every single time. Sometimes these nonprivacy preserving ZK roll-ups are referred to as succinct roll-ups. Roll-ups which do use the zero knowledge aspect, they do

actually hide some data. They do hide the transaction information and include privacy into these blockchains are sometimes referred to as ZKZK rollups and examples include Aztec which as of recording is currently in test net and they allow you to have private state using these zero knowledge proofs. You could have things like secret balances, you could send secret transactions, you could hide your address. It's pretty cool. Zero knowledge proofs enable a lots of different use cases outside of rollups. And we have actually a whole separate course on zero knowledge proofs from a high level. if you interested in learning more. But for the purpose of most ZK roll-ups, they are just used to verify the validity of transactions in a succinct, quick, efficient way.

To summarize, roll-ups help scale Ethereum by processing the transactions off of the main chain, bundling them together, and then submitting them back to Ethereum with some kind of proof. The proof depends on the type of rollup, whether it's optimistic or zero knowledge. And this allows us to maintain the security and decentralization of Ethereum while also achieving scalability needed for mainstream adoption. Pretty clever, right? One of the types of operators associated with a rollup is called a sequencer. The sequencer usually refers to the operator that orders the transactions and sometimes bundles them together. Now, in most rollups at the moment, most of these sequences are centralized. This means it's controlled by one single entity. This can be problematic for

several reasons. Firstly, there's a censorship risk. The centralized sequencer could in theory stop certain users transactions from being included. They could manipulate the order of transactions for their own gain. Imagine you wanted to withdraw your funds and the sequencer actually stops you from doing so, blocking your transaction. This could occur with a centralized sequencer. The other major issue is reliability. A centralized sequencer is a single point of failure. If it goes down, no one will be able to process any transactions at all. No deposits, no withdrawals, no transfers, nothing. This can of course be extremely problematic.

What if withdrawals are halted for a day, a week, a year, forever? Are your funds even worth anything if you can't withdraw them or do anything with them? So, we know that there are a few problems of course with centralized sequences and we want a decentralized system. But this is why projects like ZKYNC are working right now to decentralize their sequences. by having multiple sequences that can batch transactions. Rollups can eliminate this single point of failure and censorship risk. It's important to note that many rollups start with centralized sequences to begin with just for simplicity and this is only during the early stages. But the goal is to progressively decentralize as the system matures and whether the sequencer is decentralized or centralized determines partly what the stage of the rollup is. And that is

the subject for the next lesson. L2 chains or rollups are graded based on certain properties and given a stage. Now, for this section, we are going to be going through the L2B website, which you can see at l2beat.com/scaling/summary. And here you can see all of the different chains, their stages, and lots of different information that we will be going through in a second. So, the stage of a rollup is a categorization framework based on Vitalik's proposed milestones. It is an opinionated assessment on the maturity of the rollup by the L2B team and its purpose to create an incentive for projects to work towards decentralization and they have proposed three stages. Stage zero full

training wheels. In stage zero, the operators and a security council predominantly manage the rollup. This is like a committee of members who can make decisions in the case of bugs or problems or upgrades. And so in stage zero, the management of the rollup is pretty centralized. What about data availability? Data availability refers to the confidence a user can have that the data required to verify a block really is available to all network participants. So in terms of rollups, this transaction data needs to be available in order to be able to verify the transactions. So for stage zero rollups there needs to be open- source software to enable state reconstruction of the L1 data to ensure both transparency and also the verification.

And finally in stage zero in the case of an unwanted upgrade users have less than 7 days to exit the system. Exiting in this context refers to the users withdrawing their funds from the system. And in stage zero this usually requires some kind of operator coordination. So some entity is going to have to help them exit. The second stage is stage one. Bit confusing with the two, but it's called stage one. Enhanced rollup governance. So in stage one, the rollup is starting to be governed by smart contracts. The security council is probably still in place for things like bug resolution, but it is starting to become more decentralized. In stage one, the rollup has a fully functional proof system with a decentralized fraud or

validity proof submission system. Now in stage one, a user can exit without coordination from an operator in the case of these unwanted upgrades. Now the final stage, stage two is no training wheels. Smart contracts now fully manage the rollup. It's pretty decentralized at this point and so the fraud or validity proof system is completely permissionless and users are now given ample time to exit in case of unwanted upgrades. There usually is some kind of security council where its role is strictly confined to addressing errors that can be adjudicated onchain, meaning that users are now protected against governance attacks. And so if we look through this L2B nice little table here, then we can see what stage all of the

different roll-ups are at. So for instance, ZKSync era is a stage zero rollup. So if we click into this, then we can see a summary of this rollup. And you'll notice here this pretty little pie chart. Let's go through what this means. This pie chart is a nice little visualization of the risk analysis for this roll up. So let's go through all of these little pizza slices. So first data availability. So can the L2 state be reconstructed from the data that ZKYNC submits to L1? And because it's green, yes, it can. So the difference in state before and after the bundle of transactions is submitted is published on chain. So the proof can be constructed. State validation. So have we checked that these bundle of transactions is legitimate rather than

fraudulent? Has the state or the state differences been validated to be correct? And in the case of ZK sync, yes, because they use ZK proofs. They use a plon zero knowledge system which is just the fancy algorithm with KZG commitments. This is all just like the mathematical magic that happens. But yes, it's proved to be correct. So it's green. Zoom out a touch so that we can see the text box. But sequencer failure. So first of all, what's a sequencer? A sequencer is a type of these operators that we were talking about earlier and it usually refers to the operator that is ordering the transactions and sometimes a sequencer can bundle the transactions together as well but in general it's talking about the ordering of the transactions. So what happens if this sequencer goes down? Can I a user

get my money out? So users can submit transactions to the queue but you can't force them through. They still need the sequencer there to get their transactions through. The sequencer can't pick and choose transactions and selectively skip them, but it could stop processing any transactions at all. So, if it's down, then no one can get any transactions through and no one can withdraw their funds, move their funds, or do anything. No transactions can go through. So, it's yellow because they can submit them to the L1Q, but they can't force them through essentially. So, that's why it's yellow. Proposer failure. So the proposer is another type of operator and it's the operator responsible for proposing the new state of the rollup. So what happens if this goes down? What if we can't propose new

state? So because they have a whitelisting system on ZK sync only whitelisted proposers can publish state routes. So new state of the blockchain on the L1. So in the event of a failure then no one can get their money out. Withdrawals can't happen. No transactions can happen. So this is obviously a big problem. So it's spread. And finally exit window. So, like we were saying earlier, the exit window is how long does a user have to withdraw their funds to exit from the system to not be using the chain anymore. And so, for ZKYNC in the case of unwanted upgrades, the contracts are instantly upgraded. And so, there's no window for users to exit. So, it's red. So, if we zoom out again and we look at this page, then we can see a nice summary of the rollup. So we can see the total value

locked, the activity on the chain, onchain costs, so like the gas costs, the milestones. So for instance, on the 13th of March, ZKYNC era started using blobs. You don't need to know what blobs are at this point, but they're super cool. So I'm going to give you a quick teaser. We will be covering blobs in a later part of this course, so stay tuned for that. But essentially, blobs are like massive, massive chunks of data which aren't submitted to Ethereum. They're like a side card to the transaction. They tag along, but they're not stored on chain forever because they're massive. Instead, a hash of all of the data is submitted to Ethereum to compute the proofs. So, you can see for roll-ups how useful this is because if you've got a massive bundle of

transactions, then you can have all of that information without having to store it all on chain. Introduction of the Bougam prover. This is just their prover the code and they had their alpha launch of the chain which is cool. And then you can see the risk summary and the risk analysis that we were going through earlier. Now if we scroll down to rollup stage, we can see that it's a stage zero roll up. And so you can click in and see what requirements they have met and what they need to do to move to a stage one. So we were saying with those permissioned operators earlier, so they can censor withdrawals. So that needs to be fixed. And then also in the case of upgrades, they're not given any time to exit the system like we were talking about earlier. Now the final thing to

say about rollup stages and L2B is that these stages do not reflect the security of the rollup. It is purely an opinionated assessment of the maturity in order to push these protocols towards decentralization. Now because the batches of transactions are submitted and proven on Ethereum and so that is everything you need to know about L1's, L2s and rollups. That was a lot of information for you all. So now is probably time for you guys to take a break and try and digest some of that information because I know there are a lot of new terms here. If you need to watch again, go ahead because there is a lot of information here that is pretty complex. And so as Patrick says and will say a lot of times throughout this course, go get yourself a snack, go get

yourself a drink, a coffee, some ice cream, take yourself on a little walk, and have a break. and then come back when you're all refreshed and we can continue because it is time for us to make our very first transaction on ZKYNC test net and I'm super excited about it. So I will see you in a second for that the final section. Oh no, second to last. And now it's time to make our very first transaction on ZKsync testn net. The ZKSync test net is sometimes called ZKSyncia, ZKsync era test net. I'll probably use the terms interchangeably, but ZKSyncia, ZKSync test net, they're all the same thing. Some of the things that we're doing here are going to be

repeated from earlier in the course, but repetition is key in order to get this information drilled into your brain. So, first let's go ahead and add ZKSyncia to our MetaMask so that we can see the transaction summaries, see our balance, and things like that from inside MetaMask. Okie dokie. The very first thing that we need to do is we need to add zkync superia to our metam mask so that we can see all of our transactions and everything that's going on inside our wallet including our balance. So what we're going to do is we're going to head to chainlist.org or and make sure that we have got this include test nets box checked and then we need to search for ZK oop ZK sync and here we can see ZK sync Solia test net which has got the

chain ID of 300 so if you click in here and then we're going to connect our wallet and we're going to confirm that the site can have permissions to our wallet and then we can click approve to allow this site to add a network so this is going to add the network to our metask and then we are going to switch over to zk sync Seapoleia. When we click inside our wallet, you'll be able to see a summary of the balance and all of the tokens, NFTs, and activity going on inside our wallet. And it's that easy, that simple. Now, the second thing we want to do is we want to be able to see transactions and contracts in more detail like we did on Sapoleia with Ether Scan. So, the block explorer equivalent to Etherscan on ZKsync and ZKYNCA can be found at explorer.zksync.io

for mainet. And then if we switch over in this little dropown to zksync era seapoleia then it's sapoleia.explorer.zksync.io for zksync sapoleia. And if we grab our wallet address then we can paste that in the search here. We'll be able to see a summary of our account. So when we send our first transaction it will come up here. So now what we need to do to send our first transaction is get some funds. And this is going to be our first transaction is getting funds. So there are actually two ways that we can get test net funds on ZKYNC Sapoleia. The first is a bit like Sapoleia and we can use a faucet directly. Faucet faucet I never know how to pronounce it. But these can be a little bit temperamental.

The one that's recommended on the ZKSync documentation here requires an API key and there's another one that requires us to sign in with GitHub. Both things that we don't really want to do. So we're actually going to use a different method which is bridging. But Kira, what is bridging? Let me tell you right now. So, what we're going to do is we're going to get some funds from Sapolia. We're going to get some Solia ETH in the same method that we did so before. And don't worry, I'm going to take you through step by step how to do it again. And then what we're going to do is we're going to bridge those funds over to ZK Sync Solia. But I still haven't explained to you what bridging is. Let me do that now. Bridging means taking the funds from one chain and then getting them on the other chain. Now,

we're not actually taking those funds and literally moving them. We're using a mechanism. Now, there's two main types of bridging mechanisms. The first is a locking and unlocking method. And what happens here is that the tokens are locked on the source chain. So, they're locked inside a smart contract and then they're unlocked on the destination chain. They are released from a smart contract and sent to your wallet from the destination chain. Now, you might imagine that this could be a bit of a security concern because what if the smart contract is hacked and my tokens that are locked on the source chain contract are taken? Now, this can happen, but you just have to make sure that the protocol you're using is heavily audited and tested. Now, the second method is a minting and burning bridge. And what happens here is on the

source chain, the tokens are burned. So, they are sent to the zero address. They're taken out of circulation. They're destroyed. They are no longer. And then tokens are minted on the destination chain. They're given to the user on the destination chain. They're created. They're brought into existence. And if you don't understand what I mean by burning and minting, don't worry. This will be covered extensively in a future course. We go through ERC20s, minting and burning and all of these different things and tokens later down the line. So you don't need to know 100% how it works. All you need to know is that the tokens are actually removed on the source chain and then created on the destination chain. Now here the bridge protocol needs to have control over the supply of the tokens in order to be able

to burn them and mint them. So for instance, an example of this is CCTP created by the circle team where USDC is burned and minted in order to create a bridge in which their bridge implements a burn and mint bridge mechanism. And this can occur because the circle team have control of the USDC supply. But enough about bridges for now. And so let's continue and actually bridge our funds from Sapoleia to ZKYNCA. And what we're going to do is we're going to get some Solia ETH from a faucet and then we're going to bridge it to ZK sync Sapoleia to get some ZKY Solia ETH.

That's a lot of words. Let's do that now. So, like I said, the first thing we need to do is we need to use a faucet. What we're going to do is we're going to use the Google Cloud Solia faucet. As of recording this, this is the best faucet to use, but if you check the GitHub repo associated with this course, we will keep it updated with the best faucet on Spolia for you guys to use. So head there if you want to check what the current best one is. As I said, this is the best one for right now. So we're going to select the network as sepoleia and then I'm going to go into my MetaMask and I'm going to click this little button to copy my address associated with my wallet. And I'm going to paste it in here. And then I'm going

to click this button that says receive 0.05 ETH. So you may have had a little flag come up that says you need 0.01 ETH on mainet. And what you need to do is just wait around 10 to 20 minutes and then come back and try again. And this is to prevent some kind of like civil attack where people are creating multiple multiple accounts and then just draining the faucet by using newly created wallets instantly to try and get funds. So now our test net tokens are on the way and we're actually doing a transaction on Sapoleia as before. So these are all the steps that we've already done. And so now we've sent the tokens and we can check inside our wallet. And what we'll have to do is switch over to Seapoleia test net. And you can see amazing. We now have 0.05

Sapodia ETH. And now we need to take those tokens and we need to transfer them to ZKSyncia to get some ZKY Solia ETH. How do we do that? We need to use a bridge. So we're going to head to portal.zksync.io/bridge to bridge our funds. And this is going to be a lock and unlock method bridge. Up in this righthand corner, we're going to click this little down arrow and then switch it to ZKSync Sapoleia test net. Okie dokie. We are going from Ethereum Sapoleia test net to ZK sync test net. I'm going to transfer 0.025 Sapoleia ETH to ZK sync. First of all, I need to connect my wallet. So, you can connect. So, click connect your wallet.

Confirm that you'd like to connect. Okay. So, now that we've connected our wallet, we can click continue. And then we're going to click I understand. proceed to bridge because we have made sure that our wallet does support zksyncia testnet because it's metam mask it does so I understand now we can just confirm the transactions it's good practice to read through so yes this is the amount I wanted to send it's from my sepoleia testnet account to my zk syncia testnet account by the way notice here the addresses are the same so I'll click bridge now then we can confirm this transaction in meta mask and now we can see a nice little visual of this transaction occurring okay so Now that it says that the transaction is complete, we're going to head back over to the ZKSync Sapoleia block explorer

and we're going to paste our wallet address into the search bar and we can see that we have in fact done our very first transaction. Amazing. So we can see here it's processed on ZK sync and we can see that we've gone from our L1 address on Solia to our L2 address on ZK sync with a value of 0.025 ETH with a fee, a very very small fee. And so we're going to click into the transaction hash. And you can see here the information about the transaction, including the hash, the status, which we're going to go through in a second, the block number, the batch, so that's like the bundle of transactions from to our addresses on the different chains, the tokens transferred, the input data,

the value, which was the amount that we sent, the fees, gas limits, nons, and when it happened. So 4 minutes ago. So what does this status mean? It says on ZKsync era it's processed but then on Ethereum it says this weird thing where it's like sending, validating, executing. How come I have the funds in my Metam Mask and it's processed on ZKYNC era but on Ethereum? Like this doesn't make any sense. Kira, what is going on? I'm confused. Well, let me explain to you. So, if we head back over to the ZKsync documentation and we head to ZKSync stack concepts finality and that will explain to you what these two little sections mean. So finality in a blockchain system as it says here refers to the time taken from sending the

transaction to when the transaction is considered settled. So therefore it can't be altered, reversed, cancelled. And so if on Ethereum this is approximately 13 minutes. Now what about on ZKYNC era or ZKyncia? So finality is tied to Ethereum finality as we were explaining a little earlier. So from the time taken to sending a transaction to when the L1 smart contract updates the L2 state, what is this time frame? And so this has a couple of steps that it's breaking down here. So first of all, after the users submit their transactions, they need to fill up the batch that takes a few minutes. That batch of transactions needs to be committed to Ethereum. Then a proof needs to be generated and submitted and verified by the Ethereum smart contract.

And then finally, the batch is finalized. And this can take approximately 24 hours. And these steps correlate to these sending, validating the proof, and then executing and finally achieving finality. That's what these steps are referring to is this breakdown here. Now, you may say to me, Kira, that makes sense. It makes sense to me that it takes approximately 24 hours for all of this to happen. So, how come it says it's processed on ZKYCNC era, and you still haven't really explained to me how come I can see a balance in here? You just told me that it was going to be 24 hours. And yeah, that sounds super confusing. And the answer is again in the ZKSync documentation this instant confirmation section. So even though the finality is around 24 hours, you can consider your transactions submitted as having instant

confirmation so that they can be instantly displayed in the UI even though they're kind of unconfirmed. And you can consider these assets as immediately transferred and you can make further transfers. But you should be cautious and wait for full finality because things can be rolled back and you shouldn't consider them fully received until you have full finality. And so that's why here we have this instant confirmations where we have the funds. It says it's processed on ZK sync error, but it's not fully final. The transactions haven't been validated using the ZK proof. And so that's what these steps are referring to here. So now you have sent your very first transaction on ZKYNCA.

That is amazing. Now there is a lot of information to digest here but the very last thing that I want to explain to you is why we are doing this. Why are we interacting with ZKyncolia? Why are we going to be deploying our contracts to ZKyncia throughout this course? Now I just want to make a brief disclaimer to say that ZKYNC are kindly sponsoring Updraft in order to bring you the highest quality most amazing content to become the best smart contract developers in the world. Now, here at Ciphern, we would only ever recommend to you tools and chains and applications that we think are the best and that we ourselves would use. And so, there is a number of reasons that we will be using

ZKYNC and ZKSyncia to deploy and interact with our smart contracts and working with throughout this course. Let's give a little breakdown of this right now because I don't expect you to just take our word for it. You can make your own judgment. We'll give you our reasons why and then you can understand the reasons why we are going to be doing this. So as we have discussed ZK sync era is a layer 2 ZK rollup and there are four main reasons that we think that you guys should be using ZKYNC era. First of all security. So as we were saying earlier the security of ZKYNC era is directly inherited from Ethereum. If Ethereum detects an issue and rolls back so does ZKYNC error. the transactions are verifiably legitimate as ZKSync uses

cryptographic validity proofs to prove that the transaction is legitimate. Secondly, it's EVM compatible. Now, when you compile your smart contract, it doesn't compile to EVM byte code, which you don't really know need to know what this means, but instead it compiles down to VM byte code, which is like a zkync special version. The zksync compiler kulk can compile and understand solidity. And this means that you can take your smart contracts that you've written in Solidity and deploy them to ZKYNC era without really making any adjustments. There are a couple of really tiny nuances here, but we will be walking through them, so you don't need to worry about that at all. Thirdly, ZKSync supports Ethereum wallets out of the box. So, no need to create a special wallet. What does this mean for you? It

just means that you don't need to create anything special. You can just use your MetaMask as we were earlier and your address will be exactly the same, which again we saw earlier. The address on Ethereum will be the same as on ZK sync error. Your address on Sapolia will be the same on ZK sync supposia and there's nothing you need to do. It happens automatically. Now the fourth reason and in my opinion the best reason is that it is low cost and scalable as we were talking about earlier due to the transactions being bundled up together. The gas costs are split among all of the transactions in the bundle meaning that is super low cost. And what does this mean for you? It means that users interacting with your protocol don't have to pay really high transaction fees. as the network grows, you're not going to have issues. So, when everyone

else is deploying their protocols to Ethereum, and then down the line, as the system grows like we want it to, and we're gaining more and more users, they're going to have to port their users over to a rollup solution, which hopefully is also verifiable like ZK Sync using ZK proofs. Now, you because you guys are clued in because you're here at Updraft, won't have to do that cuz you guys are already on ZK Sync. So, as the system grows, you're not going to have any problems. Your users are not going to be faced with really high transaction fees. You're not going to have really high transaction fees in order to interact with your contracts or upgrade them. And this is the true power of ZKYNC. And that's why ZKYNC are our recommended chain. And thank you again for ZKYNC for sponsoring. If you'd like, you can also deploy to your own favorite

rollup, whether that's Arbitum, Optimism, or Scroll, or any of the other roll-ups that are EVM compatible out there. And so now you have everything that you need to know about L2s and roll-ups and ZKSync era and why we will be using it throughout this course. And so that was a lot of information. Again, you can go ahead and take a break in order to digest this information, but I will pass you back over now to Patrick and I will see you again later in this course. Oh my goodness, we have come to the end of this blockchain basics course. You guys should be so proud of yourself for getting to the end. But please don't stop here. I have just this lesson and one more sneaky little lesson to tell you where you should go next, how you should further your career because there

are lots of courses on Cipher and Updraft and I want to make sure that you know which one is the best for you to go on to next. I'm not going to spend too much time wrapping up here because I know it could be a little bit boring, but I just wanted to say a massive well done because you have learned so much information here. You've learned about what blockchains are, why we should care. We've learned about scalability and L2s and rollups, zero knowledge proofs a little bit. We've learned about the different use cases like tokens, stable coins, RWAS, NFTts, DeFi, and we've looked under the hood at proof of work and proof of stake, account abstraction, temporary account abstraction, gas fees, transaction life cycles, and so much more. So, I encourage you before you do go on to take any other courses, please take a

break, let this information marinade. Make sure you recap any sections that you found a little bit more tricky and look at the resources to do some extra reading if that's something you're interested in. But I also just wanted to say a massive thank you for embarking on this journey into the blockchain industry. I am so excited to see what you do next. Please leave us a post on X or send us a message on Discord if you enjoyed this course because we would love to hear from you and we'd also love to hear where you go next. So, please stay in touch and let us know. In the next lesson, I'm going to walk you through a little bit about Updraft and the different courses that we have that you should take next. But thank you again so much for watching and I hope you enjoyed it. And I would also like to

say a massive thank you to Jess and Patrick for also featuring in this course and to all of our sponsors who are linked in the resources GitHub repo for this course. With that said, I will see you in the next lesson and then the next course. Bye. Now that we have finished the blockchain basics course, I just wanted to walk you through the other courses on cipher and updraft and take you through the different career paths. So if we head to in the top bar career tracks, it will take you to the different course collations. So these career tracks are just colleations of different related courses. So if you click on blockchain foundations, you'll see that you've already taken the first course for the blockchain foundations. This is a completely

non-technical course, but in this chain link fundamentals course, there is a little bit of programming, but it's optional. So, if you wanted to learn a little bit more about chain link and become a chain link expert, then I recommend that you take this chain link fundamentals course. This course is a written only course. So, there is no video, but you can read over the different use cases and services that chain link provides. The other nontechnical course if you wanted to go into sales or marketing or something where you didn't want to do any programming. The other course that you could do if we go to check out all courses and then go to zero knowledge.

This fundamentals of zero knowledge proofs course is also non-technical. It's got no coding at all and gives you an introduction to what zero knowledge proofs are and why they're really cool. This is definitely something which I encourage you to watch even if you are don't want to become a developer. actually especially if you don't want to become a developer because it will just help you keep up in the space because there is a lot of hype going on around zero knowledge proofs at the moment. So it is important to understand. Now let's say you want to become a an educator like me or you want to become a security professional. You want to become a solidity smart contract developer then you can take this solidity smart contract developer track and this has three different courses which you need

to take. So beforehand you need to take the blockchain basics course which you have just done and then you need to take the solidity smart contract developer the foundry fundamentals and then the advanced foundry courses and then you will be a solidity smart contract developer. However this is not your only option. If you prefer Python then you can take the Viper smart contract developer courses or you could even learn Rust. So you can just go to the different courses and find the Rust course. So I could go to check out all courses and then scroll down until I found the Rust programming basics. If you feel confused right now, essentially if you want to be a developer, then I recommend that you take the Solidity smart contract developer track. If you

already know some Python, maybe you take the Viper smart contract developer track. And then once you're ready, you can add on the smart contract security auditor courses if you wanted to go into auditing. Additionally, we have DeFi courses, but you need to take this solidity smart contract developer courses first. And same with the more technical zero knowledge developer courses. So, this Noir programming and ZK circuits, you need to have taken all of the solidity courses first, but you can take the fundamentals of zero knowledge proofs one if you want. So, if it were me, what would I do? If I wanted to be a developer, I would take these three solidity courses and then I would take the two zero knowledge proof courses or the develop the D5 developer

courses. If I was non-technical, I didn't want to do any programming, I would take the chain link course and skip any of the programming sections and then I would take just the one zero knowledge proofs course, just that fundamentals one. So, I hope that makes a little bit of sense. I just wanted to give you a walkthrough of these different career tracks. If you want to see all of the different courses we have available, you can just go on to click to check out all the different courses. These are each of the individual courses. So if we go into career tracks, then we have them grouped together so that they are related so that you know what order to take them in because maybe it wouldn't be clear for if you wanted to be a solidity developer, whether to take foundry fundamentals first, whether to take

solidity smart contract developer first. This gives you an order. So I hope that makes a little bit of sense. If you have any questions about which course to take when or what you should do next, then please ask on Discord or make a discussion about it and we will be happy to help you work out what you want to do next. With that said, I know this is a bit of a unconventional goodbye, but it's not really goodbye because I'm going to see you in the next course that you're going to take. So, I'm very excited to see what you do next. and let me know on Twitter whether you enjoyed this course. And thank you so much for listening and watching or reading depending on where you're consuming this. And I will see you very very soon.

Bye-bye.