Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main --> dev #202

Merged
merged 12 commits into from
Sep 16, 2024
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Welcome to the course!!!!<3
title: Welcome to the course!!!!<3
---

_Follow along with the video_
Expand Down Expand Up @@ -46,17 +46,17 @@ Let's start by covering some of the best practices to help you get the absolute

**Code along with me** - As we progress through the course, it's a good idea to code along with me. Actually _doing_ the work and performing the actions is how you'll build familiarity with these processes and how they'll really stick.

**Watch for Updates** - This space moves very quickly - as things are updated, I do my best to catalogue them. In each video, at the bottom, there will be an "updates" section if there is some information that differs from the vide.
**Watch for Updates** - This space moves very quickly - as things are updated, I do my best to catalogue them. In each video, at the bottom, there will be an "updates" section if there is some information that differs from the video.

**Move at your Pace** - Adjust the pace of the course to meet your needs. The course is modular, so if you want to skip to particular areas - absolutely do that.

**Reflect on your Learnings** - repetition is the mother of skill. The more you repeat these development practices, the more they'll stick
**Reflect on your Learnings** - repetition is the mother of skill. The more you repeat these development practices, the more they'll stick.

**Complete the Optional Challenges** - The GitHub Repo has links to fun challenges at the end of each lesson - these are meant to test your skills and reward you with a fun way to show of your progress as a smart contract developer!

