Bootcamp - Nov '24
Bootcamp - Nov '24
Blockchain
Fundamentals
November 2024
Chainlink Blockchain Fundamentals
Session 01
Introduction to blockchain and
Ethereum
Agenda
What is Blockchain
Blockchain Fundamentals
Web3 and decentralizations
Ethereum Blockchain
What is
Blockchain
What is a Blockchain?
➔ Transactions
➔ Timestamp
➔ Hash of the previous block
➔ Nonce
What Are Transactions?
➔ Transfer of value
➔ Data
◆ A message from one address to another
◆ A smart contract deployment
◆ An interaction with a smart contract
Blockchain = Chain of Blocks
Block 01 Block 02 Block 03 Block 04
Game Theory
Cryptography
Cryptography Definition
➔ Information can be known only to its recipient (holder of the "secret key")
➔ Only the recipient of the message can read the information easily
➔ Hash Function
➔ Public and Private Key
➔ Merkle Tree
Hash Function
HASH Function
➔ Fast
➔ One way: from the hash it is not possible to return to the original
Private Key in ➔ anyone can encrypt a ➔ only the private key owner
Blockchain message using the can sign/authorize
recipient's public key. transactions (digital
signature)
➔ only the private key owner
can decrypt messages ➔ The public key confirms
encrypted with the the sender's identity,
corresponding public key. verifying that the private
key holder sent the
message.
Authentication (Digital Signature)
Authentication:
● only the private key owner can sign/authorize transactions (digital
signature)
● The public key confirms the sender's identity, verifying that the private key
https://github.com/LearnWeb3DAO/Merkle-Trees
Verify if the transaction exist
➔ Messages can be
intercepted or generals
can be dishonest
➔ Concept by Cynthia Dwork and Moni Naor in 1992 in the paper "Pricing via
Processing, Or, Combatting Junk Mail, Advances in Cryptology";
➔ Named by Markus Jakobsson and Ari Juels in 1999 in the paper: "Proofs of Work
and Bread Pudding Protocols";
➔ Asymmetry:
◆ Verifying that the work has been done is relatively simple and quick
Proof of Work (PoW)
➔ PoW ensures that participants in the network agree on the state of the ledger (i.e., the
order and validity of transactions) through a process that involves solving complex
cryptographic puzzles
➔ Mining comes from trial and error of finding a Nonce (random number) that satisfies the
degree of difficulty of the network.
➔ Difficulty ensures that the process of adding new blocks to the blockchain requires a
significant amount of computational work. This makes it economically infeasible for
malicious actors to manipulate the blockchain
PoW Demo
➔ To participate in the validation, the amount of coins that the validator has is used, instead of
the computational power.
➔ The validator must place his deposited coins in a kind of safe to "prove" his participation,
without moving the coins.
➔ The more coins you have, the greater the chance of validating transactions and earning from
them.
➔ It should bring more security and decentralization, but it makes larger coin holders more likely
to get more coins.
Proof of Authority
(PoA)
➔ Used in permissioned Blockchains.
➔ Group of *authorities*
➔ Specific nodes are defined and authorized to create new blocks in a chain.
➔ It needs approval from most of the nodes for the block to be created.
● Immutable
● Autonomously
○ (when triggered/called)
● No intermediaries
Decentralized Application (DApp)
A DApp is a type of software application that runs on a
decentralized network, like Ethereum, rather than on a
centralized server.
It uses smart contracts to manage their logic and interact
with the blockchain.
Central Server
node node node
21000 Gas
$ 2 = gas x
gas price
State 01 State 02
Balance 10 Balance 10
Information A Information A
State Changed on Blockchain
Block 01 Block 02 Block 03
World State 4
World State 3
World State 2
World State 1
Source: https://ethereum.org/pt/developers/docs/evm/
Chainlink Blockchain Fundamentals
Session 02
Wallets, Testnets, and Solidity
Agenda
Digital Wallets
Install Metamask
Testnets and faucets
Using an Ethereum wallet
Digital Wallets
What Are Wallets?
Private key A custodian or third party has control Users have complete control
management of private keys and access to the fund of private keys and fund
Security Private keys are stored online and Users can decide how to
depends on security mechanism of secure their private keys
custodial
BIP39 or PBDKF2
Seed(512-bit)
HD key generation algorithm(BIP32)
BIP32 or BIP44
Master key(256-bit)
Keccak256
Elliptic curve hash function
Private key (256-bit) Public key 512-bit) Address 256-bit)
Source: https://mdrza.medium.com/how-to-convert-mnemonic-12-word-to-private-key-address-wallet-bitcoin-and-ethereum-81aa9ca91a57
Cryptography in Wallet
Mnemonic
Install metamask at
https://metamask.io/
Create new wallet
WARNING
NEVER GIVE YOUR PRIVATE KEY
or MNEMONICS AWAY
https://chainlist.org/ or https://docs.chain.link/resources/link-token-contracts
Faucets
● Faucets - places to get tokens/cryptocurrencies
from testnets
Sepolia ETH
● https://workshop-faucet.vercel.app/faucets
● Facuet Password: BigMac777
● https://faucets.chain.link/
EtherScan - Sepolia
● https://sepolia.etherscan.io/
Using an Ethereum
Wallet
Create second account
1. Send button on
metamask
2. Confirm transaction
3. Pending transaction
4. Check transaction on
2 Etherscan
4
Smart Contract
Languages
Smart contract languages on different
blockchains
Different blockchains support different languages, which means there’s no one-language-fits-all
solution for smart contract developers.
develop
Solidity Compiler
Compile
Deploy
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
What we have in Register.sol.
contract Register { - A variable info to store a string
string private info; - A function getInfo() to return the string
stored at variable info
- A function setInfo() to change the
function getInfo() public view returns (string memory) {
string stored at variable info
return info;
}
Deployed Register.sol
Check deployment tx
Check tx hash
Interact with
Smart Contracts
Interact with Ethereum Wallet
2 types of Transactions
- Read-only function call
- Does not cost gas fee
- Change on-chain status
- Cost gas fee
#LearnWithChainlink
Congratulations!
Chainlink Blockchain Fundamentals
Session 03
Tokenized Assets, Blockchains,
and Oracles
Agenda
Tokenization Concepts
Token Standards
Token Interactions
Use Cases
Tokenization
Concepts
What is tokenization
Tokenization is the process of representing an asset's ownership rights as digital tokens stored on a blockchain. These
tokens act like digital certificates of ownership and can represent many assets, including physical, digital, fungible, and
non-fungible items.
Tokenizing assets on a blockchain refers to representing ownership or rights to real-world or digital assets as digital
tokens on a blockchain.
Off-chain
On-chain
Efficiency and Cost Reduction Transparency and Compliance Flexibility and Customization
Reduced intermediaries Real-time monitoring Programmable assets
Automated Processes Regulatory compliance Dynamic use cases
If you say that your token follows a standard, other people will expect to find specific functions in your
token, and you should declare them, even if you do not implement their definitions.
ERC EIP
Focus Token and smart contract standard Protocol Improvement and changes
Uniform Unique
2018.1 2018.6
1. totalSupply:
○ Returns the total supply of tokens that exist.
2. balanceOf(address account):
○ Returns the balance of tokens for a specific address.
3. transfer(address recipient, uint256 amount):
○ Transfers a specified token amount from the sender’s account to another account.
4. approve(address spender, uint256 amount):
○ Approves a spender to transfer up to a specified amount of tokens on behalf of the owner.
5. allowance(address owner, address spender):
○ Returns the remaining number of tokens that the spender is allowed to spend on behalf of the owner.
6. transferFrom(address sender, address recipient, uint256 amount):
○ Transfers tokens from one account to another, typically used in conjunction with approve and allowance to manage delegated
transfers.
Events:
1. balanceOf(address owner):
○ Returns the number of tokens owned by a specific address.
2. ownerOf(uint256 tokenId):
○ Returns the owner of a specific token by its ID.
3. safeTransferFrom(address from, address to, uint256 tokenId):
○ Safely transfers token ownership from one address to another, ensuring the recipient can handle ERC-721 tokens.
4. transferFrom(address from, address to, uint256 tokenId):
○ Transfers token ownership without safety checks (not recommended for general use).
5. approve(address to, uint256 tokenId):
○ Approves another address to transfer a specific token on behalf of the owner.
6. getApproved(uint256 tokenId):
○ Returns the address approved for a specific token.
7. setApprovalForAll(address operator, bool approved):
○ Approves or removes an operator as authorized to manage all of the sender's assets.
Events:
Transaction
Input the
success
amount
Interact with NFT
https://sepolia.etherscan.io/address/0x35EfE940D1216D441f915C11725B7e4Dc089E23C
https://testnet.snowtrace.io/address/0x1c3D8C3Ad27049eBf16ae96d90A6d86b1A73e7c4/contract/43113/code
Interact with NFT
Stablecoins are tokens designed to maintain a stable value relative to a specific asset or basket of
assets, typically a fiat currency like the US dollar or euro, or a commodity like gold.
● Tether USDT: One of the oldest and most widely used stablecoins, Tether is pegged to the U.S. dollar at a
11 ratio.
● USD Coin USDC: Another popular stablecoin, USDC, is also pegged to the U.S. dollar and is known for its
transparency and regular audits.
● USDS: Unlike USDT and USDC, USDS is a decentralized stablecoin collateralized by other cryptocurrencies
rather than fiat currency, and real-world assets.
● PAXG Paxos Gold): Pegged to the price of gold, issued by Paxos.
NFT use cases
Community Proof of
Identity Attendance
Asset
collateralized Membership
proof
Agenda
➔ Immutability
◆ multiple confirmations
Interoperability and Finality
Major Components
● Three domains: Token
OnRamp
○ Source chain offchain Pool
○ Destination chain Committing
○ Offchain DON RMN
Commit
● Sender and receiver contracts are Store Contract
developed by external developers
RMN
Commit 2 2
● Router:
Executing Token
○ routes message based on DON OffRamp
Pool
destination chain selector,
receiver & token address
Bless/Curse
● RMN waits for commitment and Token
OnRamp
independently reconstructs it from offchain Pool
events emitted by OnRamp Committing
● Check if commitment matches: DON RMN
1
Commit
○ Match: RMN sends tx to RMN Store Contract
RMN
Contract blessing 1
commitment
Executing Token
○ Does not match: RMN sends tx DON OffRamp
Pool
to RMN Contract cursing
commitment
2
receiver Router destination
chain
source
sender Router chain
Execute
● Executing DON comprises many Token
OnRamp
oracles running OCR2 offchain Pool
● Waits for Message to be committed Committing
in CommitStore and blessed in RMN DON RMN
Commit
Contract Store Contract
● Sends execution transaction to
RMN
1
OffRamp with cryptographic proof
Executing Token
that Message is included in DON OffRamp
2
Pool
commitment
● OffRamp call router to execute the
transaction
receiver Router destination
chain
Recap
Issue and settle loans, liquidate undercollateralized positions, Generate mirrored versions of real-world and on-chain assets
trigger collateral swaps, and help protect against insolvency using on-chain collateral and Price Feeds as the reference
point for minting and redemption.
Use financial market data to determine the collateralization of Enable the automated management of capital pools and the
stable coins, automate mint/burn operations, and trigger making of funds to market by referring to Price Feeds for
rebasing functions rebalance.
Oracle use cases
Use funds deposited on Automatically Trade assets across Take advantage of network Decentralized validation
one chain as collateral to disseminate governance many chains. effects on Ethereum technology to reduce risk in
borrow against on decisions across many mainnet while harnessing cross-chain, multiparty
another chain. chains. compute and storage on middleware
other chains. communications.
Congratulations!
𝕏 thergdev 𝕏 thedavedev
You are ready to do the
exam and be certified!
Exam Time
How to do the exam
➔ Go to
https://codio.com/p/signup?courseToken=telex-canary
➔ Final Exam
➔ Wait the results
Thank you!
Disclaimer: This presentation is for informational purposes only and contains statements about the future, including anticipated programs and features, developments, and
timelines for the rollout of these programs and features. These statements are only predictions and reflect current beliefs and expectations with respect to future events;
they are based on assumptions and are subject to risk, uncertainties, and change at any time. There can be no guarantee that any of the contemplated programs or
features will be implemented as specified nor any assurance that actual results will not differ materially from those expressed in these statements, although we believe
them to be based on reasonable assumptions. All statements are valid only as of the date first presented. The statements in this presentation also may not reflect future
developments due to user feedback or later events and we may not update this presentation in response.