SlideShare a Scribd company logo
ETHEREUM SMART
CONTRACTS 101
MEETUP #1
1
ETHEREUM SMART CONTRACTS 101
SUMMARY
▸ About us
▸ Cryptocurrencies - Some Context
▸ Bitcoin
▸ Ethereum
▸ Applications
▸ Smart Contracts and Gas
▸ Create your own contract
▸ ERC20 tokens
▸ Tools
▸ Recap
Blockchaindev #1 - Ethereum Smart Contracts 101
ETHEREUM SMART CONTRACTS 101
BLOCKCHAINDEV MEETUPS
▸ Focused on blockchain technologies
▸ Knowledge-sharing and learning
▸ Beginner friendly
CRYPTOCURRENCIES
SOME CONTEXT
Blockchaindev #1 - Ethereum Smart Contracts 101
ETHEREUM SMART CONTRACTS 101
CRYPTOCURRENCIES - SOME CONTEXT
▸ Cypherpunk Movement (started in the 80s)
▸ Activists, programmers, hackers, researchers,
mathematicians, …
▸ Advocated the use of strong cryptography and privacy
enhancing technologies as a route to social and political
change.
ETHEREUM SMART CONTRACTS 101
CRYPTOCURRENCIES - SOME CONTEXT
▸ Financial Crisis of 2007-2008
▸ During the last quarter of 2008, central banks purchased
US$2.5 trillion of government debt and troubled private
assets from banks
BITCOIN
A P2P ELECTRONIC
CASH SYSTEM
ETHEREUM SMART CONTRACTS 101
October, 2008
ETHEREUM SMART CONTRACTS 101
October, 2008
ETHEREUM SMART CONTRACTS 101
BITCOIN
▸ Decentralized P2P
▸ No need for banks
▸ Limited supply
▸ Strong protection of your digital assets
ETHEREUM SMART CONTRACTS 101
BITCOIN
▸ Sign transactions with a digital signature
▸ Transactions are stored in a blockchain
▸ A consensus algorithm run on the network to verify the
validity of the transactions (proof-of-work)
▸ Transactions are non-reversible
ETHEREUM SMART CONTRACTS 101
BLOCKCHAIN
▸ Database
▸ Distributed
▸ Decentralized
▸ Immutable (write once, append only)
▸ Public (or private)
▸ Stores transactions
ETHEREUM SMART CONTRACTS 101
A blockchain (https://www.computerworld.com/article/3191077/
security/what-is-blockchain-the-most-disruptive-tech-in-decades.html)
ETHEREUM SMART CONTRACTS 101
DECENTRALIZED AND DISTRIBUTED NETWORK
ETHEREUM SMART CONTRACTS 101
NETWORK
▸ Executes code
▸ Validates transactions (consensus)
▸ Mines new blocks
▸ Stores the blockchain
▸ Application infrastructure / supercomputer
ETHEREUM
DECENTRALIZED
APPLICATION PLATFORM
ETHEREUM SMART CONTRACTS 101
Ethereum White Paper (2013)
ETHEREUM SMART CONTRACTS 101
Vitalik Buterin
ETHEREUM SMART CONTRACTS 101
WHAT IS ETHEREUM ANYWAY?
▸ A cryptocurrency (ETH), but more!
▸ A platform for developing and running decentralized
applications
ETHEREUM SMART CONTRACTS 101
WHAT IS ETHEREUM ANYWAY?
▸ Virtual Machine (EVM)
▸ A programming language
▸ A blockchain for state transitions
▸ A “world computer”
ETHEREUM SMART CONTRACTS 101
ETHEREUM: A WORLD COMPUTER
▸ Arbitrary code is executed on the network
▸ You can run your code by creating a Smart Contract
▸ Contracts alter the state of the blockchain
ETHEREUM SMART CONTRACTS 101
APPLICATIONS
▸ Financial
▸ Semi-financial
▸ Non-financial
ETHEREUM SMART CONTRACTS 101
FINANCIAL APPLICATIONS
▸ Payments
▸ Sub-currencies and tokens
▸ Initial Coin Offering (ICOs)
▸ Smart Property
▸ Banking and Trading (derivatives, hedging contracts,
currency, futures, digital assets)
ETHEREUM SMART CONTRACTS 101
SEMI-FINANCIAL APPLICATIONS
▸ Bounties
▸ Coupons, any type of miles
▸ Gambling
▸ Marketplaces and Monetization
ETHEREUM SMART CONTRACTS 101
NON-FINANCIAL APPLICATIONS
▸ Reputation and identity
▸ Decentralized Autonomous Organizations (DAOs)
▸ Voting
▸ Games (cryptokitties)
▸ Decentralized file storage
ALSO, MEMES…
SMART CONTRACTS
HOW TO RUN YOUR CODE ON THE EVM
ETHEREUM SMART CONTRACTS 101
SMART CONTRACTS
▸ Computerized transaction protocol that executes the terms
of a contract
▸ A contract is defined as a piece of code
▸ Self-executing contract
▸ You can create use it as a backend for your dapps
ETHEREUM SMART CONTRACTS 101
SMART CONTRACTS
▸ Your smart contract will contain instructions
▸ The code is also stored on the blockchain
▸ The execution of the code can create transactions and a
new state of the blockchain
ETHEREUM AND CRYPTO-LAW: USES
BLOCKCHAIN TO IMPLEMENT
ARBITRARY SOCIAL CONTRACTS
WITHOUT A CENTRAL SERVER
Dr. Gavin Wood
ETHEREUM SMART CONTRACTS 101
ETHEREUM SMART CONTRACTS 101
GAS
▸ Execution fee or cost
▸ Reading information is free
▸ Changing data/creating transactions costs gas
▸ You pay gas to the network
ETHEREUM SMART CONTRACTS 101
GAS
▸ Incentive for nodes to run your code and store your data
▸ Code must be efficient (time + space complexity) to
optimize the costs
▸ Different instructions have different costs
▸ You can add more gas to your transactions to have a
higher priority
ETHEREUM SMART CONTRACTS 101
EXAMPLES OF INSTRUCTIONS AND THEIR GAS PRICES
▸ Calculating a hash
▸ Multiplying two numbers
▸ See link
GETTING STARTED
ETHEREUM SMART CONTRACTS 101
CREATING A SMART CONTRACT
▸ Install Metamask and create a wallet
▸ Use the Rinkeby test network
▸ Get some fake ether @ rinkeby faucet
▸ Open remix and create your contract
▸ Deploy on (injected web3) and check etherscan.io!
▸ Also check web3.js
Blockchaindev #1 - Ethereum Smart Contracts 101
ETHEREUM SMART CONTRACTS 101
ERC20 TOKEN STANDARD
▸ Read the ERC20 Token Standard
▸ Implement the EIP20Interface to create your own token
Blockchaindev #1 - Ethereum Smart Contracts 101
ETHEREUM SMART CONTRACTS 101
OTHER TOOLS YOU CAN USE
▸ GETH: command line interface + ethereum node
▸ Drizzle: front-end libs for dapps
▸ Truffle: development environment for ethereum
▸ Ganache: run your personal blockchain
ETHEREUM SMART CONTRACTS 101
RECAP
▸ Decentralization is good!
▸ You can create your own Smart contracts and dapps to run
on the ethereum network
▸ Create your own tokens by implementing the EIP20
interface
▸ Use web3js on the frontend (ethereum js api)
KTHXBYE
Thiago Araujo
@thdaraujo (twitter)
thd.araujo@gmail.com
aleph.uno (blog)

