0% found this document useful (0 votes)
49 views20 pages

Modulo1 Cyfrin Updraft Blockchain Basics

The document provides an overview of blockchain technology, focusing on Bitcoin and Ethereum, and the role of smart contracts and oracles in facilitating decentralized transactions. It discusses the limitations of traditional agreements based on trust and how smart contracts can eliminate these issues by being transparent, immutable, and automated. Additionally, it introduces concepts like Layer 2 scaling solutions and the evolution of the internet into Web3, emphasizing the potential of blockchain to revolutionize various industries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views20 pages

Modulo1 Cyfrin Updraft Blockchain Basics

The document provides an overview of blockchain technology, focusing on Bitcoin and Ethereum, and the role of smart contracts and oracles in facilitating decentralized transactions. It discusses the limitations of traditional agreements based on trust and how smart contracts can eliminate these issues by being transparent, immutable, and automated. Additionally, it introduces concepts like Layer 2 scaling solutions and the evolution of the internet into Web3, emphasizing the potential of blockchain to revolutionize various industries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Blockchain Basics

1. Welcome to Updraft
2. Best Practices
3. Meet the Instructors
4. zkSync Sponsorship
Bitcoin and Blockchain

You might be familiar with Bitcoin, which is one of the first protocols to utilize the
revolutionary blockchain technology. The Bitcoin Whitepaper, authored by the
pseudonymous Satoshi Nakamoto, described how Bitcoin could facilitate peer-to-peer
transactions within a decentralized network using cryptography. This gave rise to
censorship-resistant finance and presented Bitcoin as a superior digital store of value,
often referred to as digital gold. There is a fixed amount of Bitcoin, similar to the scarcity
of gold. You can learn more about this in the Bitcoin Whitepaper.

Ethereum and Smart Contracts

A few years after Bitcoin's creation, Vitalik Buterin and others founded Ethereum, which
builds upon the blockchain infrastructure, but with additional capabilities. With
Ethereum, you can create decentralized transactions, organizations, and agreements
without a centralized intermediary. This was achieved through the addition of smart
contracts.

Though the concept of smart contracts was originally conceived in 1994 by Nick Szabo,
Ethereum made it a reality.

Smart contracts are a set of instructions executed in a decentralized way without the
need for a centralized or third party intermediary.

Smart Contract functionality is the primary difference between blockchains like Ethereum
and Bitcoin. Technically Bitcoin does have smart contracts but they're intentionally turing
incomplete.

The Oracle Problem

However, smart contracts face a significant limitation – they cannot interact with or
access data from the real world. This is known as the Oracle Problem.

Blockchains are deterministic systems, so everything happens within their ecosystem. To


make smart contracts more useful and capable of handling real-world data, they need
external data and computation.

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're working with an Ethereum or EVM
environment. The skills you learn here will be compatible with the vast majority of
blockchain architectures!

Chainlink
Chainlink is a popular decentralized Oracle network that enables smart contracts to
access external data and computation. Chainlink is also blockchain agnostic - so it's going
to work with any chain out there.

Layer 2 Scaling Solutions

As blockchains grow, they face scaling issues. Layer 2, or L2, solutions have been
developed to address this. L2 solutions involve other blockchains hooking into the main
blockchain, essentially allowing it to scale. There are two primary types of L2 solutions:

 Optimistic Rollups: eg. Optimism, Arbitrum

 Zero-Knowledge Rollups: eg. ZKsync, Polygon ZK EVM

Don't worry too much about this now. Once we understand how blockchains work 'under
the hood', we'll go further into Layer 2's then.

Terminology

You're going to hear some terms used in this course (and the community as a whole) a
little interchangeably. Maybe you haven't heard these terms before. I hope this offers a
bit of clarification.

Common Terms:

1. Blockchain: In web3, a blockchain is a digital ledger that records transactions across


many computers in a secure and decentralized manner. Each block contains a number
of transactions, and every new block is linked to the previous one, forming a chain.
This makes the data tamper-resistant. Example: Bitcoin's blockchain records all BTC
transactions.

