SlideShare una empresa de Scribd logo
1 de 36
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

Más contenido relacionado

La actualidad más candente

Write smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumWrite smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumMurughan Palaniachari
 
Crypto Wallet Types Explained
Crypto Wallet Types ExplainedCrypto Wallet Types Explained
Crypto Wallet Types Explained101 Blockchains
 
Introduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptxIntroduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptxGene Leybzon
 
Smart Contract & Ethereum
Smart Contract & EthereumSmart Contract & Ethereum
Smart Contract & EthereumAkshay Singh
 
Blockchain, Hyperledger and the Oracle Blockchain Platform
Blockchain, Hyperledger and the Oracle Blockchain PlatformBlockchain, Hyperledger and the Oracle Blockchain Platform
Blockchain, Hyperledger and the Oracle Blockchain PlatformJuarez Junior
 
What is DeFi ? | Decentralized Finance
What is DeFi ? | Decentralized Finance What is DeFi ? | Decentralized Finance
What is DeFi ? | Decentralized Finance zaarahary
 
What is tokenization in blockchain?
What is tokenization in blockchain?What is tokenization in blockchain?
What is tokenization in blockchain?Ulf Mattsson
 
Institutional DeFi Architecture
Institutional DeFi ArchitectureInstitutional DeFi Architecture
Institutional DeFi ArchitectureFloyd DCosta
 
DeFi - Decentralized Finance - Wallstreet Meets Blockchain
DeFi - Decentralized Finance - Wallstreet Meets BlockchainDeFi - Decentralized Finance - Wallstreet Meets Blockchain
DeFi - Decentralized Finance - Wallstreet Meets BlockchainThatCrypto
 
Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...
Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...
Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...Edureka!
 
Smart contracts using web3.js
Smart contracts using web3.jsSmart contracts using web3.js
Smart contracts using web3.jsFelix Crisan
 
An Investor's Guide to Web3 / Crypto / Blockchain
An Investor's Guide to Web3 / Crypto / BlockchainAn Investor's Guide to Web3 / Crypto / Blockchain
An Investor's Guide to Web3 / Crypto / BlockchainBernard Leong
 
Blockchaindev #1 - Ethereum Smart Contracts 101
Blockchaindev #1 - Ethereum Smart Contracts 101Blockchaindev #1 - Ethereum Smart Contracts 101
Blockchaindev #1 - Ethereum Smart Contracts 101Thiago Araujo
 
DeFi - What it's all about
DeFi - What it's all aboutDeFi - What it's all about
DeFi - What it's all aboutChinmay Patel
 
An Introduction to Blockchain Technology
An Introduction to Blockchain Technology An Introduction to Blockchain Technology
An Introduction to Blockchain Technology Niuversity
 
Examples of Smart Contracts
Examples of Smart ContractsExamples of Smart Contracts
Examples of Smart Contracts101 Blockchains
 

La actualidad más candente (20)

Write smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumWrite smart contract with solidity on Ethereum
Write smart contract with solidity on Ethereum
 
DeFi PPT.pptx
DeFi PPT.pptxDeFi PPT.pptx
DeFi PPT.pptx
 
Crypto Wallet Types Explained
Crypto Wallet Types ExplainedCrypto Wallet Types Explained
Crypto Wallet Types Explained
 
Introduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptxIntroduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptx
 
Smart Contract & Ethereum
Smart Contract & EthereumSmart Contract & Ethereum
Smart Contract & Ethereum
 
Blockchain, Hyperledger and the Oracle Blockchain Platform
Blockchain, Hyperledger and the Oracle Blockchain PlatformBlockchain, Hyperledger and the Oracle Blockchain Platform
Blockchain, Hyperledger and the Oracle Blockchain Platform
 
What is DeFi ? | Decentralized Finance
What is DeFi ? | Decentralized Finance What is DeFi ? | Decentralized Finance
What is DeFi ? | Decentralized Finance
 
What is tokenization in blockchain?
What is tokenization in blockchain?What is tokenization in blockchain?
What is tokenization in blockchain?
 
Institutional DeFi Architecture
Institutional DeFi ArchitectureInstitutional DeFi Architecture
Institutional DeFi Architecture
 
DeFi - Decentralized Finance - Wallstreet Meets Blockchain
DeFi - Decentralized Finance - Wallstreet Meets BlockchainDeFi - Decentralized Finance - Wallstreet Meets Blockchain
DeFi - Decentralized Finance - Wallstreet Meets Blockchain
 
Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...
Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...
Ethereum Smart Contracts Tutorial | Deploying Smart Contracts | Blockchain Tr...
 
Blockchain 2.0
Blockchain 2.0Blockchain 2.0
Blockchain 2.0
 
Smart contracts using web3.js
Smart contracts using web3.jsSmart contracts using web3.js
Smart contracts using web3.js
 