More Related Content

PDF
Ethereum in a nutshell
PPTX
Ethereum (Blockchain Network)
PPTX
Ethereum Blockchain with Smart contract and ERC20
PDF
Ethereum-Cryptocurrency (All about Ethereum)
PPTX
Intro to smart contract on blockchain en
PDF
Blockchain and Cryptocurrency for Dummies
PPTX
Smart Contract & Ethereum
PPTX
Learning Solidity
Ethereum in a nutshell
Ethereum (Blockchain Network)
Ethereum Blockchain with Smart contract and ERC20
Ethereum-Cryptocurrency (All about Ethereum)
Intro to smart contract on blockchain en
Blockchain and Cryptocurrency for Dummies
Smart Contract & Ethereum
Learning Solidity

What's hot (20)

PPTX
Bitcoin, Ethereum, Smart Contract & Blockchain
PDF
How To Start A Career In The NFT Space?
PDF
What is a blockchain?
PDF
Crypto Wallet Types Explained
PPTX
Ethereum Smart contract
PPTX
Ethereum
PDF
Nft for beginners the perfect basic guide to learn everything about non fungi...
PDF
Getting Started in Blockchain Security and Smart Contract Auditing
PPSX
Cryptocurrency
PPTX
What is Erc20 token? How it Works/
PDF
Blockchain 101 | Blockchain Tutorial | Blockchain Smart Contracts | Blockchai...
PPTX
Blockchain types architecture
PPTX
Blockchain and distributed ledgers
PDF
Blockchain Explained
PPTX
Write smart contract with solidity on Ethereum
PDF
Blockchain Technology Fundamentals
PDF
An Overview of Stablecoin
PDF
Smart contracts & dApps
PDF
How NFT Works
PPTX
Hyperledger Fabric
Bitcoin, Ethereum, Smart Contract & Blockchain
How To Start A Career In The NFT Space?
What is a blockchain?
Crypto Wallet Types Explained
Ethereum Smart contract
Ethereum
Nft for beginners the perfect basic guide to learn everything about non fungi...
Getting Started in Blockchain Security and Smart Contract Auditing
Cryptocurrency
What is Erc20 token? How it Works/
Blockchain 101 | Blockchain Tutorial | Blockchain Smart Contracts | Blockchai...
Blockchain types architecture
Blockchain and distributed ledgers
Blockchain Explained
Write smart contract with solidity on Ethereum
Blockchain Technology Fundamentals
An Overview of Stablecoin
Smart contracts & dApps
How NFT Works
Hyperledger Fabric
Ad

