SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Magento PWA Studio extensibility
Magento PWA Studio extensibilityMagento PWA Studio extensibility
Magento PWA Studio extensibilityLars Roettig
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explainedjeetendra mandal
 
Decentralized exchanges
Decentralized exchangesDecentralized exchanges
Decentralized exchangesCryptoMonday
 
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...Vietnam Open Infrastructure User Group
 
Smart Contract Testing
Smart Contract TestingSmart Contract Testing
Smart Contract TestingDilum Bandara
 
Designing a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd productsDesigning a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd productsJulian Mazzitelli
 
Nginx Architecture
Nginx ArchitectureNginx Architecture
Nginx Architecture건 손
 
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...confluent
 
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Vietnam Open Infrastructure User Group
 
Kafka and Machine Learning in Banking and Insurance Industry
Kafka and Machine Learning in Banking and Insurance IndustryKafka and Machine Learning in Banking and Insurance Industry
Kafka and Machine Learning in Banking and Insurance IndustryKai Wähner
 
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
 
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...Edureka!
 
Digital Certificate Verification based on blockchain ethereum
Digital Certificate Verification based on blockchain ethereumDigital Certificate Verification based on blockchain ethereum
Digital Certificate Verification based on blockchain ethereumnurhaniffah1
 
Apache Arrow Flight Overview
Apache Arrow Flight OverviewApache Arrow Flight Overview
Apache Arrow Flight OverviewJacques Nadeau
 

Tendances (20)

Microservices
MicroservicesMicroservices
Microservices
 
Magento PWA Studio extensibility
Magento PWA Studio extensibilityMagento PWA Studio extensibility
Magento PWA Studio extensibility
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explained
 
Decentralized exchanges
Decentralized exchangesDecentralized exchanges
Decentralized exchanges
 
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
 
Envoy and Kafka
Envoy and KafkaEnvoy and Kafka
Envoy and Kafka
 
Smart Contract Testing
Smart Contract TestingSmart Contract Testing
Smart Contract Testing
 
Hyperledger
HyperledgerHyperledger
Hyperledger
 
Designing a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd productsDesigning a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd products
 
Ethereum
EthereumEthereum
Ethereum
 
Nginx Architecture
Nginx ArchitectureNginx Architecture
Nginx Architecture
 
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
 
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
 
Kafka and Machine Learning in Banking and Insurance Industry
Kafka and Machine Learning in Banking and Insurance IndustryKafka and Machine Learning in Banking and Insurance Industry
Kafka and Machine Learning in Banking and Insurance Industry
 
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
 
API
APIAPI
API
 
Ethereum-Cryptocurrency (All about Ethereum)
Ethereum-Cryptocurrency (All about Ethereum) Ethereum-Cryptocurrency (All about Ethereum)
Ethereum-Cryptocurrency (All about Ethereum)
 
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
 
Digital Certificate Verification based on blockchain ethereum
Digital Certificate Verification based on blockchain ethereumDigital Certificate Verification based on blockchain ethereum
Digital Certificate Verification based on blockchain ethereum
 
Apache Arrow Flight Overview
Apache Arrow Flight OverviewApache Arrow Flight Overview
Apache Arrow Flight Overview
 

Similaire à 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
 
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
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Tomoaki Sato
 
Blockchain Technology: Adoption Challenges, Platform and Applications
Blockchain Technology: Adoption Challenges, Platform and ApplicationsBlockchain Technology: Adoption Challenges, Platform and Applications
Blockchain Technology: Adoption Challenges, Platform and ApplicationsSanjeev Verma, PhD
 

Similaire à 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
 
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
 
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
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
 
Blockchain Technology: Adoption Challenges, Platform and Applications
Blockchain Technology: Adoption Challenges, Platform and ApplicationsBlockchain Technology: Adoption Challenges, Platform and Applications
Blockchain Technology: Adoption Challenges, Platform and Applications
 

Dernier

%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
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
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
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
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
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
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 

Dernier (20)

%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
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 🔝✔️✔️
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
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
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
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
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 

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