Smart Contracts - The Blockchain Beyond Bitcoin

Jim McKeeth
Jim McKeethChief Developer Advocate and Engineer en Embarcadero Technologies
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Smart
Contracts
The Blockchain Beyond Bitcoin
Jim McKeeth
jim@mckeeth.org
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Summary
A smart contract is a program that runs on the blockchain. This session is a technical look
at the blockchain and smart contracts from a programmer's perspective. We will start with
the basics of the blockchain and work our way up through the EVM and smart contract
standards. Then we will discuss alternative blockchains and the options they provide.
While smart contracts are the basis of
NFTs and Distributed Finance (DiFi),
this session's focus is on technology
and will explore many potential uses,
including an introduction to Solidity
and other smart contract programming
languages.
Presented at the
Boise Software Developers Group
on September 12th, 2023
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
▪ Long time software developer
▪ Delphi, C/C++, Java, JavaScript, Ruby, Python, Perl, Objective-C, etc.
▪ Invented and patented pattern and swipe to unlock
▪ e.g. US Patents # 8352745, 6766456
▪ Built thought controlled drone with Google Glass and
wireless EEG headset
▪ Contributor to Internet of Things and Data Analytics
Handbook
▪ Previously worked for Embarcadero (Delphi) and EOS
Network Foundation (Web3)
▪ Developer Advocate, blogger, podcaster, and webinar
host
About Jim McKeeth
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Disclaimer
▪ This is NOT investment advice
▪ I own a trivial amount of Ethereum and other tokens
▪ While I find the technology very exciting,
there is a lot of hype, and “scams”
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Source: gartner.com/smarterwithgartner/3-themes-surface-
in-the-2021-hype-cycle-for-emerging-technologies
▪ NFTs were at the Peak of Inflated
Expectations in 2021 with gartner
estimating they were 2 to 5 years
before plateau.
▪ Christie auction house announced
two major firsts:
▪ It will accept cryptocurrency
▪ It will offer for sale an NFT
backed purely digital work
▪ As of July, 2021, NFTs had a
market valuation >$300 million
USD
Expectations
Time
Hype Cycle for Emerging Technologies
Innovation
Trigger
Peak of
Inflated
Expectations
Trough of
Disillusionment
Slope of
Enlightenment
Plateau of
Productivity
Plateau will be reached:
↗️ < 2 years 2️⃣ 2 to 5 years 5️⃣ 5 to 10 years ↘️ > 10 years
2️⃣ Non Fungible Tokens (NFT) [2021]
Decentralized Finance
(DeFi) [2021] 5️⃣
Decentralized Autonomous
Organizations (DAO) [2019] 5️⃣
2️⃣ Blockchain [2018]
5️⃣ Blockchain for Data
Security [2018]
Blockchain [2016] 5️⃣
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Agenda
▪ Cryptography Basics
▪ Cryptocurrency Overview
▪ Blockchain Overview
▪ Ethereum
▪ Mining: Proof of Work vs Proof of Stake
▪ Smart Contracts
▪ NFTs
▪ Future of Blockchain
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Definitions
▪ Web3 - The idea of a decentralized Internet based on public blockchains
▪ FinTech - Financial Technology
▪ DeFi - Decentralized Finance - FinTech on Web3/Blockchain
▪ Fiat Money - Money not backed by a commodity. Issued by government or central
bank.
▪ Fungible - Mutually interchangeable by another identical item
▪ Token/Coin - A “unit” of cryptocurrency that has an owner on the blockchain
▪ NFT - Non Fungible Token - A unit on the blockchain that is unique
▪ Smart Contract - A contract that is defined on the blockchain and immutable
▪ DAO (Decentralized Autonomous Organizations) - An organization whose rules are
defined via Smart Contract making it transparent and independent
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
What are Cryptocurrencies?
▪ The idea predates Bitcoin as “electronic cash”
▪ An alternative, virtual, electronic currency
▪ Previous attempts used “smart cards” to hold
value
▪ Uses cryptography as means to protect value
(thus the “crypto” in the name)
▪ Bitcoin was the first successful decentralized
cryptocurrency, meaning there is no central
authority
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Commodity
Money
Cash
Central Bank
Issued
Cryptocurrency
(retail)
Wholesale
Cryptocurrency
Other Local
Currency
Central Bank
Issued
Cryptocurrency
(Wholesale)
Central bank
reserves
Central Bank
Digital
Currency
Virtual
Currency
Bank
Deposits
Universally
Accessible
Electronic
Central
Bank-issued
Peer-to-Peer
The Money Flower
Adapted from Bank for International
Settlements publication of Central
Bank Cryptocurrencies by Morten
Linnemann Bech and Rodney Garratt
17 September 2017
www.bis.org/publ/qtrpdf/r_qt1709f.htm
A Taxonomy
of Money
Crypto-
currency
e.g. Gold
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Encryption Basics
▪ Public key encryption is asymmetrical
▪ Everyone knows the public key used for encryption
▪ Only the receiver knows the private key used for decryption
▪ Blockchain doesn’t use encryption, just signatures
▪ A cryptographic hash is a fixed size thumbprint that
uniquely identifies an arbitrary input (one way)
▪ Example: SHA-256 is a 256-bit thumbprint
▪ The algorithm is designed to prevent collisions: two different
inputs producing the same output
▪ Digital signature is generated with the private key and
validated with the public key
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
How Big is 256 bits?
▪ Number of values = 2256 = 1.158 x 1077 = 1 followed by 77 zeros
▪ The odds of collision for two different inputs is 1 in 1077
▪ For comparison, that is about halfway between the number of atoms on
earth (≈1050) and the years left before the heat death of universe
(≈10100)
x 1050 =
(or aprox. 167 bits)
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
What is ?
▪ Designed by pseudonymous Satoshi Nakamoto
▪ Originally described in 2008 paper “Bitcoin: A
Peer-to-Peer Electronic Cash System”
▪ Original white paper bitcoin.org/bitcoin.pdf
▪ Distributed Miners maintain the blockchain
transaction ledger with proof of work timestamps
▪ A block completes every 10 minutes, generating
6.25 BTC for generator (payout changes over time)
▪ Transactions are in satoshi = 0.00000001 BTC
▪ 16 satoshi = 1 US cent (Nov 2021)
▪ An individual uses a wallet to access their BTC
▪ The digital credentials to transfer bitcoins
bitcoin.org
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Understanding Crypto
▪ A physical dollar bill has a serial number, and is always worth
it’s value. You can’t divide it up.
▪ A ledger, bank account, or deposit is a digital representation
of an amount of money, including fractions of a dollar.
▪ Bitcoin is a way to track value, not a collection of individual
bitcoins.
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Understanding Wallets
▪ A wallet is a asymmetric cryptographic key
▪ Public key is the wallet address
▪ Private key is the part you keep secret & safe
▪ Two types: Hot (online) vs Cold (offline)
▪ Hot wallet’s are more convenient, but can be compromised
▪ Very popular hot wallet: metamask.io
▪ Cold wallet is less convenient, but more secure
▪ Like an encrypted USB drive
▪ Exchanges also offer hot wallets, but then they control the secret key
and are even more risky
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Ethereum
▪ An open-source, public, blockchain-based distributed
computing platform featuring smart contracts
▪ A smart contract is a program that executes on the
Ethereum Virtual Machine (EVM)
[a decentralized Turing-complete virtual machine on the blockchain]
▪ Most Smart Contracts are written in Solidity, an OOP
language (Viper & Yul are other languages)
▪ Ether is a cryptocurrency whose blockchain is
generated by the Ethereum platform
▪ "Gas," an internal transaction pricing mechanism, is
used to mitigate spam and allocate resources on the
network. It is paid for with Ether
ethereum.org
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Other EVM Compatible Blockchains
▪ Binance Smart Chain
▪ Fantom
▪ Polygon
▪ Avalanche
▪ Cardano
▪ Tron
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
So What is the Blockchain?
▪ When there is no central ledger, how to do you know which ledger is true?
▪ Without consensus for the ledger there is no way to prevent someone from
repeating a transaction multiple times (aka double spending)
▪ Blockchain solves this as each block contains the hash of previous block
▪ Once a new block is added to the chain it validates all previous blocks
▪ Kind of like a singly linked list that uses hashes instead of pointers
▪ The more blocks after a transaction, the more secure
▪ The first block is called the genesis block
▪ In case of disagreement, consensus is based on the longest chain
▪ If majority of the nodes aren’t colluding, the whole network is secure
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Simple Blockchain Example
Idx Data Timestamp Hash
0 This is the data stored on the blockchain 20210120T005509Z Genesis block
1 Here is some more data. 20210120T125509Z 6948 F840 1E13 4EAB 508E 2FB1 CB54 8C35 3CB4 AAE2 3B1A A0D3 66C5 335C 5AEA 8B1E
2 This could be a hash of other data 20210121T005509Z 7253 4287 903B FFB0 85DF 0EC5 0D63 9640 72F6 26A5 5343 1F01 F12E 7A14 1E64 3F75
3 If the data is a hash, then it keeps it secret. 20210121T125509Z 8F76 E681 2F24 00E5 FBF0 48FC A16C CBE6 0FDB 9387 77A9 5BFB 1501 B180 546E 7F51
4 Change a block and all future blocks are invalid 20210122T005509Z 66F3 34C6 5129 164A 3661 055F 10BB A1CC 0FAF 4228 579D 15CF C5E7 45ED F4BB 5F11
5 Once a new block is added . . . 20210122T125509Z 4D63 2816 7361 96A9 F66C CC23 ABF5 A635 51F9 E627 C6FA 965E 8DE5 0AF0 95FD F48B
6 then the previous block cannot be changed . . . 20210123T005509Z 296C DD47 43DF 453E 0910 9099 131E B27F 33FF ACC3 2998 B5A9 1FB1 0402 9270 1F67
7 without changing the next block. 20210123T125509Z 1B3F AF1C BDE9 DD3A A493 CD8D 6262 EEE6 0C81 0E69 6086 51BB 8078 FA09 BC69 EDC5
8 Even the slightest change . . . 20210124T005509Z F3ED FD45 7D46 587C 7D1C 0CEB 8F32 D1B8 2CFB 7D55 14CC A68C C489 581B 7095 E0BE
9 triggers a whole different hash. 20210124T125509Z A2EE 401C 0D1C 6881 29E6 EC82 47E4 3921 16D5 CF35 D827 AB3A C08D 5056 95FF 1C7F
10 The last block validates the whole chain 20210125T005509Z 9F9D 97D3 64B9 692B 1934 19A9 7137 C377 75D2 73AF C028 6BDD B7CA BE35 C438 23AA
669C 2798 0331 6C75 E892 9993 4099 73E2 24FA 9802 22B3 52C6 9893 EFE7 EB76 E68D
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Blockchain Demo
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
What is Mining? (Proof of Work)
▪ Mining is the process of finding a nonce (number used once
- unique number) that generates a SHA-256 hash meeting
the current difficulty target
▪ The difficulty target is the number of leading zeros
▪ Every 2,016 blocks (~14 days at ~10 min/block), the difficulty
target is adjusted based on the network's recent
performance
▪ Bitcoins exist as a result of the transaction on the ledger
▪ This effort and power requirement to compute a block,
and the blockchain is what secures the ledger
▪ Other proofs include Proof of Authority, Proof of Stake,
and Proof of Space
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Mining Demo
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Proof of Stake
▪ Powered by a smart contract
▪ Only works on established network with existing coin
▪ Proof of work is needed to “seed” the network, then
Proof of Stake is the more sustainable evolution
▪ Anyone can stake 32+ Ether coin
▪ Volunteer validate transactions and blocks
▪ Rewarded with Ether for valid blocks
▪ Larger stake = greater reward & more vote
▪ Fraudulent blocks penalize stake
▪ Vulnerable to 51% attack (same as Proof of Work)
▪ No longer uses high amounts of energy and hardware
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Smart Contracts
▪ A smart contract is a program that takes place on a blockchain
▪ You can think of a smart contract as a microservice that runs trustless on
the backend of your application
▪ Smart contracts have many applications, ranging from sports betting to
online voting
▪ The true power of smart contracts is in managing assets that have value
and are scarce (NFTs)
▪ Once added to the blockchain, a smart contract becomes public and
cannot be modified or removed
▪ This assures users that the rules are transparent and will never change
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Smart Contract ≈ Microservice
▪ Like a microservice that exists on a cloud platform and is activated when called
▪ For a smart contract you pay a fee to deploy it, and then the callers pay the cost of
calling it
▪ Instead of paying a monthly hosting fee, it is part of the blockchain, and the program
runs as needed during block validation
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Why are Smart Contracts Cool?
▪ No “terms subject to change”
▪ No “forum” or “venue selection clauses”
▪ No “confidentiality provisions”
▪ No arbitration or mediation clauses
▪ Can be more concise than traditional contracts
▪ Mathematically provable
▪ As a programmer you have the advantage:
You don’t need a lawyer to translate!
▪ These can all be negatives too….
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Solidity
pragma solidity >= 0.7.0 <0.8.0;
contract Coin {
// The keyword "public" makes variables accessible from other contracts
address public minter;
mapping (address => uint) public balances;
// Events allow clients to react to declared contract changes
event Sent (address from, address to, uint amount);
// Constructor code is only run when the contract is created
constructor() public {
minter = msg.sender;
}
// Sends an amount of newly created coins to an address
// Can only be called by the contract creator
function mint(address receiver, uint amount) public {
require(msg.sender == minter);
require(amount < 1e60);
balances[receiver] += amount;
}
// Sends an amount of existing coins from any caller to an address
function send(address receiver, uint amount) public {
require(amount <= balances[msg.sender], "Insufficient balance.");
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent (msg.sender, receiver, amount);
}
}
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Smart Contract Stack
▪ Web based IDE: remix.ethereum.org
▪ Solidity for VS Code by Juan Blanco
▪ Q&A ethereum.stackexchange.com
▪ Solidity Language: soliditylang.org
▪ Testnets: ethereum.org/en/developers/docs/networks/
▪ sepolia.dev / goerli.net / arbitrum.io
▪ Each with it’s own faucet
▪ Wallet: metamask.io
▪ Local Ethereum environment: hardhat.org
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Smart Contracts Demo
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Other Smart Contract Languages
▪ Vyper – 2nd most popular for EVM-compatible blockchains. Contract-oriented, pythonic
programming language with strong typing, small compiler code, and efficient bytecode
▪ Yul is an intermediate language for Ethereum that supports the EVM
▪ Cairo is a Turing-complete smart contract programming language built for creating
STARK-provable programs for general computation
▪ Rust is a popular smart contract programming language for many non-EVM-
compatible blockchains such as Polkadot and Solana
▪ Move is a Rust-based smart contract programming language originally developed for
Meta’s Diem blockchain
▪ C++ used by EOS and Antelope based blockchains – compiles to web assembly
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Ethereum Virtual Machine
▪ Opcodes www.evm.codes
▪ EVM Architecture
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Shard Chains & Layer 2
▪ Sharding is a multi-phase upgrade to improve Ethereum’s
scalability and capacity planned for ~2022
▪ Sharding is the process of splitting the blockchain horizontally to
spread the load
▪ Will reduce network congestion and increase transactions per
second by creating new chains, known as “shards”
▪ Shard chains spread the network's load across 64 new chains
▪ They make it easier to run a node by keeping hardware
requirements low
▪ ethereum.org/en/eth2/shard-chains/
▪ ethereum.org/en/developers/docs/scaling/layer-2-rollups/
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Non-Fungible Tokens (NFTs)
▪ An NFT is a unique blockchain-based digital asset
▪ Links to meta-data defining real-world assets like
digital art, music, subscriptions, or tokenized physical
assets like houses or cars, etc.
▪ NFT verifies provenance, ownership and access
▪ Ethereum is most popular blockchain for NFT
▪ Ownership rights vary by NFT
▪ Uses immutable public blockchains - usually
Ethereum
▪ Based on Smart Contracts, defined by ERC-721
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Understanding Fungibility
▪ The value of a coin is fungible (Interchangeable)
▪ Any quarter has a face value of 25¢
▪ But an individual physical coin is non-fungible (unique)
▪ Especially an older coin may have collectable value
▪ Based on material, history, condition, etc.
▪ Or a certain coin may have sentimental value to the owner
▪ Tied to a memory, source, origin, etc.
▪ NFTs attempt to digitally capture the idea of owning a unique
digital asset
25¢
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Token Standards (Ethereum Improvement Proposals)
▪ ERC-20 – A standard interface for fungible (interchangeable) tokens, like voting
tokens, staking tokens or virtual currencies.
▪ ERC-721 – A standard interface for non-fungible tokens, like a deed for artwork or a
song.
▪ ERC-777 – Allows people to build extra functionality on top of tokens such as a mixer
contract for improved transaction privacy or an emergency recover function to bail you
out if you lose your private keys.
▪ ERC-1155 – Allows for more efficient trades and bundling of transactions – thus saving
costs. This token standard allows for creating both utility tokens (such as $BNB or
$BAT) and Non-Fungible Tokens like CryptoPunks.
▪ ERC-4626 – A tokenized vault standard designed to optimize and unify the technical
parameters of yield-bearing vaults.
▪ Full list: eips.ethereum.org/erc
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
▪ Created in 2015 by Juan Benet of Protocol Labs [ protocol.ai - ipfs.io ]
▪ An open-source protocol and peer-to-peer network for storing and sharing data in a
distributed and decentralized file system
▪ Uses content-addressing to uniquely identify each file in a global namespace
connecting all computing devices
▪ Inspired by or evolved from BitTorrent
▪ Any user in the network can serve a file by its content address
▪ Peers in the network find and request content using a distributed hash table (DHT)
▪ Frequently used to store NFT related files
▪ FileCoin rewards uses for persisting content [ filecoin.io ]
▪ Supported by Cloudflare, Brave Browser, and others
InterPlanetary File System (IPFS)
Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
Just the Tip of the Blockchain Iceberg
▪ Blockchain is an emerging technology
▪ Everyone is focused on the Bitcoin gold rush
▪ Blockchain may have the bigger/longer impact
▪ Ethereum is a more evolved platform
▪ Shard, Layer2, & Proof of Stake and other changes
improved sustainability
▪ Smart Contracts are the foundation of Ethereum’s
platform
▪ NFT is at the peak of inflated expectations today
▪ This is a rapidly evolving family of technologies
1 de 37