2. Oracle: Oracles in web3 are intermediaries that provide smart contracts with
external data. They act as bridges between blockchains and the outside world,
allowing smart contracts to execute based on real-world events and data. Example:
A weather oracle provides data for a smart contract that triggers crop insurance
payments based on rainfall data.

3. Layer 2: Layer 2 solutions in web3 are technologies built on top of a blockchain


(Layer 1) to improve its scalability and efficiency. These solutions handle transactions
off the main chain, reducing congestion and fees, and then settle the final state on
the main chain. Example: The Lightning Network for Bitcoin.

4. Dapp (Decentralized Application): A Dapp is an application that runs on a


decentralized network, typically a blockchain. It is powered by smart contracts and
operates without a central authority. Dapps can serve various purposes, from finance
to gaming. Example: Uniswap, a decentralized finance application.

5. Smart Contract: In web3, a smart contract is a self-executing contract with the terms
of the agreement directly written into code. They run on blockchains and
automatically execute when predetermined conditions are met, without the need for
intermediaries. Example: A smart contract for an escrow service.

6. Hybrid Smart Contract: Hybrid smart contracts combine on-chain code (running on a
blockchain) with off-chain data and computations provided by oracles. This allows
the contracts to interact with data and systems outside their native blockchain.
Example: A smart contract for insurance that uses real-world data (like weather or
flight delays) provided by oracles.

7. Ethereum/EVM (Ethereum Virtual Machine): Ethereum is a blockchain platform


known for its smart contract functionality. The Ethereum Virtual Machine (EVM) is its
computation engine that executes smart contracts. Ethereum allows developers to
build decentralized applications and is the basis for many web3 projects. Example:
ERC-20 tokens, a standard for creating fungible tokens on Ethereum.

Web3

Web3 is a term used to describe the new paradigm of the internet powered by blockchain
and smart contracts. Unlike the previous versions of the web, web3 is permissionless and
relies on decentralized networks rather than centralized servers. This ushers in an era of
censorship-resistant and transparent agreements and transactions, often called an
ownership economy.

Web1: The permissionless open sources web with static content

Web2: The permissioned web, with dynamic content where companies run your
agreements on their servers.

Web3: The permissionless web with dynamic content.

 Decentralized censorship resistant networks run your agreements and code.

 User owned ecosystems where one owns a portion of the protocol they interact with
- instead of solely being the product

Wrap Up

We've taken a high-level view of the blockchain landscape, including its history and the
problems that smart contracts solve.

At this point you might be asking yourself what do these smart contracts really mean? or
what is meant by trust minimized agreements/unbreakable promises?

In my mind a technology is really only as good as the problem it solves. So next, we're
going to look at what the purpose of smart contracts is - what's the value proposition
exactly?

Let's take a closer look at the undeniable value of smart contracts in the next lesson.

5. What is a Blockchain?

Bitcoin and Blockchain


You might be familiar with Bitcoin, which is one of the first
protocols to utilize the revolutionary blockchain technology.
The Bitcoin Whitepaper, authored by the pseudonymous
Satoshi Nakamoto, described how Bitcoin could facilitate peer-
to-peer transactions within a decentralized network using
cryptography. This gave rise to censorship-resistant finance
and presented Bitcoin as a superior digital store of value, often
referred to as digital gold. There is a fixed amount of Bitcoin,
similar to the scarcity of gold. You can learn more about this in
the Bitcoin Whitepaper.
Ethereum and Smart Contracts
A few years after Bitcoin's creation, Vitalik Buterin and others
founded Ethereum, which builds upon the blockchain
infrastructure, but with additional capabilities. With Ethereum,
you can create decentralized transactions, organizations, and
agreements without a centralized intermediary. This was
achieved through the addition of smart contracts.
Though the concept of smart contracts was originally
conceived in 1994 by Nick Szabo, Ethereum made it a reality.
Smart contracts are a set of instructions executed in a
decentralized way without the need for a centralized or third
party intermediary.
Smart Contract functionality is the primary difference between
blockchains like Ethereum and Bitcoin. Technically Bitcoin
does have smart contracts but they're intentionally turing
incomplete.
The Oracle Problem
However, smart contracts face a significant limitation – they
cannot interact with or access data from the real world. This is
known as the Oracle Problem.
Blockchains are deterministic systems, so everything happens
within their ecosystem. To make smart contracts more useful
and capable of handling real-world data, they need external
data and computation.
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're working with an
Ethereum or EVM environment. The skills you learn here will
be compatible with the vast majority of blockchain
architectures!
Chainlink
Chainlink is a popular decentralized Oracle network that
enables smart contracts to access external data and
computation. Chainlink is also blockchain agnostic - so it's
going to work with any chain out there.
Layer 2 Scaling Solutions
As blockchains grow, they face scaling issues. Layer 2, or L2,
solutions have been developed to address this. L2 solutions
involve other blockchains hooking into the main blockchain,
essentially allowing it to scale. There are two primary types of
L2 solutions:
 Optimistic Rollups: eg. Optimism, Arbitrum
 Zero-Knowledge Rollups: eg. ZKsync, Polygon ZK EVM