Similar to Blockchaindev #1 - Ethereum Smart Contracts 101 (20)

PDF
Part 4: Understanding the working of Smart Contracts
PDF
Building Apps with Ethereum Smart Contract
PPTX
Understanding Ethereum: The Future of Blockchain Technology
PDF
solutions.hamburg | web3 // smart contracts // ethereum
PDF
Blockchain for Notaries
PPTX
The Foundation of Smart Contract Development on Ethereum
PDF
Writing smart contracts
PPTX
Blockchain, smart contracts - introduction
PPTX
Chapter 3.pptx
PPT
Blockchain presentation to isaca (kemp)
DOCX
Impact of Blockchain on IT AuditBlockchain Techn.docx
PDF
Ethereum - Teory and Practice
PPTX
Event Itnig - Smart Contracts by MarketPay, Juan Ignacio Pérez Sacristán
PPTX
Hacking Finance: Crypto & Math based Currencies, Smart contracts and Blockch...
PPTX
Introduction to Solidity and Smart Contract Development (9).pptx
PDF
Introduction to Ethereum Blockchain & Smart Contract
PDF
Neo - Smart Economy
PPTX
Distributed Ledgers, Blockchains, and Smart Contracts
PDF
How to Create Your Own ERC-20 Token in Simple Steps.pdf
PPTX
Smart contractjp smartcontract_about
Part 4: Understanding the working of Smart Contracts
Building Apps with Ethereum Smart Contract
Understanding Ethereum: The Future of Blockchain Technology
solutions.hamburg | web3 // smart contracts // ethereum
Blockchain for Notaries
The Foundation of Smart Contract Development on Ethereum
Writing smart contracts
Blockchain, smart contracts - introduction
Chapter 3.pptx
Blockchain presentation to isaca (kemp)
Impact of Blockchain on IT AuditBlockchain Techn.docx
Ethereum - Teory and Practice
Event Itnig - Smart Contracts by MarketPay, Juan Ignacio Pérez Sacristán
Hacking Finance: Crypto & Math based Currencies, Smart contracts and Blockch...
Introduction to Solidity and Smart Contract Development (9).pptx
Introduction to Ethereum Blockchain & Smart Contract
Neo - Smart Economy
Distributed Ledgers, Blockchains, and Smart Contracts
How to Create Your Own ERC-20 Token in Simple Steps.pdf
Smart contractjp smartcontract_about
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
Teaching material agriculture food technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
MYSQL Presentation for SQL database connectivity
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
KodekX | Application Modernization Development
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Mobile App Security Testing_ A Comprehensive Guide.pdf
20250228 LYD VKU AI Blended-Learning.pptx
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
KodekX | Application Modernization Development
“AI and Expert System Decision Support & Business Intelligence Systems”
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