Recomendados

Blockchain External.pdf por
Blockchain External.pdfBlockchain External.pdf
Blockchain External.pdfmanishchaitanya
6 vistas34 diapositivas
Blockchain.pptx por
Blockchain.pptxBlockchain.pptx
Blockchain.pptxmanishchaitanya
6 vistas34 diapositivas
Blockchain, bitcoin, ethereum and ICOs por
Blockchain, bitcoin, ethereum and ICOsBlockchain, bitcoin, ethereum and ICOs
Blockchain, bitcoin, ethereum and ICOsBogdan Fiedur
3.3K vistas55 diapositivas
BCHGraz - Meetup #8 - Intro & Ethereum por
 BCHGraz - Meetup #8 - Intro & Ethereum BCHGraz - Meetup #8 - Intro & Ethereum
BCHGraz - Meetup #8 - Intro & EthereumBlockchainHub Graz
1.6K vistas37 diapositivas
2019 blockchain economy por
2019 blockchain economy2019 blockchain economy
2019 blockchain economyHeung-No Lee
140 vistas48 diapositivas
Blockchain and Bitcoin por
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and BitcoinHugo Rodrigues
3.4K vistas39 diapositivas

Más contenido relacionado

Similar a Smart Contracts - The Blockchain Beyond Bitcoin