Don't worry too much about this now. Once we understand
how blockchains work 'under the hood', we'll go further into
Layer 2's then.
Terminology
You're going to hear some terms used in this course (and the
community as a whole) a little interchangeably. Maybe you
haven't heard these terms before. I hope this offers a bit of
clarification.
Common Terms:
1. Blockchain: In web3, a blockchain is a digital ledger that
records transactions across many computers in a secure and
decentralized manner. Each block contains a number of
transactions, and every new block is linked to the previous
one, forming a chain. This makes the data tamper-resistant.
Example: Bitcoin's blockchain records all BTC transactions.
2. Oracle: Oracles in web3 are intermediaries that provide
smart contracts with external data. They act as bridges
between blockchains and the outside world, allowing smart
contracts to execute based on real-world events and data.
Example: A weather oracle provides data for a smart
contract that triggers crop insurance payments based on
rainfall data.
3. Layer 2: Layer 2 solutions in web3 are technologies built
on top of a blockchain (Layer 1) to improve its scalability
and efficiency. These solutions handle transactions off the
main chain, reducing congestion and fees, and then settle the
final state on the main chain. Example: The Lightning
Network for Bitcoin.
4. Dapp (Decentralized Application): A Dapp is an
application that runs on a decentralized network, typically a
blockchain. It is powered by smart contracts and operates
without a central authority. Dapps can serve various
purposes, from finance to gaming. Example: Uniswap, a
decentralized finance application.
5. Smart Contract: In web3, a smart contract is a self-
executing contract with the terms of the agreement directly
written into code. They run on blockchains and
automatically execute when predetermined conditions are
met, without the need for intermediaries. Example: A smart
contract for an escrow service.
6. Hybrid Smart Contract: Hybrid smart contracts combine
on-chain code (running on a blockchain) with off-chain data
and computations provided by oracles. This allows the
contracts to interact with data and systems outside their
native blockchain. Example: A smart contract for insurance
that uses real-world data (like weather or flight delays)
provided by oracles.
7. Ethereum/EVM (Ethereum Virtual Machine): Ethereum
is a blockchain platform known for its smart contract
functionality. The Ethereum Virtual Machine (EVM) is its
computation engine that executes smart contracts. Ethereum
allows developers to build decentralized applications and is
the basis for many web3 projects. Example: ERC-20 tokens,
a standard for creating fungible tokens on Ethereum.
Web3
Web3 is a term used to describe the new paradigm of the
internet powered by blockchain and smart contracts. Unlike the
previous versions of the web, web3 is permissionless and relies
on decentralized networks rather than centralized servers. This
ushers in an era of censorship-resistant and transparent
agreements and transactions, often called an ownership
economy.
Web1: The permissionless open sources web with static
content
Web2: The permissioned web, with dynamic content where
companies run your agreements on their servers.
Web3: The permissionless web with dynamic content.
 Decentralized censorship resistant networks run your
agreements and code.
 User owned ecosystems where one owns a portion of the