**Leverage the Community** - Blockchain development is incredibly collaborative. Get involved on [**GitHub**](https://github.com/Cyfrin/foundry-full-course-f23/discussions), [**Peeranha**](https://peeranha.io/) and other forums. Join our [**Discord**](https://discord.gg/cyfrin) server and have conversations with developers just like yourself.

> **Remember:** a challenge is not a roadblock, but an opportunity to learn something new.
> **Remember:** A challenge is not a roadblock, but an opportunity to learn something new.

### Let's Get Started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The transaction fee is the amount rewarded to the block producer for processing

> Gas price is not to be confused with gas. While gas refers to the computational effort required to execute the transaction, gas price is the cost per unit of that effort.

When we click on "more details" in a transaction overview, we can see further information including the `gasLimit and Usage by transaction`.
When we click on "more details" in a transaction overview, we can see further information including the `Gas Limit and Usage by transaction`.

Now, let's address an important question: who gets these transaction fees and why?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ If I add `Patrick Collins` to our `SHA-256` algorithm, it will:

`Patrick Collins` gets converted to `7e5b5a1a6b80e2908b534dd5728a998173d502469c37121dd63fca283068077c`

Ethereum, uses its own version of a hashing algorithm (Keccak256)that isn't exactly SHA-256 but belongs to the SHA family. This doesn't change things significantly here as we're primarily concentrating on the concept of hashing.
Ethereum, uses its own version of a hashing algorithm (Keccak256) that isn't exactly SHA-256 but belongs to the SHA family. This doesn't change things significantly here as we're primarily concentrating on the concept of hashing.

In the application, whatever data you enter into the data section, undergoes processing by the SHA-256 hash algorithm resulting in a unique hash.

> For example, when I input my name as "Patrick Collins," the resulting hash uniquely represents "Patrick Collins." The fascinating aspect is, no matter how much data is input, the length of the generated hash string remains constant.

### Understanding Blocks

Now that we've grasped the concept of hashing and fixed-length string, let's inspect the structure of a blockchain—a collection of "blocks."
Now that we've grasped the concept of hashing and fixed-length string, let's inspect the structure of a blockchain. A collection of "blocks."

::image{src='/blockchain-basics/07-how-do-blockchains-work/how-do-blockchains-work2.png' style='width: 100%; height: auto;' alt='blockchain'}

Expand Down Expand Up @@ -69,6 +69,6 @@ Until now we've been considering the data passed in a block to be a random strin

### Wrap Up

To summarize, every transaction, block, and indeed the whole blockchain itself comes down to understanding the concept of a hash—this unique fixed-length string that is intrinsically linked with the original data. We've also underscored the importance of decentralization and highlighted how the concept of immutability plays into the system's security.
To summarize, every transaction, block, and indeed the whole blockchain itself comes down to understanding the concept of a hash. This unique fixed-length string that is intrinsically linked with the original data. We've also underscored the importance of decentralization and highlighted how the concept of immutability plays into the system's security.

In our next lesson we'll look more closely at private keys, wallets and signing transactions!
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Understanding the relationship between private and public keys is essential to g

The private key is then passed through an algorithm (the [**Elliptic Curve Digital Signature Algorithm**](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) for Ethereum and Bitcoin) to create the corresponding public key. Both the private and public keys are central to the transaction process. However, while the private key must remain secret, the public key needs to be accessible to everyone.

When we send a transaction to the blockchain, we're passing a private key - this allows others to verify the transaction through the generated public key
When we send a transaction to the blockchain, we're passing a private key. This allows others to verify the transaction through the generated public key.

::image{src='/blockchain-basics/08-signing-transactions/signing-transactions1.png' style='width: 100%; height: auto;' alt='signing-transactions1'}

Expand All @@ -42,7 +42,7 @@ Anyone with access to your private key can perform and sign transactions, on you

Lets recap some of the things covered in this lesson.

We discovered that transactions on the blockchain are signed using a user's `private key`, the generated `message signature` can then be verified by anyone through a comparison to a user's `public key`.
We discovered that transactions on the blockchain are signed using a user's `private key`. The generated `message signature` can then be verified by anyone through a comparison to a user's `public key`.

**KEEP YOUR PRIVATE KEY SECURE!**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ It's important to note that many of the concepts we've covered and will cover ar

Traditionally, when you run an application be it a website or something that connects to a server you are interacting with a centralized entity. This is the opposite of what you may recall from our distributed blockchain example, in that the server is controlled and run by a single centralized group.

Blockchains, as we saw, run on a network of independent nodes. In our previous example, each of the `Peers` was representative of an independent `node` operator. The term `node` typically refers to a single instance of a decentralized system, Peer A would be a `node`. This network, this combination of these nodes interacting with each other is what creates a blockchain. What makes these networks so potent, is that anybody can join. All anyone needs is a little bit a hardward and you can participate in securing a blockchain network. You could go to GitHub and start operating a node in a few seconds!
Blockchains, as we saw, run on a network of independent nodes. In our previous example, each of the `Peers` was representative of an independent `node` operator. The term `node` typically refers to a single instance of a decentralized system, Peer A would be a `node`. This network, this combination of these nodes interacting with each other is what creates a blockchain. What makes these networks so potent, is that anybody can join. All anyone needs is a little bit of hardware and you can participate in securing a blockchain network. You could go to GitHub and start operating a node in a few seconds!

In the traditional world applications are run by centralized entities and if that entity goes down or is malicious or decides that they want to shut off - they just can. They're the ones that control everything.

Blockchains, by contrast, don't have this problem. If one node or one entity that runs several nodes goes down, since there are so many other independent nodes running, it doesn't matter, the blockchain and the system will persist so long as there is at least one node always running. Luckily for us, the most popular chains like Bitcoin and ethereum have thousands and thousands of nodes. Malicious nodes are kicked from the network, or even punished in some cases. Majority rules when it comes to the blockchain.
Blockchains, by contrast, don't have this problem. If one node or one entity that runs several nodes goes down, since there are so many other independent nodes running, it doesn't matter, the blockchain and the system will persist so long as there is at least one node always running. Luckily for us, the most popular chains like Bitcoin and Ethereum have thousands and thousands of nodes. Malicious nodes are kicked from the network, or even punished in some cases. Majority rules when it comes to the blockchain.

This gives blockchains this incredibly potent immutability trait where nothing can be changed or corrupted so in essence we can think of a blockchain as a decentralized database. In the case of Ethereum it has an extra additional feature where it also can do computation in a decentralized manner now.

Expand All @@ -34,11 +34,11 @@ Let's talk consensus. This includes `Proof of Work` and `Proof of Stake`. You've

The `mining` feature of our previous blockchain example was an example of `Proof of Work`

`Proof of Work` and `Proof of Stake` fall under this umbrella of `consensus` and `consensus` is a really important topic when it comes to blockchains.
`Proof of Work` and `Proof of Stake` fall under this umbrella of `consensus`. And `consensus` is a really important topic when it comes to blockchains.

> `Consensus` is defined as the mechanism used to reach an agreement on the state or a single value on the blockchain especially in a decentralized system.

Very roughly, a consensus protocol in a blockchain or decentralized system can be broken down into two pieces a chain selection algorithm and a sybil resistance mechanism. Mining, or Proof of Work, is a sybil resistance mechanism. This is what Bitcoin currently uses.
Very roughly, a consensus protocol in a blockchain or decentralized system can be broken down into two pieces: a chain selection algorithm and a sybil resistance mechanism. Mining, or Proof of Work, is a sybil resistance mechanism. This is what Bitcoin currently uses.

`Proof of Work` is known as a sybil resistance mechanism because it defines a way to figure out who is the block author or which node did the work to mine a block. Sybil resistance is a blockchain's ability to defend against users creating a large number of pseudo-anonymous identities to gain a disproportionately advantageous influence over said system.

Expand All @@ -61,7 +61,7 @@ A `chain selection rule` is implemented as a means to determine which blockchain

In the `longest chain rule`, the decentralized network decides that whichever chain has the most number of blocks will be the valid, or _real_ blockchain. When we saw `block confirmations` in Etherscan earlier, this was representing the number of blocks ahead of our transaction in the longest chain.

> You'll sometimes hear people use **Proof of Work** to describe a consensus mechanism, but it's a little bit inaccurate, it's really the combination of sybil resistance _and_ chain selection that create consensus
> You'll sometimes hear people use **Proof of Work** to describe a consensus mechanism, but it's a little bit inaccurate, it's really the combination of sybil resistance _and_ chain selection that create consensus.

`Proof of Work` also serves as a means to determine who receives transaction fees as we discussed earlier. These transaction fees are paid by whomever initiates the transaction. In a Proof of Work system, every node is competing against eachother to solve the block problem first. The first node to solve the problem gets paid the transaction fees accumulated in the block they mine. In addition to this, miners are also paid a `block reward`, the `block reward` is given by the blockchain itself.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Follow along with the video_

### Introduction

A Layer 2 (L2) chains maturity is evaluated based on specific properties and categorized into **stages**. The [L2B team](https://l2beat.com/scaling/summary) provides an opinionated assessment to encourage a progression towards a greater decentralization.
A Layer 2 (L2) chain's maturity is evaluated based on specific properties and categorized into **stages**. The [L2B team](https://l2beat.com/scaling/summary) provides an opinionated assessment to encourage a progression towards a greater decentralization.

### Rollup Stages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Follow along with the video_

### Introduction

At Cyfrin, we're committed to providing the best tools and platforms to excel as smart contract developer. This course is proudly sponsored by ZK Sync, a leading solution we believe in and use ourselves. Here's why we're choosing ZK Sync Era, a layer 2 ZK roll-up, for our smart contract deployment throughout this course.
At Cyfrin, we're committed to providing the best tools and platforms to excel as a smart contract developer. This course is proudly sponsored by ZK Sync, a leading solution we believe in and use ourselves. Here's why we're choosing ZK Sync Era, a layer 2 ZK roll-up, for our smart contract deployment throughout this course.

### Key Reasons to Use ZK Sync Era

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Blockchains are deterministic systems, so everything happens within their ecosys

Oracles serve this purpose. They are devices or services that provide data to blockchains or run external computation. To maintain decentralization, it's necessary to use a decentralized Oracle network rather than relying on a single source. This combination of on-chain logic with off-chain data leads to `hybrid smart contracts`.

> **Note:** Most of this course will assume we'r working with an Etherum or EVM environment. The skills you learn here will be compatible with the vast majority of blockchain architectures!
> **Note:** Most of this course will assume we're working with an Etherum or EVM environment. The skills you learn here will be compatible with the vast majority of blockchain architectures!

### Chainlink

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To make it more relatable, think of contracts and agreements as promises. Tradit

### The Problem with Traditional Agreements

Lets consider some real world examples of where trust leverages agreements can go wrong and why blockchain technology and smart contracts mitigates these risks.
Lets consider some real world examples of where trust leveraged agreements can go wrong and why blockchain technology and smart contracts mitigate these risks.

### Consumer Trust

Expand Down Expand Up @@ -49,7 +49,7 @@ Smart contracts are _the_ solution to minimizing the reliance on trust based sys

### Under the Hood

Smart contracts are relatively new, but have already started transforming various markets. They do this by representing 'promises' as code on the blockchain. This code is executed by a decentralized collective, such that no single entity can alter the agreemeent in any way! The agreement and it's terms are public knowledge and will automatically execute without human intervention.
Smart contracts are relatively new, but have already started transforming various markets. They do this by representing 'promises' as code on the blockchain. This code is executed by a decentralized collective, such that no single entity can alter the agreemeent in any way! The agreement and its terms are public knowledge and will automatically execute without human intervention.

More industries are adopting smart contracts and blockchain due to the numerous advantages they offer. This results in trust-minimized agreements or what can be simply termed as unbreakable promises.

Expand All @@ -65,7 +65,7 @@ As an emerging developer or user in this space, it's important to discern betwee

### Wrap Up

What we've learnt is that traditional contracts or agreements between parties are almost always trust based. Trust based agreements come with inherent flaws and the potential of broken agreements, the conseequences of which we've seen throughout history - The Great Depression, Monopoly Lottery, Robin Hood etc.
What we've learnt is that traditional contracts or agreements between parties are almost always trust based. Trust based agreements come with inherent flaws and the potential of broken agreements, the consequences of which we've seen throughout history - The Great Depression, Monopoly Lottery, Robin Hood etc.

Blockchain technology and smart contracts solve these problems by introducing fairness, transparency and immutability to promises. These attributes of smart contracts assure that trust isn't required and we can be certain that an agreement will be executed as described 100% of the time.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _Follow along with this video:_

Smart contracts come with various features that distinguish them from traditional agreements.

### Decentralization This is edited
### Decentralization

The first feature is decentralization; smart contracts do not rely on any centralized intermediary. Instead, they run on a blockchain which is maintained by thousands of individuals known as node operators. It's the collective effort of these node operators running the smart contracts that make the network decentralized. This aspect will be discussed more in-depth later.

Expand Down
Loading