An Introduction to Blockchains por
An Introduction to BlockchainsAn Introduction to Blockchains
An Introduction to BlockchainsDr. Nikolaus Lipusch
38 vistas23 diapositivas
Paradigm shift: from the bitcoin Blockchain to Networked Computing por
Paradigm shift: from the bitcoin Blockchain to Networked ComputingParadigm shift: from the bitcoin Blockchain to Networked Computing
Paradigm shift: from the bitcoin Blockchain to Networked Computingkumar641
2K vistas25 diapositivas
Blockchain technology Overview por
Blockchain technology OverviewBlockchain technology Overview
Blockchain technology OverviewLalitha Prasanna
43 vistas19 diapositivas
OVERVIEW ON CRYPTOCURRENCY por
OVERVIEW ON CRYPTOCURRENCYOVERVIEW ON CRYPTOCURRENCY
OVERVIEW ON CRYPTOCURRENCYdrrammohan
1.8K vistas88 diapositivas
Blockchain & crypto por
Blockchain & cryptoBlockchain & crypto
Blockchain & cryptoAtul Mangat
63 vistas20 diapositivas
Bitcoin por
BitcoinBitcoin
BitcoinLakshya Sharma
1.1K vistas24 diapositivas

Similar a Smart Contracts - The Blockchain Beyond Bitcoin(20)

