THE ETHEREUM BLOCKCHAIN
INTRODUCTION TO SMART CONTRACTS AND DECENTRALIZED
APPLICATIONS
Alessandro Sanino
University of Turin
Computer Science Departmen
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 mainnet
• DApps development principles
THE ETHEREUM BLOCKCHAIN
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
THE ETHEREUM BLOCKCHAIN
There is one main difference:
Transactions can also trigger computer code execution, which is
stored to correspond a certain address.
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
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
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 verify txs
• Can run on almost every device, minimal space requirements
ARCHIVAL NODE
• Big Scary Node ~ Vitalik Buterin
• Downloads all the intermediate states of the blockchain
• Huge requirements (2TB+ SSD and high computation power)
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 arrays.
Supports for constructs to gather blockchain data: block, tx, msg
Supports multiple inheritance
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
• finney = 10^15
• ether = 10^18
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 mutates the contract state (and append to the
blockchain)
• Call operations (read) are free
• Big Contract = Bigger deploy costs
JUST AN EXAMPLE
THE OPENZEPPELIN FRAMEWORK
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
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 Manager (EthPM)
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
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 packages
DEMO TIME
CONCLUSIONS
THANK YOU

More Related Content

PDF
Examples of Smart Contracts
PPTX
Blockchain
PPTX
Introduction to Blockchain and Smart Contracts
PDF
Blockchain 101 | Blockchain Tutorial | Blockchain Smart Contracts | Blockchai...
PDF
PPTX
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
PPTX
Ethereum
PDF
Decentralized applications 101: How and why to build a DApp
Examples of Smart Contracts
Blockchain
Introduction to Blockchain and Smart Contracts
Blockchain 101 | Blockchain Tutorial | Blockchain Smart Contracts | Blockchai...
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Ethereum
Decentralized applications 101: How and why to build a DApp

What's hot (20)

PDF
Blockchain Fundamentals for Beginners - 101 Blockchains
PDF
Bitcoin Crime Investigation
PPTX
Hyperledger Fabric
PPTX
Write smart contract with solidity on Ethereum
PDF
Ethereum Blockchain explained
PDF
Vechicle collateralised loans
PPTX
Blockchain (1).pptx
PDF
Asset Tokenization as an Industry Game Changer
PPTX
Smart Contract Testing
PDF
Introduction To Solidity
PPTX
Consensus Algorithms.pptx
PPTX
Blockchain: Real World Use Cases
PPTX
Ethereum (Blockchain Network)
PPTX
Decentralized Autonomous Organizations: Concept & Practical Examples
PDF
ERC20 Token Contract
PDF
Blockchain Digital Transformation Presentation
PDF
Introduction to Proof of Stake (PoS) in Crypto
PPTX
Ethereum Blockchain with Smart contract and ERC20
PPTX
Fraudless voting with blockchain
Blockchain Fundamentals for Beginners - 101 Blockchains
Bitcoin Crime Investigation
Hyperledger Fabric
Write smart contract with solidity on Ethereum
Ethereum Blockchain explained
Vechicle collateralised loans
Blockchain (1).pptx
Asset Tokenization as an Industry Game Changer
Smart Contract Testing
Introduction To Solidity
Consensus Algorithms.pptx
Blockchain: Real World Use Cases
Ethereum (Blockchain Network)
Decentralized Autonomous Organizations: Concept & Practical Examples
ERC20 Token Contract
Blockchain Digital Transformation Presentation
Introduction to Proof of Stake (PoS) in Crypto
Ethereum Blockchain with Smart contract and ERC20
Fraudless voting with blockchain
Ad

Similar to The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications (20)

PPTX
Block chain
PDF
Introduction to Ethereum Blockchain & Smart Contract
PDF
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
PDF
Building Apps with Ethereum Smart Contract
PPTX
Ethereum
PPTX
Advanced Blockchain Technologies on Privacy and Scalability
PDF
How to Write & Deploy a Smart Contract
PPTX
Ethereum Development Tools
PPTX
Ethereum for developer 16th Nov 2018
PPTX
Ethereum
 
PDF
Ethereum bxl
PPTX
Understanding Ethereum: The Future of Blockchain Technology
PDF
Blockchain Fundamental_KIPMI_2022.02.26.pdf
PPTX
Blockchain workshop 101
PPTX
Resource slides for blockchain related question
PDF
The Decentralized Developer Toolbox by Petros Ring
PDF
Analysing Data from Blockchains - Keynote @ SOCCA 2020
PDF
Ethereum-Cryptocurrency (All about Ethereum)
PPTX
Ethereum 2.0
PPTX
The Foundation of Smart Contract Development on Ethereum
Block chain
Introduction to Ethereum Blockchain & Smart Contract
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
Building Apps with Ethereum Smart Contract
Ethereum
Advanced Blockchain Technologies on Privacy and Scalability
How to Write & Deploy a Smart Contract
Ethereum Development Tools
Ethereum for developer 16th Nov 2018
Ethereum
 
Ethereum bxl
Understanding Ethereum: The Future of Blockchain Technology
Blockchain Fundamental_KIPMI_2022.02.26.pdf
Blockchain workshop 101
Resource slides for blockchain related question
The Decentralized Developer Toolbox by Petros Ring
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Ethereum-Cryptocurrency (All about Ethereum)
Ethereum 2.0
The Foundation of Smart Contract Development on Ethereum
Ad

More from I.I.S. G. Vallauri - Fossano (6)

