SlideShare a Scribd company logo
Blockchain for Developers
Blockchain
• Have you heard of Bitcoin?
• Who hasn’t.
• Well, blockchain is the technology powering the Bitcoin.
The Problem Domain
• We want a safe place to store our (virtual) money.
• We want anonymity.
• We want the platform to be smart (i.e., no intermediaries).
• Blockchain is the enabler.
Blockchain & Bitcoin
• The machines that constitute the blockchain network are called:
nodes.
• The nodes are anonymous.
• The “ledger’ of the transactions is replicated.
• Each node has a copy.
• Wait, transactions?
Have an Address
• So, we can generate a private key to some virtual wallet
address.
• No chance of collision.
• A transaction is a money transfer.
Adding a Block to the Chain
• In order to add transaction to the chain, a node needs to create
the next block containing that transaction (and probably some
more).
• Block size is cupped at 1mb.
Hashes
• In order to add a new block, the node (miner) has to solve a
difficult problem.
• Find a hash that includes the transactions, fees and the
previous block reference.
• Difficulty is dynamic and tries to make a new block a 10 minutes
task.
Miners
• Miners are fully autonomous and can even create empty blocks
(only the ”new block” fee).
• The ”source of truth” is the longest blockchain visible by the
majority of the nodes.
Not Only Currency
• The blockchain technology can be used for more things than
virtual currency:
• Smart Contracts.
• Source of Truth.
• Anonymity.
Ethereum
• The main purpose of Bitcoin is to leverage the blockchain
technology for safe and visible ownership of cryptocurrency
along with an online transaction platform.
• The main purpose behind ethereum is to run a decentralized
application.
• Application? Over blockchain?
Ethereum
• The cryptocurrency is called: Ether.
• Every node in the network runs the EVM (Ethereum Virtual
Machine).
• The consensus mechanism in Ethereum.
• Implementations are available in many programming
languages.
EVM
• Turing complete.
• The EVM specification is low-level.
• There are many high-level languages that compile into EVM
bytecode.
• One of the popular ones is: solidity.
Gwei and Gas
• Gwei is a 1 billionth (10-9) of Ether (ETH).
• A transaction fee is: (Gas consumed * Gas price).
• Gas prices can be checked at: https://ethgasstation.info/
• Note that the Gas consumed “per-line” is constant.
• “Gas consumed” for a simple transaction is: 21,000 (Gwei).
Smart Contracts - Solidity
contract Example1 {
uint age;
function setAge(uint x) public { age = x; }
function getAge() public view returns (uint) {
return age;
}
}
Discussion
• A very simple contract.
• Actually no contract at all.
• Everyone can change age.
• Though, history will be public and visible.
• Let’s see Gas…
Auction (Solidity by Example)
contract SimpleAuction {
address public beneficiary;
uint public auctionEnd;
address public highestBidder;
uint public highestBid;
// Allowed withdrawals of previous bids
mapping(address => uint) pendingReturns;
// Set to true at the end, disallows any change
bool ended;
event HighestBidIncreased(address bidder, uint amount);
event AuctionEnded(address winner, uint amount);
Discussion
• A getter function is generated for public fields.
• The address type is a built-in type allows for holding Ethereum
addresses.
• Supports the following members:
• balance, transfer().
• Some low-level methods (call, delegatecall, callcode).
Auctionconstructor( uint _biddingTime, address _beneficiary ) public {
beneficiary = _beneficiary;
auctionEnd = now + _biddingTime;
}
function bid() public payable {
require( now <= auctionEnd, "Auction already ended." );
require( msg.value > highestBid, "There already is a higher bid." );
if (highestBid != 0) {
pendingReturns[highestBidder] += highestBid;
}
highestBidder = msg.sender;
highestBid = msg.value;
emit HighestBidIncreased(msg.sender, msg.value);
}
Discussion
• The bid function is: payable.
• A keyword in Solidity.
• You can send ether to a payable function.
• Sending ether to non-payable functions, will invoke the (you
should provide) anonymous payable fallback function.
Discussion
• Require accepts a condition and an error message.
• If the condition is not met, undo all state changes and return the
second argument.
• Remaining gas will be refunded to the caller.
Auction
function withdraw() public returns (bool) {
uint amount = pendingReturns[msg.sender];
if (amount > 0) {
pendingReturns[msg.sender] = 0;
if (!msg.sender.send(amount)) {
pendingReturns[msg.sender] = amount;
return false;
}
}
return true;
}
function auctionEnd() public {
require(now >= auctionEnd, "Auction not yet ended.");
require(!ended, "auctionEnd has already been called.");
ended = true;
emit AuctionEnded(highestBidder, highestBid);
beneficiary.transfer(highestBid);
}
Ethereum Fork
• DAO (Decentrelized Autonomous Organization) was
crowdfunded as a form of venture capital fund.
• Not tied to any government.
• Launched at the end of April 2016.
• By may 2016 had an ether value of over 150 million $.
• On June 17 2016, a hacker managed to take advantage of a
vulnerability and took 11.5 million ether.
The Fork
• Caused a big debate whether to do something about it.
• Caused a hard fork of the Ethereum blockchain.
• Classic Ethereum incorporated the hack with Ethereum
returned the amount to DAO.
The Fork
• A hard fork is not always possible.
• In the case of the DAO attack, due to the nature of the smart
contract, the money was put in a DAO child account for 28
days.
• Allowing for an hard fork.
• This was not the case for several other attacks.
Security
• What does it mean for us?
• Bugs are very costly in smart contracts.
• Not your average “where is my button bug”.
Best Practices
• Mark calls to untrusted contracts.
• Check for failures in send() invocations.
• Assume that participants may not cooperate.
• E.g., consider a paper, scissors, rock game.
Ecosystem
• Remix – online IDE & compiler.
• Embark – JS based for doing TDD with smart contracts.
• Solidity Standard Library – a standard library?
• Collection Framework.
• Truffle – Environment for developing and testing smart
contracts.

More Related Content

What's hot

Ethereum - MetaMask&Remix&Smartcontract
Ethereum - MetaMask&Remix&SmartcontractEthereum - MetaMask&Remix&Smartcontract
Ethereum - MetaMask&Remix&Smartcontract
Hu Kenneth
 
How to be a smart contract engineer
How to be a smart contract engineerHow to be a smart contract engineer
How to be a smart contract engineer
Oded Noam
 
Java and the blockchain - introducing web3j
Java and the blockchain - introducing web3jJava and the blockchain - introducing web3j
Java and the blockchain - introducing web3j
Conor Svensson
 
Ethereum bxl
Ethereum bxlEthereum bxl
Ethereum bxl
Benjamin MATEO
 
Ethereum under the Hood, intro for developers as preparation for Blockchain H...
Ethereum under the Hood, intro for developers as preparation for Blockchain H...Ethereum under the Hood, intro for developers as preparation for Blockchain H...
Ethereum under the Hood, intro for developers as preparation for Blockchain H...
Pascal Van Hecke
 
Writing smart contracts
Writing smart contractsWriting smart contracts
Writing smart contracts
Marek Kirejczyk
 
20180711 Metamask
20180711 Metamask 20180711 Metamask
20180711 Metamask
Hu Kenneth
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial EN
Nicholas Lin
 
Ethereum Smart Contract Tutorial
Ethereum Smart Contract TutorialEthereum Smart Contract Tutorial
Ethereum Smart Contract Tutorial
Arnold Pham
 
Academic Ethereum
Academic EthereumAcademic Ethereum
Academic Ethereum
gavofyork
 
Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...
Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...
Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...
WithTheBest
 
EDCON 2017 sharing @Taipei Ethereum Meetup
EDCON 2017 sharing @Taipei Ethereum Meetup EDCON 2017 sharing @Taipei Ethereum Meetup
EDCON 2017 sharing @Taipei Ethereum Meetup
Chang-Wu Chen
 
Distributed Ledgers, Blockchains, and Smart Contracts
Distributed Ledgers, Blockchains, and Smart ContractsDistributed Ledgers, Blockchains, and Smart Contracts
Distributed Ledgers, Blockchains, and Smart Contracts
Dusan Andric
 
Polar Coin
Polar CoinPolar Coin
web3j Overview
web3j Overviewweb3j Overview
web3j Overview
Conor Svensson
 
Building Java and Android apps on the blockchain
Building Java and Android apps on the blockchain Building Java and Android apps on the blockchain
Building Java and Android apps on the blockchain
Conor Svensson
 
Build dapps 1:3 dev tools
Build dapps 1:3 dev toolsBuild dapps 1:3 dev tools
Build dapps 1:3 dev tools
Martin Köppelmann
 
Metadata in the Blockchain: The OP_RETURN Explosion
Metadata in the Blockchain: The OP_RETURN ExplosionMetadata in the Blockchain: The OP_RETURN Explosion
Metadata in the Blockchain: The OP_RETURN Explosion
Coin Sciences Ltd
 
Web3j 2.0 Update
Web3j 2.0 UpdateWeb3j 2.0 Update
Web3j 2.0 Update
Conor Svensson
 

What's hot (19)

Ethereum - MetaMask&Remix&Smartcontract
Ethereum - MetaMask&Remix&SmartcontractEthereum - MetaMask&Remix&Smartcontract
Ethereum - MetaMask&Remix&Smartcontract
 
How to be a smart contract engineer
How to be a smart contract engineerHow to be a smart contract engineer
How to be a smart contract engineer
 
Java and the blockchain - introducing web3j
Java and the blockchain - introducing web3jJava and the blockchain - introducing web3j
Java and the blockchain - introducing web3j
 
Ethereum bxl
Ethereum bxlEthereum bxl
Ethereum bxl
 
Ethereum under the Hood, intro for developers as preparation for Blockchain H...
Ethereum under the Hood, intro for developers as preparation for Blockchain H...Ethereum under the Hood, intro for developers as preparation for Blockchain H...
Ethereum under the Hood, intro for developers as preparation for Blockchain H...
 
Writing smart contracts
Writing smart contractsWriting smart contracts
Writing smart contracts
 
20180711 Metamask
20180711 Metamask 20180711 Metamask
20180711 Metamask
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial EN
 
Ethereum Smart Contract Tutorial
Ethereum Smart Contract TutorialEthereum Smart Contract Tutorial
Ethereum Smart Contract Tutorial
 
Academic Ethereum
Academic EthereumAcademic Ethereum
Academic Ethereum
 
Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...
Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...
Building decentralized applications (dapps) on Ethereum - Eva Shon, & Igor Li...
 
EDCON 2017 sharing @Taipei Ethereum Meetup
EDCON 2017 sharing @Taipei Ethereum Meetup EDCON 2017 sharing @Taipei Ethereum Meetup
EDCON 2017 sharing @Taipei Ethereum Meetup
 
Distributed Ledgers, Blockchains, and Smart Contracts
Distributed Ledgers, Blockchains, and Smart ContractsDistributed Ledgers, Blockchains, and Smart Contracts
Distributed Ledgers, Blockchains, and Smart Contracts
 
Polar Coin
Polar CoinPolar Coin
Polar Coin
 
web3j Overview
web3j Overviewweb3j Overview
web3j Overview
 
Building Java and Android apps on the blockchain
Building Java and Android apps on the blockchain Building Java and Android apps on the blockchain
Building Java and Android apps on the blockchain
 
Build dapps 1:3 dev tools
Build dapps 1:3 dev toolsBuild dapps 1:3 dev tools
Build dapps 1:3 dev tools
 
Metadata in the Blockchain: The OP_RETURN Explosion
Metadata in the Blockchain: The OP_RETURN ExplosionMetadata in the Blockchain: The OP_RETURN Explosion
Metadata in the Blockchain: The OP_RETURN Explosion
 
Web3j 2.0 Update
Web3j 2.0 UpdateWeb3j 2.0 Update
Web3j 2.0 Update
 

Similar to Blockchain for Developers

Blockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business ApplicationsBlockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business Applications
Matthias Zimmermann
 
Ethereum
EthereumEthereum
Ethereum
Brian Yap
 
01 what is blockchain
01 what is blockchain01 what is blockchain
01 what is blockchain
BastianBlankenburg
 
Blockchain
BlockchainBlockchain
Blockchain
Gopal Goel
 
Resource slides for blockchain related question
Resource slides for blockchain related questionResource slides for blockchain related question
Resource slides for blockchain related question
Lin Lin (Wendy)
 
Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014
WeKCo Coworking
 
BitCoin explained
BitCoin explainedBitCoin explained
BitCoin explained
Harelc
 
Introduction to Blockchain and Ethereum
Introduction to Blockchain and EthereumIntroduction to Blockchain and Ethereum
Introduction to Blockchain and Ethereum
Georgios Konstantopoulos
 
Blockchain and Cryptocurrencies
Blockchain and CryptocurrenciesBlockchain and Cryptocurrencies
Blockchain and Cryptocurrencies
nimeshQ
 
Getting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract AuditingGetting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract Auditing
Beau Bullock
 
Idea To IPO Blockchain Slides
Idea To IPO Blockchain SlidesIdea To IPO Blockchain Slides
Idea To IPO Blockchain Slides
Roger Royse
 
Altcoins
AltcoinsAltcoins
Altcoins
sameezahur
 
Kriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicákKriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicák
hackersuli
 
Building Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart ContractBuilding Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart Contract
Vaideeswaran Sethuraman
 
BCHGraz - Meetup #8 - Intro & Ethereum
 BCHGraz - Meetup #8 - Intro & Ethereum BCHGraz - Meetup #8 - Intro & Ethereum
BCHGraz - Meetup #8 - Intro & Ethereum
BlockchainHub Graz
 
Ethereum
EthereumEthereum
Ethereum
V C
 
Crypto currency presentation
Crypto currency presentationCrypto currency presentation
Crypto currency presentation
obaid r
 
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive SystemsWeek 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Roger Royse
 
Cryptocurrencies and Blockchain - An opportunity for Startups and Companies
Cryptocurrencies and Blockchain - An opportunity for Startups and CompaniesCryptocurrencies and Blockchain - An opportunity for Startups and Companies
Cryptocurrencies and Blockchain - An opportunity for Startups and Companies
Marco Vasapollo
 
Introduction to Blockchain with an Ethereuem Hands-on
Introduction to Blockchain with an Ethereuem Hands-onIntroduction to Blockchain with an Ethereuem Hands-on
Introduction to Blockchain with an Ethereuem Hands-on
Johann Romefort
 

Similar to Blockchain for Developers (20)

Blockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business ApplicationsBlockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business Applications
 
Ethereum
EthereumEthereum
Ethereum
 
01 what is blockchain
01 what is blockchain01 what is blockchain
01 what is blockchain
 
Blockchain
BlockchainBlockchain
Blockchain
 
Resource slides for blockchain related question
Resource slides for blockchain related questionResource slides for blockchain related question
Resource slides for blockchain related question
 
Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014
 
BitCoin explained
BitCoin explainedBitCoin explained
BitCoin explained
 
Introduction to Blockchain and Ethereum
Introduction to Blockchain and EthereumIntroduction to Blockchain and Ethereum
Introduction to Blockchain and Ethereum
 
Blockchain and Cryptocurrencies
Blockchain and CryptocurrenciesBlockchain and Cryptocurrencies
Blockchain and Cryptocurrencies
 
Getting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract AuditingGetting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract Auditing
 
Idea To IPO Blockchain Slides
Idea To IPO Blockchain SlidesIdea To IPO Blockchain Slides
Idea To IPO Blockchain Slides
 
Altcoins
AltcoinsAltcoins
Altcoins
 
Kriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicákKriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicák
 
Building Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart ContractBuilding Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart Contract
 
BCHGraz - Meetup #8 - Intro & Ethereum
 BCHGraz - Meetup #8 - Intro & Ethereum BCHGraz - Meetup #8 - Intro & Ethereum
BCHGraz - Meetup #8 - Intro & Ethereum
 
Ethereum
EthereumEthereum
Ethereum
 
Crypto currency presentation
Crypto currency presentationCrypto currency presentation
Crypto currency presentation
 
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive SystemsWeek 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
 
Cryptocurrencies and Blockchain - An opportunity for Startups and Companies
Cryptocurrencies and Blockchain - An opportunity for Startups and CompaniesCryptocurrencies and Blockchain - An opportunity for Startups and Companies
Cryptocurrencies and Blockchain - An opportunity for Startups and Companies
 
Introduction to Blockchain with an Ethereuem Hands-on
Introduction to Blockchain with an Ethereuem Hands-onIntroduction to Blockchain with an Ethereuem Hands-on
Introduction to Blockchain with an Ethereuem Hands-on
 

Recently uploaded

zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 

Recently uploaded (20)

zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 

Blockchain for Developers

  • 2. Blockchain • Have you heard of Bitcoin? • Who hasn’t. • Well, blockchain is the technology powering the Bitcoin.
  • 3. The Problem Domain • We want a safe place to store our (virtual) money. • We want anonymity. • We want the platform to be smart (i.e., no intermediaries). • Blockchain is the enabler.
  • 4. Blockchain & Bitcoin • The machines that constitute the blockchain network are called: nodes. • The nodes are anonymous. • The “ledger’ of the transactions is replicated. • Each node has a copy. • Wait, transactions?
  • 5. Have an Address • So, we can generate a private key to some virtual wallet address. • No chance of collision. • A transaction is a money transfer.
  • 6. Adding a Block to the Chain • In order to add transaction to the chain, a node needs to create the next block containing that transaction (and probably some more). • Block size is cupped at 1mb.
  • 7. Hashes • In order to add a new block, the node (miner) has to solve a difficult problem. • Find a hash that includes the transactions, fees and the previous block reference. • Difficulty is dynamic and tries to make a new block a 10 minutes task.
  • 8. Miners • Miners are fully autonomous and can even create empty blocks (only the ”new block” fee). • The ”source of truth” is the longest blockchain visible by the majority of the nodes.
  • 9. Not Only Currency • The blockchain technology can be used for more things than virtual currency: • Smart Contracts. • Source of Truth. • Anonymity.
  • 10. Ethereum • The main purpose of Bitcoin is to leverage the blockchain technology for safe and visible ownership of cryptocurrency along with an online transaction platform. • The main purpose behind ethereum is to run a decentralized application. • Application? Over blockchain?
  • 11. Ethereum • The cryptocurrency is called: Ether. • Every node in the network runs the EVM (Ethereum Virtual Machine). • The consensus mechanism in Ethereum. • Implementations are available in many programming languages.
  • 12. EVM • Turing complete. • The EVM specification is low-level. • There are many high-level languages that compile into EVM bytecode. • One of the popular ones is: solidity.
  • 13. Gwei and Gas • Gwei is a 1 billionth (10-9) of Ether (ETH). • A transaction fee is: (Gas consumed * Gas price). • Gas prices can be checked at: https://ethgasstation.info/ • Note that the Gas consumed “per-line” is constant. • “Gas consumed” for a simple transaction is: 21,000 (Gwei).
  • 14. Smart Contracts - Solidity contract Example1 { uint age; function setAge(uint x) public { age = x; } function getAge() public view returns (uint) { return age; } }
  • 15. Discussion • A very simple contract. • Actually no contract at all. • Everyone can change age. • Though, history will be public and visible. • Let’s see Gas…
  • 16. Auction (Solidity by Example) contract SimpleAuction { address public beneficiary; uint public auctionEnd; address public highestBidder; uint public highestBid; // Allowed withdrawals of previous bids mapping(address => uint) pendingReturns; // Set to true at the end, disallows any change bool ended; event HighestBidIncreased(address bidder, uint amount); event AuctionEnded(address winner, uint amount);
  • 17. Discussion • A getter function is generated for public fields. • The address type is a built-in type allows for holding Ethereum addresses. • Supports the following members: • balance, transfer(). • Some low-level methods (call, delegatecall, callcode).
  • 18. Auctionconstructor( uint _biddingTime, address _beneficiary ) public { beneficiary = _beneficiary; auctionEnd = now + _biddingTime; } function bid() public payable { require( now <= auctionEnd, "Auction already ended." ); require( msg.value > highestBid, "There already is a higher bid." ); if (highestBid != 0) { pendingReturns[highestBidder] += highestBid; } highestBidder = msg.sender; highestBid = msg.value; emit HighestBidIncreased(msg.sender, msg.value); }
  • 19. Discussion • The bid function is: payable. • A keyword in Solidity. • You can send ether to a payable function. • Sending ether to non-payable functions, will invoke the (you should provide) anonymous payable fallback function.
  • 20. Discussion • Require accepts a condition and an error message. • If the condition is not met, undo all state changes and return the second argument. • Remaining gas will be refunded to the caller.
  • 21. Auction function withdraw() public returns (bool) { uint amount = pendingReturns[msg.sender]; if (amount > 0) { pendingReturns[msg.sender] = 0; if (!msg.sender.send(amount)) { pendingReturns[msg.sender] = amount; return false; } } return true; } function auctionEnd() public { require(now >= auctionEnd, "Auction not yet ended."); require(!ended, "auctionEnd has already been called."); ended = true; emit AuctionEnded(highestBidder, highestBid); beneficiary.transfer(highestBid); }
  • 22. Ethereum Fork • DAO (Decentrelized Autonomous Organization) was crowdfunded as a form of venture capital fund. • Not tied to any government. • Launched at the end of April 2016. • By may 2016 had an ether value of over 150 million $. • On June 17 2016, a hacker managed to take advantage of a vulnerability and took 11.5 million ether.
  • 23. The Fork • Caused a big debate whether to do something about it. • Caused a hard fork of the Ethereum blockchain. • Classic Ethereum incorporated the hack with Ethereum returned the amount to DAO.
  • 24. The Fork • A hard fork is not always possible. • In the case of the DAO attack, due to the nature of the smart contract, the money was put in a DAO child account for 28 days. • Allowing for an hard fork. • This was not the case for several other attacks.
  • 25. Security • What does it mean for us? • Bugs are very costly in smart contracts. • Not your average “where is my button bug”.
  • 26. Best Practices • Mark calls to untrusted contracts. • Check for failures in send() invocations. • Assume that participants may not cooperate. • E.g., consider a paper, scissors, rock game.
  • 27. Ecosystem • Remix – online IDE & compiler. • Embark – JS based for doing TDD with smart contracts. • Solidity Standard Library – a standard library? • Collection Framework. • Truffle – Environment for developing and testing smart contracts.