protocol they interact with - instead of solely being the
product
Wrap Up
We've taken a high-level view of the blockchain landscape,
including its history and the problems that smart contracts
solve.
At this point you might be asking yourself what do these smart
contracts really mean? or what is meant by trust minimized
agreements/unbreakable promises?
In my mind a technology is really only as good as the problem
it solves. So next, we're going to look at what the purpose of
smart contracts is - what's the value proposition exactly?
Let's take a closer look at the undeniable value of smart
contracts in the next lesson.

6. The Purpose of Smart Contracts

The Essence of Blockchain and Smart Contracts


Almost every interaction or transaction in our lives involves
some form of agreement or contract. For instance,
purchasing a chair involves a contract to buy lumber,
assemble it, and sell the finished product. Your electricity
supply is also based on an agreement between you and the
electric company. When you get an oil change for your car,
you're promised a service in exchange for money.
Almost everything we do in modern life relates to an
agreement or contract in some way.
To make it more relatable, think of contracts and
agreements as promises. Traditional contracts, however,
require trust between parties, and this doesn’t always work
in favor of honesty and fairness.
The Problem with Traditional Agreements
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
In the 80s and 90s, McDonald’s Monopoly game promised
customers a chance to win money through game cards
obtained with purchases. However, it turned out that the
game was rigged by insiders who manipulated the system
for their gain. Essentially, McDonald’s failed to keep its
promise.
This example demonstrates that relying on trust within
agreements can lead to fraudulent activities and broken
promises.
With smart contracts, we can eliminate the need for trust. A
smart contract is an agreement or a set of instructions that
are deployed on a decentralized blockchain. Once deployed,
it cannot be altered, it automatically executes, and everyone
can see its terms.
Imagine if McDonald’s Monopoly game was operated on a
blockchain through a smart contract. The fraudulent
activities would have been impossible due to the immutable,
decentralized, and transparent nature of smart contracts.
Banking and Trust
Traditional banks have sometimes failed to keep the promise
of safeguarding people's money, as seen during the Great
Depression. Blockchain and smart contracts can ensure
transparency and execute automated solvency checks,
preventing the bank from becoming insolvent.
The core of blockchain and smart contracts lies in creating a
trustless system where agreements are transparent,
unchangeable, and executed without human intervention.
This technology holds the potential to revolutionize
industries and everyday agreements by ensuring honesty
and fairness.
Financial Markets Access
Centralized bodies, like traditional exchanges, have the
power to restrict access to financial markets. This was
evident when Robinhood restricted trading on certain assets
in 2021. With decentralized exchanges like Uniswap, there is
no central authority that can alter or limit market access.
This introduces fairness and openness to the financial
markets.
To Summarize
 Traditional Agreements: Require trust in a centralized
entity.
 Smart Contracts: Transparent, decentralized, and tamper-
proof.
In a scenario where you have to choose, smart contracts are
an obvious choice as they cannot be manipulated or altered
in anyone's favor.
Smart contracts are the solution to minimizing the reliance
on trust based systems that have historically failed us time
and time again.
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 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.
Beyond Trust Minimization
It is important to note that blockchain, smart contracts, and
cryptocurrencies are not just about trust-minimized
agreements. They offer security benefits, uptime
advantages, execution speed, and much more.
Caution: Not All Are Equal
However, beware of platforms that claim to be decentralized
but are not in practice. An example from 2022 is the SBF's
FTX platform. It presented itself as a Web3 platform, but was
essentially a traditional Web2 company using cryptocurrency
without the benefits of smart contracts.
As an emerging developer or user in this space, it's important
to discern between legitimate projects and those that aren't
contributing to the ethos of Web3. I want you to be
successful, but I want you to be successful because you're
creating value. Platforms like FTX were pretending to bring
value to the space and leeching value from it.
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 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.
Lastly, it's important to note that there are several actors,
such as FTX which pretend to embody the ideologies of
Web3, but are really centralized entities looking to extract
value from the system, be aware of these.
In the next lesson, we'll look at some of the specific features
of smart contracts and consider a few examples of their
applications.

