text
stringlengths 61
434
|
---|
If you're interested in learning about blockchain, this is the course for you. Patrick Collins is a veteran software engineer and longtime finance industry developer. Be sure to leave a comment with something you learned from this course. Welcome to the ultimate solidity smart contract and blockchain |
Developer course, JavaScript addition, we recently did a version of this video in Python that has over 2 million views right now making it the most watched smart contract tutorial on the planet. We've learned a ton from doing that first course. And if you love the Python language, definitely be |
sure to check that one out. We've taken all the learnings we've got from making that first course, wrapped it up and put it into this JavaScript video for you. If you're looking to get started in web three blockchain smart contracts or any of these terms, this is the course for you. And it's for anybody and |
everybody, no matter your experience level in programming or in blockchain. Ideally, you know, a little bit of JavaScript before starting this. But if you don't, no worries, we will help you along the way. And in case you do want to learn a little bit of JavaScript before starting here, there are some |
fantastic courses on Free Code Camp to learn more, but you absolutely don't have to. And really, any experience with any object oriented programming language will work, right. So if you're brand new to coding, or if you're brand new to blockchain, this is exactly where you should be. And if you |
already know a lot about blockchain or coding, this course will give you even more deep fundamentals on the space. So welcome to the edge of the rabbit hole. So for those of you who don't know, my name is Patrick Collins. I'm a smart contract engineer, developer advocate on the chain link |
protocol. And I live in breed smart contracts. I also make YouTube videos on my own channel, medium Twitter threads and more. teaching people about smart contracts about coding and about this new technology. I love helping developers learn, |
grow and learn about this new Advent. That's blockchain and smart contracts. And I'll be taking you on your journey to becoming a blockchain expert and Wizard of the smart contract developing world. And even if you don't want to become a developer, the first section our blockchain basics, will give you |
a lot of fundamental knowledge about how blockchain and smart contracts, even work. I am so excited for you to be here. And I hope you enjoy the journey. This is a data dump, passion educational project of everything I've learned working in this space. And I am 100% certain that if you follow |
along, you'll come out the other side of this, armed with the knowledge to be a positive force in this incredible industry, solidity and smart contract developers are massively in demand with an average salary of being around $145,000 a year, |
there is massive economic opportunity from learning this course. And this technology has the ability to revolutionize everything that we interact with, and you can be one of the pioneers ushering in this new age. In our courses. We already have a track record of giving people these educational needs |
and sending them into their careers in the blockchain and smart contract space. And we are going to give you all of the cutting edge tools and how to use them including working with things like D phi NF TS Dows, ERC 20s upgradable, smart |
contracts and more. We're going to teach you the skills necessary to build defy applications like Ave synthetics and compound, billion dollar decentralized applications, or massively successful NFT projects like crypto punks, or board apes. Dow is like maker Dow or developer, Dow and any of |
the amazing things you've seen in the cryptocurrency world. In learning these skills, you will have all these economic opportunities at your fingertips and the ability to be a pioneer in completely changing the way we interact with each other. In a fundamental way. Building decentralized smart contract |
applications is building a world that's more accountable a world with unbreakable promises, a faster, more efficient, financially free world, a collaborative community, combining the prowess of philosophy and technology into a new system. We'll learn more about the purpose and the value |
of smart contracts and decentralized applications in lesson one of this course, and why they're so exciting. Finish this course. And you'll be ready. So again, I want to give a major thank you and a major kudos to you because you've taken the first step to enter this realm. So welcome to Web |
three. Welcome to the blockchain. Welcome to smart contracts. And I'll see you at the bottom of the rabbit hole. So let's jump into some best practices for this course so that you can learn most effectively and learn with this course as best you can. You do not want to skip |
this part. It'll help you solve 80% of your issue. Now, while going through this course be 100% certain to follow along with a GitHub repository associated with this course we have a link in the description of this video for you to absolutely click on follow along have open in a tab as you're |
doing this because it has all the code Sam polls, timestamps a community to interact with and more, it is going to be your Bible for watching this course. And yes, we have a Discussions tab. This Discussions tab is a place where you can ask questions, engage with other developers who are going through |
this course as well. Get some help, and etc. Be sure to say hello and meet other like minded individuals like yourselves. Now, blockchain and smart contracts move really quickly. And things are constantly being updated. So to make sure you're always up to date with the latest, when I open up some documentation, try to open up the documentation for yourself |
as well. And maybe even have the code sample next to you. And as you're writing code, be sure to refer back to make sure that you are keeping pace, and then you have the most up to date samples, sometimes technology might change, and there might be a way to do something a little bit better. So we have this file called chronological updates, be sure that this is the first |
place to check when you run into an issue to see if maybe something was updated that you missed, it'll be chronologically ordered. So it's easier to find updates. Basically, this is to say, always refer back to the GitHub repo first. And if you do to find a mistake, or something isn't working the way you expected, jump into the conversation, leave a |
discussion, leave an issue, ask questions here, take breaks, I cannot tell you how many people tried rushing through our entire first course in one setting and didn't retain as much information, your brain remembers information much better if you take breaks. So every 25 minutes or half an |
hour, maybe take a five minute walk. And then every two hours take a much longer break. And if you really want to make sure something drills in, try to go back and reflect on what you did for the lesson prior before continuing to the next lesson. And at the same time, though, learn at your own speed. There |
is no right speed for this course. If it takes you a day, a week, a month or even a year, it doesn't matter. Learn at the pace that's right for you, you can change the speed at which I talked using the little gear icon in the YouTube video. If |
I'm talking way too fast for you, you can slow me down. And at the same time, if I'm talking too slow, you can speed me up, you also don't even have to go in order. You can bounce around topic to topic, if you don't want to learn full stack, you can skip the full stack stuff. If you don't want to learn |
coding, we can skip the coding stuff. If you only want to go to the advanced stuff, go to the advanced stuff. You are highly encouraged to pause, come back and ask questions. The blockchain and smart contract world is incredibly collaborative. So be sure to use tools like the discussions tab of our GitHub repository, asking questions on Stack Overflow and |
Aetherium Stack Exchange and tagging relative technologies, making issues on different GitHub repositories that you're working with jumping into discord, Reddit, Twitter, and any other place that these communities and technologies are congregating. And the reason I'm putting so much emphasis on |
these community aspects is that becoming a solidity and blockchain engineer is so much more than just the solidity part. Being comfortable with all the tools in this space, including the ones to get help and to give help are essential to being successful here. Networking is massive, and it |
makes it a ton of fun. As you continue your journey and you get more advanced and you're looking for places to meet other developers. Hackathons are one of the best places to connect with other engineers, the chainlink hackathons eath, global hackathons, and Dev folio hackathons are three great |
hackathon suites to connect. And no matter where you are in your journey, they're great places to flex what you've learned. Alright, so those are some of the best practices for this course. You're standing at the edge of the rabbit hole, looking down, peering into the world of web three and smart contracts |
and blockchain. If you're like me want to jump in, you want to keep going further. Let's begin our journey into the world of smart contracts. And it all starts with the blockchain basics. Now, I know you're excited to get coding. But before we jump in, we want to learn some |
of the fundamentals of blockchains and smart contracts. Understanding these ideologies and these basics are so important, because it'll dictate how you architect your decentralized applications, learning the basics of blockchain and solidity is critical. But if you already know the basics of a blockchain, feel free to jump into lesson |
two. Now, since you're here, you've probably heard of Bitcoin before. Bitcoin was one of the first protocols to use this revolutionary technology called blockchain. The Bitcoin white paper was created by the pseudo anonymous Satoshi Nakamoto, and outlined how Bitcoin can make |
peer to peer transactions. In a decentralized network. This network was powered by cryptography, decent Tality, and allowed people to engage in censorship resistant finance, in a decentralized manner due to its features, which we'll talk about in a little bit. People took to this as a superior |
digital store of value, a better store of value over something like gold, for example, and that's why you'll also hear people commonly refer to it as a digital gold similar to gold. There's a scarce amount or a set amount of bitcoin available on the planet, only so much that you can buy and sell. You can |
read more about the original vision in the white A paper we've linked to the white paper in the GitHub repo associated with this course. Now, this was an insane breakthrough in a little bit, we're going to learn exactly how this is all possible and how this actually works under the hood. Some people though, saw this technology and wanted to take it a little bit |
farther, and do even more with this blockchain technology. And a few years later, a man named Vitalik Buterin, released a white paper for a new protocol named Aetherium, which use this same blockchain infrastructure with an additional feature. And |
in 2015, him and a number of other co founders released the project Aetherium, where people could not only make decentralized transactions, but decentralized agreements, decentralized organizations, and all these other ways to interact with each other without a centralized intermediary or |
centralized governing force. Basically, their idea was to take this thing that made Bitcoin so great, and add decentralized agreements to it, or smart contracts. And in fact, technically, these smart contracts weren't even really a new idea. Back in 1994, a man named Nick Zabo, had actually |
originally come up with the idea smart contracts are a set of instructions executed in a decentralized autonomous way, without the need for a third party or centralized body to run them. And they come to life on these blockchains, or these smart contract platforms, like Aetherium. And it's the smart |
contracts that are going to be the core thing that we're going to be working on in this course, and that we're going to be developing, you can think of smart contracts in the same way you think of traditional contracts or traditional agreements. They're just a set of instructions between parties, except instead of written on pen and paper or typed up in |
Microsoft Word, they are written in code and embodied on these decentralized blockchain platforms. And that's also where they're executed. Instead of being executed by the two parties, or three parties, or however many parties that are involved. This removes this centralized issue that we'll |
talk about more in a bit. This is one of the main differentiators between the Etherium protocol and the Bitcoin protocol. It's these smart contracts. Now, technically, bitcoin does have smart contracts, but they're intentionally Turing incomplete, which means they don't have all the functionality that a programming language would give |
them. This was an intentional move by Bitcoin developers. Bitcoin developers viewed Bitcoin as a store of value versus Aetherium, developers viewed Aetherium as both a store of value and a utility to facilitate these decentralized agreements. Now, the smart contracts on blockchains alone |
are absolutely incredible. However, they do come with a huge issue. If we want these digital agreements to replace the agreements in our everyday lives, they probably are going to need data from the real world blockchains by themselves actually can't interact with and can't read or listen to data |
from the real world. This is what's known as the Oracle problem. These blockchains are deterministic systems and they're deterministic on purpose. And we'll learn about more about how that works in the sessions to come. So everything that happens with them happens in their little world. But if they're going to be these agreements, they need external |
data and they need external computation. And this is where Oracle's come into play. Oracle's are any device that delivers data to these decentralized blockchain or runs external computation. However, if we want our applications to stay truly decentralized, we can't work with a single Oracle |
or a single data provider or a single source that's running these external computations. So we need a decentralized Oracle network. Similar to our decentralized blockchain network, you're on chain logic will be decentralized, but you also need your off chain data and computation be |
decentralized, combining this on chain decentralized logic. With this off chain, decentralized data and decentralized computation gives rise to something called hybrid smart contracts. And most of the biggest protocols that we interact with today are some type of hybrid smart contract or |
interact with hybrid smart contracts. To some extent, this is where the protocol chaining comes into play. It is a modular, decentralized Oracle network that can both bring external data and external computation into our smart contracts to make sure they're decentralized end to end, while |
giving them the feature richness that we need for our agreements. chainlink allows for us to get data to upkeeps, get random numbers or really customize our smart contracts in any meaningful way. Now, throughout the course, we're going to use the terminology smart contract. However, whenever we say smart |
contract, we're often using it a little interchangeably with hybrid smart contracts, but just know that when we say hybrid smart contract, we're talking specifically about smart contracts that have some type of off chain component. Now since the theorems release, a number of different block chains or |
smart contract platforms have come to light such as avalanche polygon, Phantom harmony, and more. For the majority of this course, we're going to be assuming that we're going to be deploying to the Ethereum network. However, everything that we learned here is going to be applicable to the vast |
majority of the blockchains out there like polygon, avalanche, Phantom harmony, etc, and understanding everything from a theory and funding mentals will give you the skills that you need to switch chains very easily with literally one line of code. So don't worry about learning a specific tool or with |
a specific chain because most of them work together seamlessly. Now, there are a couple of smart contract platforms that don't use solidity. But still learning the fundamentals here will make you much better at those as well. And the Etherium by far has the most value locked and is the most used blockchain and |
smart contract platform out there. You'll also hear those two terms used a little bit interchangeably as well. Sometimes they'll say smart contract platform, sometimes they'll say blockchain, they kind of mean the same thing. Obviously, blockchains could mean store of value and smart contract platform, but you get the idea. Similarly, chainlink |
is the most popular and powerful decentralized Oracle network is the one that we're going to be focusing on for this course as well. chainlink is also blockchain agnostic. So to work on Aetherium, avalanche, Polygon Solana Terra, or really any other blockchain out there. Now, throughout this course, you'll |
hear the term DAP or decentralized Protocol, or smart contract Protocol, or decentralized application. And they all kind of mean the same thing. A decentralized application is usually the combination of many smart contracts. And when we get into solidity, you'll see what a singular smart contract really looks like. And like I said, |
learning all these core fundamentals will make you a better solidity and a better smart contract developer, you'll also hear the term web three a lot in this video. And in the industry, web three is the idea that blockchain and smart contracts are the next iteration of the web web one being this |
permissionless open source world with static content, web two being the permissioned web with dynamic content, but all the agreements and logic runs off of centralized servers where they control your information. And then web three comes back to the permissionless web. But once again, with dynamic content, and |
instead of centralized servers, running your logic, decentralized networks, run the logic creating these censorship resistant agreements, that the smart contracts enable is also generally accompanied by the idea that the users own the protocols that they work with, and it's an ownership economy. |
You'll see what I mean later in this course. And we've talked a lot about the history and about the high level of these protocols and of the smart contracts and what they can do. But what do these smart contracts really mean? What is it when I say trust, minimize agreements or unbreakable promises? What is the real value add of these smart contracts? |
Before we look under the hood, take a peek at how this all works. From a technical standpoint. Let's learn what all the value of this is. What is the purpose of us building all these technologies? Have you taken this course? What problem does this technology solve? In my mind, a technology is really |
only as good as the problem that it solves. If it doesn't solve a problem, then why bother Mark contracts, Blockchain web three cryptocurrencies, those are all just different words that encapsulate the idea of what we're doing in such a unique paradigm. I think the easiest way to sum up what these smart |
contracts do is that they create trust minimized agreements. And if you might be scratching your head to that. A much easier way to think about it is just that give rise to unbreakable promises. Yes, you heard that right. Unbreakable agreements and promises. Additionally, they give rise to speed, efficiency |
and transparency, and a number of other things. I made a video pretty recently about exactly this. So let's dive in and take a listen to the purpose the undeniable value of smart contracts cryptocurrencies, fundamentally |
re landscape markets and agreements as we know them. Unfortunately, you've probably only been bombarded with people screaming about empties and money. Now, some of the memes are fun, but let's forget the bullet and get down to the essence of the space. If you're already in web three. 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 in there 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 real tailor 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 they generate it's 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 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 real world example of |
someone breaking the Pinkie 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 in return, you get a chance to win $1 million. You can imagine McDonald's literally going Hey, |
everybody, I promise you if you buy our MC food and McNuggets, we'll give you a fair chance of winning this money, we 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 were 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 was 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 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? Once 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 want to get hit by a bus? I'm Patrick promises he'll go on a hike with me. Well, he actually I actually will. But the issue with our current agreements and contracts is we have to trust the people. We're 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 shit off the shelves and with my girlfriend, I promised to go on a hike. But I need hikes. Where else is has 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 they're just last year Robin Hood painted this amazing picture. On |
user 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 the finance side, 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 you? hyperinflation in Zimbabwe hyperinflation in Brazil, fair enough. US history is a relentless lesson of trustworthy entities being |
notorious promised 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 in 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 breaks 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 longer. 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 gonna 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 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. Real basics of it is that the code is executed by 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 and web three 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, then you're not interested in getting into 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 yet you use it every single day whenever you log on to 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,000,020 $4 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 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 ERC 20 tokens, which are kind of the equivalent of stocks, but some are some are, 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 an automated solvency checks, you can build a bank like smart contract that has insolvency |