Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
THE ETHEREUM BLOCKCHAIN
INTRODUCTION TO SMART CONTRACTS AND DECENTRALIZED
APPLICATIONS
Alessandro Sanino
University of Tur...
AGENDA
• The Ethereum Blockchain
• Setting up a node
• Introduction to Solidity
• The OpenZeppelin framework
AGENDA
• The Truffle Suite
• Deployment of a Smart Contract on local environment
• Testing Smart Contracts
• From test to ...
THE ETHEREUM BLOCKCHAIN
THE ETHEREUM BLOCKCHAIN
• Same high level architecture as Bitcoin or other Blockchains
• PoW consensus model
• Miners set ...
THE ETHEREUM BLOCKCHAIN
There is one main difference:
Transactions can also trigger computer code execution, which is
stor...
THE ETHEREUM BLOCKCHAIN
Transactions can also trigger computer code execution, which is
stored to correspond a certain add...
SMART CONTRACTS 101
• When validating a state change on the smart contract, every
node in the network computes indipendent...
SETTING UP A NODE
HOW TO SET UP AN ETHEREUM BLOCKCHAIN DIFFERENT KINDS OF
NODES
SETTING UP A NODE
• Light node
• Full node
• Archival node
FULL NODE
• Standard node
• Full blockchain sync
• Needs a more than average grade machine to sync properly
LIGHT NODE
• Lightweight version of the full node
• Syncs only block headers, therefore needs a full node to check
and ver...
ARCHIVAL NODE
• Big Scary Node ~ Vitalik Buterin
• Downloads all the intermediate states of the blockchain
• Huge requirem...
SUPER QUICK DEMO
THE SOLIDITY LANGUAGE
INTRODUCTION TO SMART CONTRACTS PROGRAMMING
SOLIDITY
• Language to build smart contracts
• JS-like syntax
• Most popular solution
SOLIDITY
Solidity supports a lot of native types, like addresses, uints,
strings, arrays, structs and fixed-size bytes arr...
BLOCK
Contains useful data like:
• timestamp
• number (or height)
• coinbase
• difficulty
• gas limit
TRANSACTION (TX)
Contains current transaction data, like:
• origin
• gas price
MESSAGE (MSG)
Contains specific data of the transaction or the call:
• sender
• Value in wei
• Additional custom metadata
OTHER SOLIDITY GLOBALS
Time units : (seconds, minutes, hours, days, weeks, now)
Ether units:
• wei = 1
• szabo = 10^12
• f...
HANDLING ERRORS
Solidity has specific functions to handle failure cases:
• throw
• assert
• require
ADDITIONAL GOTCHAS
• Memory VS Storage variable location
• Stack is limited !!!
• Every transaction has a cost
• Only tx m...
JUST AN EXAMPLE
THE OPENZEPPELIN FRAMEWORK
OPENZEPPELIN
A framework by the zeppelin foundation, it contains smart
contracts which have already been audited by profes...
ERC20 TOKEN WITH ZEPPELIN
BREAK TIME
THE TRUFFLE SUITE
THE TRUFFLE SUITE
A complete set of frameworks to develop smart contracts
• Truffle
• Ganache
• Smart Contracts Package Ma...
TRUFFLE
It is used to develop smart contracts thanks to an easy to use CLI
interface
You just develop your contracts and u...
GANACHE
A private Ethereum network deployed on your local machine, it
has all the settings customizable via a beautiful UI
ETHEREUM PACKAGE MANAGER (ETHPM)
• Like npm but on the Ethereum blockchain
• Contains a lot of Solidity prebuilt contract ...
DEMO TIME
CONCLUSIONS
THANK YOU
Upcoming SlideShare
Loading in …5
×

of

The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 1 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 2 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 3 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 4 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 5 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 6 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 7 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 8 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 9 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 10 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 11 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 12 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 13 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 14 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 15 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 16 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 17 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 18 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 19 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 20 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 21 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 22 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 23 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 24 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 25 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 26 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 27 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 28 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 29 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 30 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 31 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 32 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 33 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 34 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 35 The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications Slide 36
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

1 Like

Share

Download to read offline

The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications

Download to read offline

This set of slides is about Ethereum Blockchain and and introduction to Ethereum Smart Contracts. Arguments covered:
- Ethereum chain
- Ethereum nodes
- Solidity language
- Truffle suite
- Dapps development principles