Introduction to Blockchain
Introduction to BlockchainIntroduction to Blockchain
Introduction to Blockchain
 
An Investor's Guide to Web3 / Crypto / Blockchain
An Investor's Guide to Web3 / Crypto / BlockchainAn Investor's Guide to Web3 / Crypto / Blockchain
An Investor's Guide to Web3 / Crypto / Blockchain
 
Blockchaindev #1 - Ethereum Smart Contracts 101
Blockchaindev #1 - Ethereum Smart Contracts 101Blockchaindev #1 - Ethereum Smart Contracts 101
Blockchaindev #1 - Ethereum Smart Contracts 101
 
DeFi - What it's all about
DeFi - What it's all aboutDeFi - What it's all about
DeFi - What it's all about
 
Ethereum
EthereumEthereum
Ethereum
 
An Introduction to Blockchain Technology
An Introduction to Blockchain Technology An Introduction to Blockchain Technology
An Introduction to Blockchain Technology
 
Examples of Smart Contracts
Examples of Smart ContractsExamples of Smart Contracts
Examples of Smart Contracts
 

Similar a The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized Applications

Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractThanh Nguyen
 
Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Truong Nguyen
 
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open) Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open) Kaleido
 
Building Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart ContractBuilding Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart ContractVaideeswaran Sethuraman
 
Advanced Blockchain Technologies on Privacy and Scalability
Advanced Blockchain Technologies on Privacy and ScalabilityAdvanced Blockchain Technologies on Privacy and Scalability
Advanced Blockchain Technologies on Privacy and ScalabilityAll Things Open
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractAll Things Open
 
Ethereum for developer 16th Nov 2018
Ethereum for developer 16th Nov 2018Ethereum for developer 16th Nov 2018
Ethereum for developer 16th Nov 2018Hu Kenneth
 
Ethereum
EthereumEthereum
EthereumV C
 
Blockchain Fundamental_KIPMI_2022.02.26.pdf
Blockchain Fundamental_KIPMI_2022.02.26.pdfBlockchain Fundamental_KIPMI_2022.02.26.pdf
Blockchain Fundamental_KIPMI_2022.02.26.pdfadinugroho751867
 
Blockchain workshop 101
Blockchain workshop 101Blockchain workshop 101
Blockchain workshop 101Karthikeyan VK
 
Resource slides for blockchain related question
Resource slides for blockchain related questionResource slides for blockchain related question
Resource slides for blockchain related questionLin Lin (Wendy)
 
The Decentralized Developer Toolbox by Petros Ring
The Decentralized Developer Toolbox by Petros RingThe Decentralized Developer Toolbox by Petros Ring
The Decentralized Developer Toolbox by Petros RingBlock 16
 
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Ingo Weber
 
Introducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum CompatibilityIntroducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum CompatibilityPureStake
 

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

Block chain
Block chainBlock chain
Block chain
 
Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart Contract
 
Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20
 
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open) Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
Advanced Blockchain Technologies on Privacy & Scalability (All Things Open)
 
Building Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart ContractBuilding Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart Contract
 
Ethereum
EthereumEthereum
Ethereum
 
Advanced Blockchain Technologies on Privacy and Scalability
Advanced Blockchain Technologies on Privacy and ScalabilityAdvanced Blockchain Technologies on Privacy and Scalability
Advanced Blockchain Technologies on Privacy and Scalability
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
 
Ethereum Development Tools
Ethereum Development ToolsEthereum Development Tools
Ethereum Development Tools
 
Ethereum for developer 16th Nov 2018
Ethereum for developer 16th Nov 2018Ethereum for developer 16th Nov 2018
Ethereum for developer 16th Nov 2018
 
Ethereum
EthereumEthereum
Ethereum
 
Ethereum bxl
Ethereum bxlEthereum bxl
Ethereum bxl
 
Blockchain Fundamental_KIPMI_2022.02.26.pdf
Blockchain Fundamental_KIPMI_2022.02.26.pdfBlockchain Fundamental_KIPMI_2022.02.26.pdf
Blockchain Fundamental_KIPMI_2022.02.26.pdf
 
Blockchain workshop 101
Blockchain workshop 101Blockchain workshop 101
Blockchain workshop 101
 
Resource slides for blockchain related question
Resource slides for blockchain related questionResource slides for blockchain related question
Resource slides for blockchain related question
 
The Decentralized Developer Toolbox by Petros Ring
The Decentralized Developer Toolbox by Petros RingThe Decentralized Developer Toolbox by Petros Ring
The Decentralized Developer Toolbox by Petros Ring
 
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020
 
Ethereum 2.0
Ethereum 2.0Ethereum 2.0
Ethereum 2.0
 
Introducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum CompatibilityIntroducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
 
Etherium Intro for techies
Etherium Intro for techiesEtherium Intro for techies
Etherium Intro for techies
 

Último

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Último (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

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