PPTX
Do IAs Dream of Electric Sheeps? Un'immersione nemmeno troppo noiosa nella IA...
PPTX
Fondamenti di REST API (3/3) - Lo standard REST
PPTX
Fondamenti di REST API (2/3) - I formati di interscambio
PPTX
Fondamenti di REST API (1/3) - I protocolli HTTP e HTTPS
PPTX
The GO Language : From Beginners to Gophers
PPTX
Gamemate - Design and Prototypical Implementation of an Architecture for shar...
Do IAs Dream of Electric Sheeps? Un'immersione nemmeno troppo noiosa nella IA...
Fondamenti di REST API (3/3) - Lo standard REST
Fondamenti di REST API (2/3) - I formati di interscambio
Fondamenti di REST API (1/3) - I protocolli HTTP e HTTPS
The GO Language : From Beginners to Gophers
Gamemate - Design and Prototypical Implementation of an Architecture for shar...

Recently uploaded (20)

PDF
Streamlining Project Management in Microsoft Project, Planner, and Teams with...
PPTX
Chapter_05_System Modeling for software engineering
PPTX
Beige and Black Minimalist Project Deck Presentation (1).pptx
PPTX
Greedy best-first search algorithm always selects the path which appears best...
PDF
Top 10 Project Management Software for Small Teams in 2025.pdf
PPTX
Relevance Tuning with Genetic Algorithms
PDF
How to Set Realistic Project Milestones and Deadlines
PDF
IT Consulting Services to Secure Future Growth
PDF
Odoo Construction Management System by CandidRoot
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
PDF
Building an Inclusive Web Accessibility Made Simple with Accessibility Analyzer
PDF
SOFTWARE ENGINEERING Software Engineering (3rd Edition) by K.K. Aggarwal & Yo...
PPTX
SAP Business AI_L1 Overview_EXTERNAL.pptx
PPTX
UNIT II: Software design, software .pptx
PDF
Difference Between Website and Web Application.pdf
PPTX
MCP empowers AI Agents from Zero to Production
PPTX
Independent Consultants’ Biggest Challenges in ERP Projects – and How Apagen ...
PPTX
Human Computer Interaction lecture Chapter 2.pptx
PDF
Top AI Tools for Project Managers: My 2025 AI Stack
PPTX
Comprehensive Guide to Digital Image Processing Concepts and Applications
Streamlining Project Management in Microsoft Project, Planner, and Teams with...
Chapter_05_System Modeling for software engineering
Beige and Black Minimalist Project Deck Presentation (1).pptx
Greedy best-first search algorithm always selects the path which appears best...
Top 10 Project Management Software for Small Teams in 2025.pdf
Relevance Tuning with Genetic Algorithms
How to Set Realistic Project Milestones and Deadlines
IT Consulting Services to Secure Future Growth
Odoo Construction Management System by CandidRoot
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Building an Inclusive Web Accessibility Made Simple with Accessibility Analyzer
SOFTWARE ENGINEERING Software Engineering (3rd Edition) by K.K. Aggarwal & Yo...
SAP Business AI_L1 Overview_EXTERNAL.pptx
UNIT II: Software design, software .pptx
Difference Between Website and Web Application.pdf
MCP empowers AI Agents from Zero to Production
Independent Consultants’ Biggest Challenges in ERP Projects – and How Apagen ...
Human Computer Interaction lecture Chapter 2.pptx
Top AI Tools for Project Managers: My 2025 AI Stack
Comprehensive Guide to Digital Image Processing Concepts and Applications

The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications

  • 1. THE ETHEREUM BLOCKCHAIN INTRODUCTION TO SMART CONTRACTS AND DECENTRALIZED APPLICATIONS Alessandro Sanino University of Turin Computer Science Departmen
  • 2. AGENDA • The Ethereum Blockchain • Setting up a node • Introduction to Solidity • The OpenZeppelin framework
  • 3. AGENDA • The Truffle Suite • Deployment of a Smart Contract on local environment • Testing Smart Contracts • From test to mainnet • DApps development principles
  • 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. THE ETHEREUM BLOCKCHAIN There is one main difference: Transactions can also trigger computer code execution, which is stored to correspond a certain address.
  • 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. 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. SETTING UP A NODE HOW TO SET UP AN ETHEREUM BLOCKCHAIN DIFFERENT KINDS OF NODES
  • 10. SETTING UP A NODE • Light node • Full node • Archival node
  • 11. FULL NODE • Standard node • Full blockchain sync • Needs a more than average grade machine to sync properly
  • 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. ARCHIVAL NODE • Big Scary Node ~ Vitalik Buterin • Downloads all the intermediate states of the blockchain • Huge requirements (2TB+ SSD and high computation power)
  • 15. THE SOLIDITY LANGUAGE INTRODUCTION TO SMART CONTRACTS PROGRAMMING
  • 16. SOLIDITY • Language to build smart contracts • JS-like syntax • Most popular solution
  • 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. BLOCK Contains useful data like: • timestamp • number (or height) • coinbase • difficulty • gas limit
  • 19. TRANSACTION (TX) Contains current transaction data, like: • origin • gas price
  • 20. MESSAGE (MSG) Contains specific data of the transaction or the call: • sender • Value in wei • Additional custom metadata
  • 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. HANDLING ERRORS Solidity has specific functions to handle failure cases: • throw • assert • require
  • 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
  • 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. ERC20 TOKEN WITH ZEPPELIN
  • 30. THE TRUFFLE SUITE A complete set of frameworks to develop smart contracts • Truffle • Ganache • Smart Contracts Package Manager (EthPM)
  • 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. GANACHE A private Ethereum network deployed on your local machine, it has all the settings customizable via a beautiful UI
  • 33. ETHEREUM PACKAGE MANAGER (ETHPM) • Like npm but on the Ethereum blockchain • Contains a lot of Solidity prebuilt contract packages