Presentation of 05/30/2019 in University of Turin

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications

  1. 1. THE ETHEREUM BLOCKCHAIN INTRODUCTION TO SMART CONTRACTS AND DECENTRALIZED APPLICATIONS Alessandro Sanino University of Turin Computer Science Departmen
  2. 2. AGENDA • The Ethereum Blockchain • Setting up a node • Introduction to Solidity • The OpenZeppelin framework
  3. 3. AGENDA • The Truffle Suite • Deployment of a Smart Contract on local environment • Testing Smart Contracts • From test to mainnet • DApps development principles
  4. 4. THE ETHEREUM BLOCKCHAIN
  5. 5. THE ETHEREUM BLOCKCHAIN • Same high level architecture as Bitcoin or other Blockchains • PoW consensus model • Miners set up a gas price and gas limit to choose which tx to mine
  6. 6. THE ETHEREUM BLOCKCHAIN There is one main difference: Transactions can also trigger computer code execution, which is stored to correspond a certain address.
  7. 7. THE ETHEREUM BLOCKCHAIN Transactions can also trigger computer code execution, which is stored to correspond a certain address The so-called SMART CONTRACTS, can be triggered by querying any node on the network via CALL statements or TRANSACTIONS
  8. 8. SMART CONTRACTS 101 • When validating a state change on the smart contract, every node in the network computes indipendently the result • Decentralized computing • Non Censorable • 100% uptime • Tamper-evident, therefore extremely difficult to corrupt
  9. 9. SETTING UP A NODE HOW TO SET UP AN ETHEREUM BLOCKCHAIN DIFFERENT KINDS OF NODES
  10. 10. SETTING UP A NODE • Light node • Full node • Archival node
  11. 11. FULL NODE • Standard node • Full blockchain sync • Needs a more than average grade machine to sync properly
  12. 12. LIGHT NODE • Lightweight version of the full node • Syncs only block headers, therefore needs a full node to check and verify txs • Can run on almost every device, minimal space requirements
  13. 13. ARCHIVAL NODE • Big Scary Node ~ Vitalik Buterin • Downloads all the intermediate states of the blockchain • Huge requirements (2TB+ SSD and high computation power)
  14. 14. SUPER QUICK DEMO
  15. 15. THE SOLIDITY LANGUAGE INTRODUCTION TO SMART CONTRACTS PROGRAMMING
  16. 16. SOLIDITY • Language to build smart contracts • JS-like syntax • Most popular solution
  17. 17. SOLIDITY Solidity supports a lot of native types, like addresses, uints, strings, arrays, structs and fixed-size bytes arrays. Supports for constructs to gather blockchain data: block, tx, msg Supports multiple inheritance
  18. 18. BLOCK Contains useful data like: • timestamp • number (or height) • coinbase • difficulty • gas limit
  19. 19. TRANSACTION (TX) Contains current transaction data, like: • origin • gas price
  20. 20. MESSAGE (MSG) Contains specific data of the transaction or the call: • sender • Value in wei • Additional custom metadata
  21. 21. OTHER SOLIDITY GLOBALS Time units : (seconds, minutes, hours, days, weeks, now) Ether units: • wei = 1 • szabo = 10^12 • finney = 10^15 • ether = 10^18
  22. 22. HANDLING ERRORS Solidity has specific functions to handle failure cases: • throw • assert • require
  23. 23. ADDITIONAL GOTCHAS • Memory VS Storage variable location • Stack is limited !!! • Every transaction has a cost • Only tx mutates the contract state (and append to the blockchain) • Call operations (read) are free • Big Contract = Bigger deploy costs
  24. 24. JUST AN EXAMPLE
  25. 25. THE OPENZEPPELIN FRAMEWORK
  26. 26. OPENZEPPELIN A framework by the zeppelin foundation, it contains smart contracts which have already been audited by professionals and implement most used use cases (e.g. Tokens, Crowdsales, etc…) https://github.com/OpenZeppelin/openzeppelin-solidity
  27. 27. ERC20 TOKEN WITH ZEPPELIN
  28. 28. BREAK TIME
  29. 29. THE TRUFFLE SUITE
  30. 30. THE TRUFFLE SUITE A complete set of frameworks to develop smart contracts • Truffle • Ganache • Smart Contracts Package Manager (EthPM)
  31. 31. TRUFFLE It is used to develop smart contracts thanks to an easy to use CLI interface You just develop your contracts and use it to compile, migrate and test. Based on Web3JS and Javascript ES6
  32. 32. GANACHE A private Ethereum network deployed on your local machine, it has all the settings customizable via a beautiful UI
  33. 33. ETHEREUM PACKAGE MANAGER (ETHPM) • Like npm but on the Ethereum blockchain • Contains a lot of Solidity prebuilt contract packages
  34. 34. DEMO TIME
  35. 35. CONCLUSIONS
  36. 36. THANK YOU
  • davidorban

    Jun. 13, 2019

This set of slides is about Ethereum Blockchain and and introduction to Ethereum Smart Contracts. Arguments covered: - Ethereum chain - Ethereum nodes - Solidity language - Truffle suite - Dapps development principles Presentation of 05/30/2019 in University of Turin

Views

Total views

224

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

10

Shares

0

Comments

0

Likes

1

×