7. Quiz: Blockchain Basics Introduction


8. Quick Recap
9. Current Smart Contract Landscape
10. Setting Up Wallet
11. Quiz: Blockchain Basics Mid Section Recap
12. Sending Your First Transaction Tenderly
13. A Note on Testnets
14. Sending First Transaction on Testnet
15. Introduction to Gas
16. How Do Blockchains Work
17. Signing Transactions
18. Gas in Depth
19. Blockchain Overview
20. L1s, L2s, and Rollups
21. Centralized Sequencers
22. Quiz: Blockchain Basics Recap
23. Rollup Stages
24. Making Your First Transaction on zkSync
25. Why zkSync Is Our Recommended Chain
26. Congratulations

1. Welcome to Updraft

Quick tip, we will be constantly using resources from the GitHub Repo

Welcome to Cyfrin Updraft!

Hello and welcome! If you're interested in the world of Web3 development, then you're in
the right place. This is the most cutting edge and comprehensive course ever created.

Let's talk about what to expect.

Why Take This Course?

With the massive demand for Solidity and Smart Contract developers, this course is a golden
opportunity to launch, advance, or switch to a career in Web3. As you navigate the course,
you will learn how to work with AI tools so that you can fast-track your learning journey and
become a proficient 10x developer.

Don't worry if you've never coded before, let me assure you that this course is designed for
learners at all levels. If you're an experienced Smart Contract engineer or familiar with
blockchain development, you're welcome to skip around and cherry-pick modules that
interest you. But most importantly, this course aims to turn you into a pioneering force
within Web3.

Who Am I?

My name is Patrick Collins, a seasoned Smart Contract engineer, security researcher, and
dedicated advocate for Web3. I co-founded Cyfrin, a Smart Contract Security firm, I'm an
average Web3 YouTuber and the co-creator of Cyfrin Updraft.

I live and breathe smart contract development.

But beyond that, I love taking passionate smart contract developers, like you, into the
journey of Web3.

What to Expect

This is not your run-of-the-mill course. Instead, it's a culmination of all the knowledge we've
accumulated after years of working in this industry as a Smart Contract developers and
security researchers. Our track record guarantees you'll exit the other side, armed with the
knowledge necessary to make a significant impact in the cryptocurrency and blockchain
industry.

Beyond just teaching you to code, this course prepares you to maneuver DeFi, NFTs, DAOs,
Tokens, Upgradeable Smart Contracts and more. By the end, you'll have a clear path forward
and a wealth of economic opportunities at your disposal – all you need is the willingness to
take the steps.

Best Practices

Let's start by covering some of the best practices to help you get the absolute most out of
this course.

Use the GitHub repo as your Bible! it will have all the resources you'll need to succeed.
Contained within, you'll find a discussions tab. Any questions you have or hurdles you face
can be posted here!

Ask meaningful questions and interact with like-minded learners – this is just as important
as grasping the actual technologies.

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 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.

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, Peeranha and other forums. Join our Discord server and have conversations with
developers just like yourself.
Remember: A challenge is not a roadblock, but an opportunity to learn something new.

Let's Get Started

With the above understanding in place, get ready. We're above to embark on a journey of
knowledge and opportunity.

Our first step will be understanding how the blockchain even works, what smart contracts
even are.

Let's get Froggy 🐸

2. Best Practices

Follow along with the video

Introduction

Welcome to the Cyfrin Updraft. This platform offers a comprehensive learning experience by
combining video lessons, written content, and interactive discussions.

Resources

In the top right corner of the lesson view, you'll find a link to the GitHub resources 📂 page.
This guide contains all the code, information, and materials necessary for the course. On
GitHub, the discussions tab 💬 allows you to interact with fellow learners and the community,
where you can ask questions, share insights, and solve problems collaboratively.

Next to the video lesson, there is a written lesson tab 📝. This tab provides the course content
in text format, which is useful for reading along, copy-pasting code snippets or reviewing
updates.

If you're watching on YouTube, links to these resources are available in the video description.
However, watching this course on Cyphrin Updraft offers additional benefits like tracking
your progress and accessing written lessons, which will enhance your learning experience.