Blockchaindev #1 - Ethereum Smart Contracts 101

  • 2. ETHEREUM SMART CONTRACTS 101 SUMMARY ▸ About us ▸ Cryptocurrencies - Some Context ▸ Bitcoin ▸ Ethereum ▸ Applications ▸ Smart Contracts and Gas ▸ Create your own contract ▸ ERC20 tokens ▸ Tools ▸ Recap
  • 4. ETHEREUM SMART CONTRACTS 101 BLOCKCHAINDEV MEETUPS ▸ Focused on blockchain technologies ▸ Knowledge-sharing and learning ▸ Beginner friendly
  • 7. ETHEREUM SMART CONTRACTS 101 CRYPTOCURRENCIES - SOME CONTEXT ▸ Cypherpunk Movement (started in the 80s) ▸ Activists, programmers, hackers, researchers, mathematicians, … ▸ Advocated the use of strong cryptography and privacy enhancing technologies as a route to social and political change.
  • 8. ETHEREUM SMART CONTRACTS 101 CRYPTOCURRENCIES - SOME CONTEXT ▸ Financial Crisis of 2007-2008 ▸ During the last quarter of 2008, central banks purchased US$2.5 trillion of government debt and troubled private assets from banks
  • 10. ETHEREUM SMART CONTRACTS 101 October, 2008
  • 11. ETHEREUM SMART CONTRACTS 101 October, 2008
  • 12. ETHEREUM SMART CONTRACTS 101 BITCOIN ▸ Decentralized P2P ▸ No need for banks ▸ Limited supply ▸ Strong protection of your digital assets
  • 13. ETHEREUM SMART CONTRACTS 101 BITCOIN ▸ Sign transactions with a digital signature ▸ Transactions are stored in a blockchain ▸ A consensus algorithm run on the network to verify the validity of the transactions (proof-of-work) ▸ Transactions are non-reversible
  • 14. ETHEREUM SMART CONTRACTS 101 BLOCKCHAIN ▸ Database ▸ Distributed ▸ Decentralized ▸ Immutable (write once, append only) ▸ Public (or private) ▸ Stores transactions
  • 15. ETHEREUM SMART CONTRACTS 101 A blockchain (https://www.computerworld.com/article/3191077/ security/what-is-blockchain-the-most-disruptive-tech-in-decades.html)
  • 16. ETHEREUM SMART CONTRACTS 101 DECENTRALIZED AND DISTRIBUTED NETWORK
  • 17. ETHEREUM SMART CONTRACTS 101 NETWORK ▸ Executes code ▸ Validates transactions (consensus) ▸ Mines new blocks ▸ Stores the blockchain ▸ Application infrastructure / supercomputer
  • 19. ETHEREUM SMART CONTRACTS 101 Ethereum White Paper (2013)
  • 20. ETHEREUM SMART CONTRACTS 101 Vitalik Buterin
  • 21. ETHEREUM SMART CONTRACTS 101 WHAT IS ETHEREUM ANYWAY? ▸ A cryptocurrency (ETH), but more! ▸ A platform for developing and running decentralized applications
  • 22. ETHEREUM SMART CONTRACTS 101 WHAT IS ETHEREUM ANYWAY? ▸ Virtual Machine (EVM) ▸ A programming language ▸ A blockchain for state transitions ▸ A “world computer”
  • 23. ETHEREUM SMART CONTRACTS 101 ETHEREUM: A WORLD COMPUTER ▸ Arbitrary code is executed on the network ▸ You can run your code by creating a Smart Contract ▸ Contracts alter the state of the blockchain
  • 24. ETHEREUM SMART CONTRACTS 101 APPLICATIONS ▸ Financial ▸ Semi-financial ▸ Non-financial
  • 25. ETHEREUM SMART CONTRACTS 101 FINANCIAL APPLICATIONS ▸ Payments ▸ Sub-currencies and tokens ▸ Initial Coin Offering (ICOs) ▸ Smart Property ▸ Banking and Trading (derivatives, hedging contracts, currency, futures, digital assets)
  • 26. ETHEREUM SMART CONTRACTS 101 SEMI-FINANCIAL APPLICATIONS ▸ Bounties ▸ Coupons, any type of miles ▸ Gambling ▸ Marketplaces and Monetization
  • 27. ETHEREUM SMART CONTRACTS 101 NON-FINANCIAL APPLICATIONS ▸ Reputation and identity ▸ Decentralized Autonomous Organizations (DAOs) ▸ Voting ▸ Games (cryptokitties) ▸ Decentralized file storage
  • 29. SMART CONTRACTS HOW TO RUN YOUR CODE ON THE EVM
  • 30. ETHEREUM SMART CONTRACTS 101 SMART CONTRACTS ▸ Computerized transaction protocol that executes the terms of a contract ▸ A contract is defined as a piece of code ▸ Self-executing contract ▸ You can create use it as a backend for your dapps
  • 31. ETHEREUM SMART CONTRACTS 101 SMART CONTRACTS ▸ Your smart contract will contain instructions ▸ The code is also stored on the blockchain ▸ The execution of the code can create transactions and a new state of the blockchain
  • 32. ETHEREUM AND CRYPTO-LAW: USES BLOCKCHAIN TO IMPLEMENT ARBITRARY SOCIAL CONTRACTS WITHOUT A CENTRAL SERVER Dr. Gavin Wood ETHEREUM SMART CONTRACTS 101
  • 33. ETHEREUM SMART CONTRACTS 101 GAS ▸ Execution fee or cost ▸ Reading information is free ▸ Changing data/creating transactions costs gas ▸ You pay gas to the network
  • 34. ETHEREUM SMART CONTRACTS 101 GAS ▸ Incentive for nodes to run your code and store your data ▸ Code must be efficient (time + space complexity) to optimize the costs ▸ Different instructions have different costs ▸ You can add more gas to your transactions to have a higher priority
  • 35. ETHEREUM SMART CONTRACTS 101 EXAMPLES OF INSTRUCTIONS AND THEIR GAS PRICES ▸ Calculating a hash ▸ Multiplying two numbers ▸ See link
  • 37. ETHEREUM SMART CONTRACTS 101 CREATING A SMART CONTRACT ▸ Install Metamask and create a wallet ▸ Use the Rinkeby test network ▸ Get some fake ether @ rinkeby faucet ▸ Open remix and create your contract ▸ Deploy on (injected web3) and check etherscan.io! ▸ Also check web3.js
  • 39. ETHEREUM SMART CONTRACTS 101 ERC20 TOKEN STANDARD ▸ Read the ERC20 Token Standard ▸ Implement the EIP20Interface to create your own token
  • 41. ETHEREUM SMART CONTRACTS 101 OTHER TOOLS YOU CAN USE ▸ GETH: command line interface + ethereum node ▸ Drizzle: front-end libs for dapps ▸ Truffle: development environment for ethereum ▸ Ganache: run your personal blockchain
  • 42. ETHEREUM SMART CONTRACTS 101 RECAP ▸ Decentralization is good! ▸ You can create your own Smart contracts and dapps to run on the ethereum network ▸ Create your own tokens by implementing the EIP20 interface ▸ Use web3js on the frontend (ethereum js api)