Paradigm shift: from the bitcoin Blockchain to Networked Computing por kumar641
Paradigm shift: from the bitcoin Blockchain to Networked ComputingParadigm shift: from the bitcoin Blockchain to Networked Computing
Paradigm shift: from the bitcoin Blockchain to Networked Computing
kumar6412K vistas
OVERVIEW ON CRYPTOCURRENCY por drrammohan
OVERVIEW ON CRYPTOCURRENCYOVERVIEW ON CRYPTOCURRENCY
OVERVIEW ON CRYPTOCURRENCY
drrammohan1.8K vistas
Blockchain & crypto por Atul Mangat
Blockchain & cryptoBlockchain & crypto
Blockchain & crypto
Atul Mangat63 vistas
Intro to Blockchain Slides por Shannon Wells
Intro to Blockchain SlidesIntro to Blockchain Slides
Intro to Blockchain Slides
Shannon Wells342 vistas
The Greatest Invention Since Electricity por Meg Montgomery
The Greatest Invention Since ElectricityThe Greatest Invention Since Electricity
The Greatest Invention Since Electricity
Meg Montgomery279 vistas
The Bitcoin blockchain (en) por Davide Carboni
The Bitcoin blockchain (en)The Bitcoin blockchain (en)
The Bitcoin blockchain (en)
Davide Carboni948 vistas
BlockChain BreakDown por Chris Black
BlockChain BreakDownBlockChain BreakDown
BlockChain BreakDown
Chris Black269 vistas
Bitcoins, blockchains and beyond por jhaand
Bitcoins, blockchains and beyondBitcoins, blockchains and beyond
Bitcoins, blockchains and beyond
jhaand4.6K vistas

Más de Jim McKeeth

Rapid Prototyping Mobile IoT Projects with Arduino and Open Hardware por
Rapid Prototyping Mobile IoT Projects with Arduino and Open HardwareRapid Prototyping Mobile IoT Projects with Arduino and Open Hardware
Rapid Prototyping Mobile IoT Projects with Arduino and Open HardwareJim McKeeth
6.8K vistas23 diapositivas
Day 3 of C++ Boot Camp - C++11 Language Deep Dive por
Day 3 of C++ Boot Camp - C++11 Language Deep DiveDay 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 3 of C++ Boot Camp - C++11 Language Deep DiveJim McKeeth
673 vistas11 diapositivas
Day 5 of C++ Boot Camp - Stepping Up to Mobile por
Day 5 of C++ Boot Camp - Stepping Up to MobileDay 5 of C++ Boot Camp - Stepping Up to Mobile
Day 5 of C++ Boot Camp - Stepping Up to MobileJim McKeeth
495 vistas41 diapositivas
Android Services Skill Sprint por
Android Services Skill SprintAndroid Services Skill Sprint
Android Services Skill SprintJim McKeeth
2.5K vistas14 diapositivas
Creating Android Services with Delphi and RAD Studio 10 Seattle por
Creating Android Services with Delphi and RAD Studio 10 SeattleCreating Android Services with Delphi and RAD Studio 10 Seattle
Creating Android Services with Delphi and RAD Studio 10 SeattleJim McKeeth
17.8K vistas14 diapositivas
Building a Thought Controlled Drone por
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled DroneJim McKeeth
5.4K vistas51 diapositivas

Más de Jim McKeeth(15)

Rapid Prototyping Mobile IoT Projects with Arduino and Open Hardware por Jim McKeeth
Rapid Prototyping Mobile IoT Projects with Arduino and Open HardwareRapid Prototyping Mobile IoT Projects with Arduino and Open Hardware
Rapid Prototyping Mobile IoT Projects with Arduino and Open Hardware
Jim McKeeth6.8K vistas
Day 3 of C++ Boot Camp - C++11 Language Deep Dive por Jim McKeeth
Day 3 of C++ Boot Camp - C++11 Language Deep DiveDay 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 3 of C++ Boot Camp - C++11 Language Deep Dive
Jim McKeeth673 vistas
Day 5 of C++ Boot Camp - Stepping Up to Mobile por Jim McKeeth
Day 5 of C++ Boot Camp - Stepping Up to MobileDay 5 of C++ Boot Camp - Stepping Up to Mobile
Day 5 of C++ Boot Camp - Stepping Up to Mobile
Jim McKeeth495 vistas
Android Services Skill Sprint por Jim McKeeth
Android Services Skill SprintAndroid Services Skill Sprint
Android Services Skill Sprint
Jim McKeeth2.5K vistas
Creating Android Services with Delphi and RAD Studio 10 Seattle por Jim McKeeth
Creating Android Services with Delphi and RAD Studio 10 SeattleCreating Android Services with Delphi and RAD Studio 10 Seattle
Creating Android Services with Delphi and RAD Studio 10 Seattle
Jim McKeeth17.8K vistas
Building a Thought Controlled Drone por Jim McKeeth
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled Drone
Jim McKeeth5.4K vistas
Deep Dive into Futures and the Parallel Programming Library por Jim McKeeth
Deep Dive into Futures and the Parallel Programming LibraryDeep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming Library
Jim McKeeth11K vistas
Embarcadero's Connected Development por Jim McKeeth
Embarcadero's Connected DevelopmentEmbarcadero's Connected Development
Embarcadero's Connected Development
Jim McKeeth14.6K vistas
The Internet of Things and You - A Developers Guide to IoT por Jim McKeeth
The Internet of Things and You - A Developers Guide to IoTThe Internet of Things and You - A Developers Guide to IoT
The Internet of Things and You - A Developers Guide to IoT
Jim McKeeth4.3K vistas
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ... por Jim McKeeth
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
Jim McKeeth3.3K vistas
Android voice skill sprint por Jim McKeeth
Android voice skill sprintAndroid voice skill sprint
Android voice skill sprint
Jim McKeeth12.7K vistas
Exploring the Brain Computer Interface por Jim McKeeth
Exploring the Brain Computer InterfaceExploring the Brain Computer Interface
Exploring the Brain Computer Interface
Jim McKeeth5.1K vistas
Introduction to Android Development with Java por Jim McKeeth
Introduction to Android Development with JavaIntroduction to Android Development with Java
Introduction to Android Development with Java
Jim McKeeth4.8K vistas
Hacking iBooks and ePub3 with JavaScript! por Jim McKeeth
Hacking iBooks and ePub3 with JavaScript!Hacking iBooks and ePub3 with JavaScript!
Hacking iBooks and ePub3 with JavaScript!
Jim McKeeth38.7K vistas
Inventing merit badge por Jim McKeeth
Inventing merit badgeInventing merit badge
Inventing merit badge
Jim McKeeth10K vistas

Último

Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... por
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...NUS-ISS
37 vistas54 diapositivas
Black and White Modern Science Presentation.pptx por
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptxmaryamkhalid2916
14 vistas21 diapositivas
Five Things You SHOULD Know About Postman por
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
27 vistas43 diapositivas
The details of description: Techniques, tips, and tangents on alternative tex... por
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
121 vistas24 diapositivas
Tunable Laser (1).pptx por
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
23 vistas37 diapositivas
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... por
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...NUS-ISS
28 vistas70 diapositivas

Último(20)

Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... por NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS37 vistas
Black and White Modern Science Presentation.pptx por maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291614 vistas
Five Things You SHOULD Know About Postman por Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 vistas
The details of description: Techniques, tips, and tangents on alternative tex... por BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 vistas
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... por NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS28 vistas
PharoJS - Zürich Smalltalk Group Meetup November 2023 por Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 vistas
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum... por NUS-ISS
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
NUS-ISS34 vistas
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... por Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin75 vistas
handbook for web 3 adoption.pdf por Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 vistas
How the World's Leading Independent Automotive Distributor is Reinventing Its... por NUS-ISS
How the World's Leading Independent Automotive Distributor is Reinventing Its...How the World's Leading Independent Automotive Distributor is Reinventing Its...
How the World's Leading Independent Automotive Distributor is Reinventing Its...
NUS-ISS15 vistas
Perth MeetUp November 2023 por Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 vistas
Empathic Computing: Delivering the Potential of the Metaverse por Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst470 vistas
Report 2030 Digital Decade por Massimo Talia
Report 2030 Digital DecadeReport 2030 Digital Decade
Report 2030 Digital Decade
Massimo Talia14 vistas
.conf Go 2023 - Data analysis as a routine por Splunk
.conf Go 2023 - Data analysis as a routine.conf Go 2023 - Data analysis as a routine
.conf Go 2023 - Data analysis as a routine
Splunk93 vistas
DALI Basics Course 2023 por Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 vistas

Smart Contracts - The Blockchain Beyond Bitcoin

  • 1. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Smart Contracts The Blockchain Beyond Bitcoin Jim McKeeth jim@mckeeth.org
  • 2. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Summary A smart contract is a program that runs on the blockchain. This session is a technical look at the blockchain and smart contracts from a programmer's perspective. We will start with the basics of the blockchain and work our way up through the EVM and smart contract standards. Then we will discuss alternative blockchains and the options they provide. While smart contracts are the basis of NFTs and Distributed Finance (DiFi), this session's focus is on technology and will explore many potential uses, including an introduction to Solidity and other smart contract programming languages. Presented at the Boise Software Developers Group on September 12th, 2023
  • 3. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth ▪ Long time software developer ▪ Delphi, C/C++, Java, JavaScript, Ruby, Python, Perl, Objective-C, etc. ▪ Invented and patented pattern and swipe to unlock ▪ e.g. US Patents # 8352745, 6766456 ▪ Built thought controlled drone with Google Glass and wireless EEG headset ▪ Contributor to Internet of Things and Data Analytics Handbook ▪ Previously worked for Embarcadero (Delphi) and EOS Network Foundation (Web3) ▪ Developer Advocate, blogger, podcaster, and webinar host About Jim McKeeth
  • 4. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Disclaimer ▪ This is NOT investment advice ▪ I own a trivial amount of Ethereum and other tokens ▪ While I find the technology very exciting, there is a lot of hype, and “scams”
  • 5. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Source: gartner.com/smarterwithgartner/3-themes-surface- in-the-2021-hype-cycle-for-emerging-technologies ▪ NFTs were at the Peak of Inflated Expectations in 2021 with gartner estimating they were 2 to 5 years before plateau. ▪ Christie auction house announced two major firsts: ▪ It will accept cryptocurrency ▪ It will offer for sale an NFT backed purely digital work ▪ As of July, 2021, NFTs had a market valuation >$300 million USD Expectations Time Hype Cycle for Emerging Technologies Innovation Trigger Peak of Inflated Expectations Trough of Disillusionment Slope of Enlightenment Plateau of Productivity Plateau will be reached: ↗️ < 2 years 2️⃣ 2 to 5 years 5️⃣ 5 to 10 years ↘️ > 10 years 2️⃣ Non Fungible Tokens (NFT) [2021] Decentralized Finance (DeFi) [2021] 5️⃣ Decentralized Autonomous Organizations (DAO) [2019] 5️⃣ 2️⃣ Blockchain [2018] 5️⃣ Blockchain for Data Security [2018] Blockchain [2016] 5️⃣
  • 6. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Agenda ▪ Cryptography Basics ▪ Cryptocurrency Overview ▪ Blockchain Overview ▪ Ethereum ▪ Mining: Proof of Work vs Proof of Stake ▪ Smart Contracts ▪ NFTs ▪ Future of Blockchain
  • 7. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Definitions ▪ Web3 - The idea of a decentralized Internet based on public blockchains ▪ FinTech - Financial Technology ▪ DeFi - Decentralized Finance - FinTech on Web3/Blockchain ▪ Fiat Money - Money not backed by a commodity. Issued by government or central bank. ▪ Fungible - Mutually interchangeable by another identical item ▪ Token/Coin - A “unit” of cryptocurrency that has an owner on the blockchain ▪ NFT - Non Fungible Token - A unit on the blockchain that is unique ▪ Smart Contract - A contract that is defined on the blockchain and immutable ▪ DAO (Decentralized Autonomous Organizations) - An organization whose rules are defined via Smart Contract making it transparent and independent
  • 8. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth What are Cryptocurrencies? ▪ The idea predates Bitcoin as “electronic cash” ▪ An alternative, virtual, electronic currency ▪ Previous attempts used “smart cards” to hold value ▪ Uses cryptography as means to protect value (thus the “crypto” in the name) ▪ Bitcoin was the first successful decentralized cryptocurrency, meaning there is no central authority
  • 9. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Commodity Money Cash Central Bank Issued Cryptocurrency (retail) Wholesale Cryptocurrency Other Local Currency Central Bank Issued Cryptocurrency (Wholesale) Central bank reserves Central Bank Digital Currency Virtual Currency Bank Deposits Universally Accessible Electronic Central Bank-issued Peer-to-Peer The Money Flower Adapted from Bank for International Settlements publication of Central Bank Cryptocurrencies by Morten Linnemann Bech and Rodney Garratt 17 September 2017 www.bis.org/publ/qtrpdf/r_qt1709f.htm A Taxonomy of Money Crypto- currency e.g. Gold
  • 10. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Encryption Basics ▪ Public key encryption is asymmetrical ▪ Everyone knows the public key used for encryption ▪ Only the receiver knows the private key used for decryption ▪ Blockchain doesn’t use encryption, just signatures ▪ A cryptographic hash is a fixed size thumbprint that uniquely identifies an arbitrary input (one way) ▪ Example: SHA-256 is a 256-bit thumbprint ▪ The algorithm is designed to prevent collisions: two different inputs producing the same output ▪ Digital signature is generated with the private key and validated with the public key
  • 11. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth How Big is 256 bits? ▪ Number of values = 2256 = 1.158 x 1077 = 1 followed by 77 zeros ▪ The odds of collision for two different inputs is 1 in 1077 ▪ For comparison, that is about halfway between the number of atoms on earth (≈1050) and the years left before the heat death of universe (≈10100) x 1050 = (or aprox. 167 bits)
  • 12. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth What is ? ▪ Designed by pseudonymous Satoshi Nakamoto ▪ Originally described in 2008 paper “Bitcoin: A Peer-to-Peer Electronic Cash System” ▪ Original white paper bitcoin.org/bitcoin.pdf ▪ Distributed Miners maintain the blockchain transaction ledger with proof of work timestamps ▪ A block completes every 10 minutes, generating 6.25 BTC for generator (payout changes over time) ▪ Transactions are in satoshi = 0.00000001 BTC ▪ 16 satoshi = 1 US cent (Nov 2021) ▪ An individual uses a wallet to access their BTC ▪ The digital credentials to transfer bitcoins bitcoin.org
  • 13. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Understanding Crypto ▪ A physical dollar bill has a serial number, and is always worth it’s value. You can’t divide it up. ▪ A ledger, bank account, or deposit is a digital representation of an amount of money, including fractions of a dollar. ▪ Bitcoin is a way to track value, not a collection of individual bitcoins.
  • 14. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Understanding Wallets ▪ A wallet is a asymmetric cryptographic key ▪ Public key is the wallet address ▪ Private key is the part you keep secret & safe ▪ Two types: Hot (online) vs Cold (offline) ▪ Hot wallet’s are more convenient, but can be compromised ▪ Very popular hot wallet: metamask.io ▪ Cold wallet is less convenient, but more secure ▪ Like an encrypted USB drive ▪ Exchanges also offer hot wallets, but then they control the secret key and are even more risky
  • 15. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Ethereum ▪ An open-source, public, blockchain-based distributed computing platform featuring smart contracts ▪ A smart contract is a program that executes on the Ethereum Virtual Machine (EVM) [a decentralized Turing-complete virtual machine on the blockchain] ▪ Most Smart Contracts are written in Solidity, an OOP language (Viper & Yul are other languages) ▪ Ether is a cryptocurrency whose blockchain is generated by the Ethereum platform ▪ "Gas," an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network. It is paid for with Ether ethereum.org
  • 16. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Other EVM Compatible Blockchains ▪ Binance Smart Chain ▪ Fantom ▪ Polygon ▪ Avalanche ▪ Cardano ▪ Tron
  • 17. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth So What is the Blockchain? ▪ When there is no central ledger, how to do you know which ledger is true? ▪ Without consensus for the ledger there is no way to prevent someone from repeating a transaction multiple times (aka double spending) ▪ Blockchain solves this as each block contains the hash of previous block ▪ Once a new block is added to the chain it validates all previous blocks ▪ Kind of like a singly linked list that uses hashes instead of pointers ▪ The more blocks after a transaction, the more secure ▪ The first block is called the genesis block ▪ In case of disagreement, consensus is based on the longest chain ▪ If majority of the nodes aren’t colluding, the whole network is secure
  • 18. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Simple Blockchain Example Idx Data Timestamp Hash 0 This is the data stored on the blockchain 20210120T005509Z Genesis block 1 Here is some more data. 20210120T125509Z 6948 F840 1E13 4EAB 508E 2FB1 CB54 8C35 3CB4 AAE2 3B1A A0D3 66C5 335C 5AEA 8B1E 2 This could be a hash of other data 20210121T005509Z 7253 4287 903B FFB0 85DF 0EC5 0D63 9640 72F6 26A5 5343 1F01 F12E 7A14 1E64 3F75 3 If the data is a hash, then it keeps it secret. 20210121T125509Z 8F76 E681 2F24 00E5 FBF0 48FC A16C CBE6 0FDB 9387 77A9 5BFB 1501 B180 546E 7F51 4 Change a block and all future blocks are invalid 20210122T005509Z 66F3 34C6 5129 164A 3661 055F 10BB A1CC 0FAF 4228 579D 15CF C5E7 45ED F4BB 5F11 5 Once a new block is added . . . 20210122T125509Z 4D63 2816 7361 96A9 F66C CC23 ABF5 A635 51F9 E627 C6FA 965E 8DE5 0AF0 95FD F48B 6 then the previous block cannot be changed . . . 20210123T005509Z 296C DD47 43DF 453E 0910 9099 131E B27F 33FF ACC3 2998 B5A9 1FB1 0402 9270 1F67 7 without changing the next block. 20210123T125509Z 1B3F AF1C BDE9 DD3A A493 CD8D 6262 EEE6 0C81 0E69 6086 51BB 8078 FA09 BC69 EDC5 8 Even the slightest change . . . 20210124T005509Z F3ED FD45 7D46 587C 7D1C 0CEB 8F32 D1B8 2CFB 7D55 14CC A68C C489 581B 7095 E0BE 9 triggers a whole different hash. 20210124T125509Z A2EE 401C 0D1C 6881 29E6 EC82 47E4 3921 16D5 CF35 D827 AB3A C08D 5056 95FF 1C7F 10 The last block validates the whole chain 20210125T005509Z 9F9D 97D3 64B9 692B 1934 19A9 7137 C377 75D2 73AF C028 6BDD B7CA BE35 C438 23AA 669C 2798 0331 6C75 E892 9993 4099 73E2 24FA 9802 22B3 52C6 9893 EFE7 EB76 E68D
  • 19. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Blockchain Demo
  • 20. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth What is Mining? (Proof of Work) ▪ Mining is the process of finding a nonce (number used once - unique number) that generates a SHA-256 hash meeting the current difficulty target ▪ The difficulty target is the number of leading zeros ▪ Every 2,016 blocks (~14 days at ~10 min/block), the difficulty target is adjusted based on the network's recent performance ▪ Bitcoins exist as a result of the transaction on the ledger ▪ This effort and power requirement to compute a block, and the blockchain is what secures the ledger ▪ Other proofs include Proof of Authority, Proof of Stake, and Proof of Space
  • 21. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Mining Demo
  • 22. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Proof of Stake ▪ Powered by a smart contract ▪ Only works on established network with existing coin ▪ Proof of work is needed to “seed” the network, then Proof of Stake is the more sustainable evolution ▪ Anyone can stake 32+ Ether coin ▪ Volunteer validate transactions and blocks ▪ Rewarded with Ether for valid blocks ▪ Larger stake = greater reward & more vote ▪ Fraudulent blocks penalize stake ▪ Vulnerable to 51% attack (same as Proof of Work) ▪ No longer uses high amounts of energy and hardware
  • 23. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Smart Contracts ▪ A smart contract is a program that takes place on a blockchain ▪ You can think of a smart contract as a microservice that runs trustless on the backend of your application ▪ Smart contracts have many applications, ranging from sports betting to online voting ▪ The true power of smart contracts is in managing assets that have value and are scarce (NFTs) ▪ Once added to the blockchain, a smart contract becomes public and cannot be modified or removed ▪ This assures users that the rules are transparent and will never change
  • 24. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Smart Contract ≈ Microservice ▪ Like a microservice that exists on a cloud platform and is activated when called ▪ For a smart contract you pay a fee to deploy it, and then the callers pay the cost of calling it ▪ Instead of paying a monthly hosting fee, it is part of the blockchain, and the program runs as needed during block validation
  • 25. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Why are Smart Contracts Cool? ▪ No “terms subject to change” ▪ No “forum” or “venue selection clauses” ▪ No “confidentiality provisions” ▪ No arbitration or mediation clauses ▪ Can be more concise than traditional contracts ▪ Mathematically provable ▪ As a programmer you have the advantage: You don’t need a lawyer to translate! ▪ These can all be negatives too….
  • 26. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Solidity pragma solidity >= 0.7.0 <0.8.0; contract Coin { // The keyword "public" makes variables accessible from other contracts address public minter; mapping (address => uint) public balances; // Events allow clients to react to declared contract changes event Sent (address from, address to, uint amount); // Constructor code is only run when the contract is created constructor() public { minter = msg.sender; } // Sends an amount of newly created coins to an address // Can only be called by the contract creator function mint(address receiver, uint amount) public { require(msg.sender == minter); require(amount < 1e60); balances[receiver] += amount; } // Sends an amount of existing coins from any caller to an address function send(address receiver, uint amount) public { require(amount <= balances[msg.sender], "Insufficient balance."); balances[msg.sender] -= amount; balances[receiver] += amount; emit Sent (msg.sender, receiver, amount); } }
  • 27. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Smart Contract Stack ▪ Web based IDE: remix.ethereum.org ▪ Solidity for VS Code by Juan Blanco ▪ Q&A ethereum.stackexchange.com ▪ Solidity Language: soliditylang.org ▪ Testnets: ethereum.org/en/developers/docs/networks/ ▪ sepolia.dev / goerli.net / arbitrum.io ▪ Each with it’s own faucet ▪ Wallet: metamask.io ▪ Local Ethereum environment: hardhat.org
  • 28. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Smart Contracts Demo
  • 29. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Other Smart Contract Languages ▪ Vyper – 2nd most popular for EVM-compatible blockchains. Contract-oriented, pythonic programming language with strong typing, small compiler code, and efficient bytecode ▪ Yul is an intermediate language for Ethereum that supports the EVM ▪ Cairo is a Turing-complete smart contract programming language built for creating STARK-provable programs for general computation ▪ Rust is a popular smart contract programming language for many non-EVM- compatible blockchains such as Polkadot and Solana ▪ Move is a Rust-based smart contract programming language originally developed for Meta’s Diem blockchain ▪ C++ used by EOS and Antelope based blockchains – compiles to web assembly
  • 30. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth
  • 31. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Ethereum Virtual Machine ▪ Opcodes www.evm.codes ▪ EVM Architecture
  • 32. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Shard Chains & Layer 2 ▪ Sharding is a multi-phase upgrade to improve Ethereum’s scalability and capacity planned for ~2022 ▪ Sharding is the process of splitting the blockchain horizontally to spread the load ▪ Will reduce network congestion and increase transactions per second by creating new chains, known as “shards” ▪ Shard chains spread the network's load across 64 new chains ▪ They make it easier to run a node by keeping hardware requirements low ▪ ethereum.org/en/eth2/shard-chains/ ▪ ethereum.org/en/developers/docs/scaling/layer-2-rollups/
  • 33. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Non-Fungible Tokens (NFTs) ▪ An NFT is a unique blockchain-based digital asset ▪ Links to meta-data defining real-world assets like digital art, music, subscriptions, or tokenized physical assets like houses or cars, etc. ▪ NFT verifies provenance, ownership and access ▪ Ethereum is most popular blockchain for NFT ▪ Ownership rights vary by NFT ▪ Uses immutable public blockchains - usually Ethereum ▪ Based on Smart Contracts, defined by ERC-721
  • 34. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Understanding Fungibility ▪ The value of a coin is fungible (Interchangeable) ▪ Any quarter has a face value of 25¢ ▪ But an individual physical coin is non-fungible (unique) ▪ Especially an older coin may have collectable value ▪ Based on material, history, condition, etc. ▪ Or a certain coin may have sentimental value to the owner ▪ Tied to a memory, source, origin, etc. ▪ NFTs attempt to digitally capture the idea of owning a unique digital asset 25¢
  • 35. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Token Standards (Ethereum Improvement Proposals) ▪ ERC-20 – A standard interface for fungible (interchangeable) tokens, like voting tokens, staking tokens or virtual currencies. ▪ ERC-721 – A standard interface for non-fungible tokens, like a deed for artwork or a song. ▪ ERC-777 – Allows people to build extra functionality on top of tokens such as a mixer contract for improved transaction privacy or an emergency recover function to bail you out if you lose your private keys. ▪ ERC-1155 – Allows for more efficient trades and bundling of transactions – thus saving costs. This token standard allows for creating both utility tokens (such as $BNB or $BAT) and Non-Fungible Tokens like CryptoPunks. ▪ ERC-4626 – A tokenized vault standard designed to optimize and unify the technical parameters of yield-bearing vaults. ▪ Full list: eips.ethereum.org/erc
  • 36. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth ▪ Created in 2015 by Juan Benet of Protocol Labs [ protocol.ai - ipfs.io ] ▪ An open-source protocol and peer-to-peer network for storing and sharing data in a distributed and decentralized file system ▪ Uses content-addressing to uniquely identify each file in a global namespace connecting all computing devices ▪ Inspired by or evolved from BitTorrent ▪ Any user in the network can serve a file by its content address ▪ Peers in the network find and request content using a distributed hash table (DHT) ▪ Frequently used to store NFT related files ▪ FileCoin rewards uses for persisting content [ filecoin.io ] ▪ Supported by Cloudflare, Brave Browser, and others InterPlanetary File System (IPFS)
  • 37. Smart Contracts - The Blockchain Beyond Bitcoin – Jim McKeeth Just the Tip of the Blockchain Iceberg ▪ Blockchain is an emerging technology ▪ Everyone is focused on the Bitcoin gold rush ▪ Blockchain may have the bigger/longer impact ▪ Ethereum is a more evolved platform ▪ Shard, Layer2, & Proof of Stake and other changes improved sustainability ▪ Smart Contracts are the foundation of Ethereum’s platform ▪ NFT is at the peak of inflated expectations today ▪ This is a rapidly evolving family of technologies