Best Practices for Learning

1. 🌐 Engage with the Community by using GitHub discussions and Discord for real-time
communication. Remember that asking questions and interacting with others can
greatly enhance your understanding and retention of the material.

2. Take Regular Breaks: Avoid cramming all the information in one go because your
brain needs time to process and absorb the knowledge.

3. ⏩ Adjust the Video Playback Speed: Use the speed controls in the video player to
match the pace of the lesson with your learning speed.

4. 📝 Use Subtitles if Needed: If English isn't your first language, take advantage of the
subtitle options available in the video settings.
5. 🔄 Follow a Modular Approach: The course is designed to be flexible. You can jump
between topics based on your interests and needs. Revisit lessons to reinforce your
knowledge and ensure thorough understanding.

6. 🎯 Utilize Quizzes and Coding Challenges: Cyfrin Updraft offers both quizzes and
coding challenges. You'll find quizzes at the end of each section and coding
challenges at the end of each GitHub repository section. These will let you earn NFTs
as badges of honor for your achievements.

7. ❓ Learn to Ask Well-Formatted Questions: Asking questions is a skill too. Remember


this when you are asking clear, concise questions in forums and discussions to get the
best help from others.

🧑‍💻 Test Yourself

1. 📕 Provide at least 5 recommended best practices to follow throughout this course.

Conclusion

By following these guidelines, you'll be well-equipped to make the most out of this course.
Engaging with the community, pacing your learning, and utilizing Cyfrin Updraft resources
will significantly enhance your learning experience.

16. How do Blockchains Work

Understanding Hash Functions

Follow along with this video:

In this lesson, we're going to break down blockchains, the process and the technology itself
using a widely-praised and accessible demo available here.

Understanding Hash Functions

At its simplest, a hash is a unique, fixed-length string that serves to identify any piece of data.
When you input any kind of data into a hash function, it produces a hash. In this demo, the
hash algorithm we'll focus on is SHA-256.
If I add Patrick Collins to our SHA-256 algorithm, it will:

1. Convert the letters to numbers

2. Convert the numbers to a fixed-length “string” or “hash”

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.

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."
A block takes the same data input, but instead of a singular data field, a block is divided into
'block', 'nonce', and 'data.' All three are then run through the hash algorithm, producing the
hash for that block. As a result, even a minor change in the data leads to an entirely different
hash, hence, invalidating the block.

In essence, mining involves the computational trial and error process of finding an acceptable
value to produce a hash which typically follows a certain pattern, such as starting with four
zeros. The value found, which satisfies this criterion, is known as the 'nonce'.

The problem or criteria a miner has to solve will vary from blockchain to blockchain, but the
concept is the same.

The Inherent Beauty of Blockchain: Immutability

In a blockchain, which is essentially a sequence of blocks, each block is comprised of the


previous elements - a block number, a nonce and data - as well as the hash of the previous
block

What this means in practice is that any changes to data, in any block of the chain, will
invalidate every proceeding block, until they are recalculated, or re-mined.
Genesis Block: This is the first block in a blockchain.

Decentralized Distribution

Now, if a single entity were to control the blockchain, they could conceivably change any data
they want, and then re-mine, or re-validate subsequent blocks. This is bad.

Enter Decentralized Distribution.

The crux of blockchain's power lies in its decentralization or distributed nature. Under this
system, multiple entities or "peers" run the blockchain technology, each holding equal weight
and power. In the event of disparity between the blockchains run by different peers (due to
tampering or otherwise), the majority hash wins, as the majority of the network agrees on it.

Nodes that don't agree with the majority effectively fork the network, continuing on their own
with their own history.

Interplay of Blockchain & Transactions

Until now we've been considering the data passed in a block to be a random string of text, but
the reality is - this data can be anything. In the token and coinbase sections of this demo you
can see how each block is comprised of a number of transactions that all get hashed together.
Any edits to any of these transactions is going to invalidate the chain!
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.

In our next lesson we'll look more closely at private keys, wallets and signing transactions!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy