Introduction to Blockhain &
whoami
• George Konstantopoulos (@gakonst)
• 5th year Electrical & Computer Engineering AUTh
• Professional Interests:
• Blockchain (esp. Sidechains & Consensus)
• Information Security (Organized infosec meetup @AUTh “ThessSec”)
• Internet of Things
• Autonomous Vehicles
• Misc. Interests
• Boxing
• Blues guitar
• Foreign languages (Japanese currently)
• Binge-watching series
2
Overview
• Part 1: Introduction to Blockchain & Ethereum
• Hashes, Blocks, Blockchains
• Trust & Transacting on a Blockchain
• Evolution of Blockchains
• Inside Ethereum
• Part 2: Solidity by Example (technical)
• A simple Crowdfunding Smart Contract in Solidity
• Deploying and interacting with Smart Contracts in Python
3
Blockchain Lingo
• Consensus: network participants agree on a state
• Consensus algorithm, Proof of {Work, Stake, …}
• Transaction: Transfer of value from A to B
• Block: Bundle of transactions
• Block time: avg. time until a new block is created
• Miners: burn energy to create blocks, get rewarded by block reward +
transaction fees
• Block reward: new coins created with each block, goes to miners
• Transaction fees: small % of tx value, goes to miners
4
What is a (one-way) hash?
5
Secure function  Irreversible
What is a block?
6
https://anders.com/blockchain/
What is a blockchain?
7
https://anders.com/blockchain/ Prev changed in Block 2 and 3  Block hash changed  Invalid block
Malicious transaction added
by some user
8
Mining? Block reward? Tx Fees?
9
10
What is a Blockchain?
11
https://medium.com/@micheledaliessi/how-does-the-blockchain-work-98c8cd01d2ae
In Bitcoin
approximately
What is a Blockchain?
12
A blockchain is a database that can be shared between a group of non-
trusting individuals, without needing a central party to maintain the
state of the database.
13
https://medium.com/@preethikasireddy/eli5-what-do-we-mean-by-blockchains-are-trustless-aa420635d5f6
Trustless?
14
How does a transaction work?
https://medium.com/@preethikasireddy/eli5-what-do-we-mean-by-blockchains-are-trustless-aa420635d5f6
She paid $10
15
https://medium.com/@preethikasireddy/eli5-what-do-we-mean-by-blockchains-are-trustless-aa420635d5f6
Trustless?
“Blockchains don’t actually eliminate trust.
What they do is minimize the amount of trust required from any single
actor in the system.
They do this by distributing trust among different actors in the system via
an economic game that incentivizes actors to cooperate with the rules
defined by the protocol.”
Blockchains are useful for more than just money
• Identity Services (Domain/Title Registration)
• Logistics (Supply Chain Tracking)
• Crowdfunding
• Gaming/Gambling/Betting
• e-Governance/Voting
• Decentralized Exchange
16
In the beginning…
17
Evolution…
18
More features…
19
Eventually…Need for a platform!
20
Disclaimer: This is not product placement
21
Some real world applications
22*Decentralized Autonomous Organization
*
What is Ethereum?
• A blockchain
• Currency: Ether (ETH)
• Consensus: Proof of Work
• Block time: ~12.5s
• With some extra features:
• Built-in programming language
• Two types of accounts
• Decentralized Applications (DApps) = Rules defined in a “smart contract”
23
Types of Accounts
24
What is inside a Transaction?
• nonce (# of sender TXs)
• to (destination address)
• value (amount of ETH to send)
• gasPrice (amount of ether per unit gas)
• gasLimit (maximum gas consumable)
• data (readable by contract code)
• v, r, s (ECDSA signature values)
25
The Concept of Gas
Problem: Cannot tell whether or not a program will run forever
Solution: Charge fee per computational step (“gas”)
• Gas = unit of measurement (not a currency)
• Simple ether transfer transactions: 21.000 gas
• Contract calls: depends
• Block Gas Limit: Sum of all tx’s gas in a block
• like Bitcoin block size
• Miners vote on it
• Currently approx. 7.9million
26
Transactions  State Transitions
27
28
How does Gas get spent?
https://medium.com/@preethikasireddy/how-does-ethereum-work-anyway-22d1df506369
Running out of Gas
29
Where can I store ether?
• Desktop (Mist, Exodus, Metamask)
• Paper Wallet (just write down your private key)
• Hardware Wallet (Ledger Nano S, Trezor)
• Mobile Wallet (Jaxx)
• Software Wallet (Exodus)
• Hot Wallets (Exchanges)
30
You only own your cryptocurrency if you own your private keys.
Thank you for your attention
Q & A, 15min. break, Part 2 soon
Contact: me@gakonst.com / @gakonst
32
References
• Ethereum in 25 Minutes – Vitalik Buterin
• https://github.com/ethereum/wiki/wiki/White-Paper
• https://medium.com/@preethikasireddy/how-does-ethereum-work-
anyway-22d1df506369
• https://blog.zeppelin.solutions/a-gentle-introduction-to-ethereum-
programming-part-1-783cc7796094
34

Introduction to Blockchain and Ethereum

  • 1.
  • 2.
    whoami • George Konstantopoulos(@gakonst) • 5th year Electrical & Computer Engineering AUTh • Professional Interests: • Blockchain (esp. Sidechains & Consensus) • Information Security (Organized infosec meetup @AUTh “ThessSec”) • Internet of Things • Autonomous Vehicles • Misc. Interests • Boxing • Blues guitar • Foreign languages (Japanese currently) • Binge-watching series 2
  • 3.
    Overview • Part 1:Introduction to Blockchain & Ethereum • Hashes, Blocks, Blockchains • Trust & Transacting on a Blockchain • Evolution of Blockchains • Inside Ethereum • Part 2: Solidity by Example (technical) • A simple Crowdfunding Smart Contract in Solidity • Deploying and interacting with Smart Contracts in Python 3
  • 4.
    Blockchain Lingo • Consensus:network participants agree on a state • Consensus algorithm, Proof of {Work, Stake, …} • Transaction: Transfer of value from A to B • Block: Bundle of transactions • Block time: avg. time until a new block is created • Miners: burn energy to create blocks, get rewarded by block reward + transaction fees • Block reward: new coins created with each block, goes to miners • Transaction fees: small % of tx value, goes to miners 4
  • 5.
    What is a(one-way) hash? 5 Secure function  Irreversible
  • 6.
    What is ablock? 6 https://anders.com/blockchain/
  • 7.
    What is ablockchain? 7 https://anders.com/blockchain/ Prev changed in Block 2 and 3  Block hash changed  Invalid block Malicious transaction added by some user
  • 8.
  • 9.
  • 10.
  • 11.
    What is aBlockchain? 11 https://medium.com/@micheledaliessi/how-does-the-blockchain-work-98c8cd01d2ae In Bitcoin approximately
  • 12.
    What is aBlockchain? 12 A blockchain is a database that can be shared between a group of non- trusting individuals, without needing a central party to maintain the state of the database.
  • 13.
  • 14.
    14 How does atransaction work? https://medium.com/@preethikasireddy/eli5-what-do-we-mean-by-blockchains-are-trustless-aa420635d5f6 She paid $10
  • 15.
    15 https://medium.com/@preethikasireddy/eli5-what-do-we-mean-by-blockchains-are-trustless-aa420635d5f6 Trustless? “Blockchains don’t actuallyeliminate trust. What they do is minimize the amount of trust required from any single actor in the system. They do this by distributing trust among different actors in the system via an economic game that incentivizes actors to cooperate with the rules defined by the protocol.”
  • 16.
    Blockchains are usefulfor more than just money • Identity Services (Domain/Title Registration) • Logistics (Supply Chain Tracking) • Crowdfunding • Gaming/Gambling/Betting • e-Governance/Voting • Decentralized Exchange 16
  • 17.
  • 18.
  • 19.
  • 20.
    Eventually…Need for aplatform! 20 Disclaimer: This is not product placement
  • 21.
  • 22.
    Some real worldapplications 22*Decentralized Autonomous Organization *
  • 23.
    What is Ethereum? •A blockchain • Currency: Ether (ETH) • Consensus: Proof of Work • Block time: ~12.5s • With some extra features: • Built-in programming language • Two types of accounts • Decentralized Applications (DApps) = Rules defined in a “smart contract” 23
  • 24.
  • 25.
    What is insidea Transaction? • nonce (# of sender TXs) • to (destination address) • value (amount of ETH to send) • gasPrice (amount of ether per unit gas) • gasLimit (maximum gas consumable) • data (readable by contract code) • v, r, s (ECDSA signature values) 25
  • 26.
    The Concept ofGas Problem: Cannot tell whether or not a program will run forever Solution: Charge fee per computational step (“gas”) • Gas = unit of measurement (not a currency) • Simple ether transfer transactions: 21.000 gas • Contract calls: depends • Block Gas Limit: Sum of all tx’s gas in a block • like Bitcoin block size • Miners vote on it • Currently approx. 7.9million 26
  • 27.
    Transactions  StateTransitions 27
  • 28.
    28 How does Gasget spent? https://medium.com/@preethikasireddy/how-does-ethereum-work-anyway-22d1df506369
  • 29.
  • 30.
    Where can Istore ether? • Desktop (Mist, Exodus, Metamask) • Paper Wallet (just write down your private key) • Hardware Wallet (Ledger Nano S, Trezor) • Mobile Wallet (Jaxx) • Software Wallet (Exodus) • Hot Wallets (Exchanges) 30 You only own your cryptocurrency if you own your private keys.
  • 31.
    Thank you foryour attention Q & A, 15min. break, Part 2 soon Contact: me@gakonst.com / @gakonst 32
  • 32.
    References • Ethereum in25 Minutes – Vitalik Buterin • https://github.com/ethereum/wiki/wiki/White-Paper • https://medium.com/@preethikasireddy/how-does-ethereum-work- anyway-22d1df506369 • https://blog.zeppelin.solutions/a-gentle-introduction-to-ethereum- programming-part-1-783cc7796094 34

Editor's Notes

  • #16 Blockchains don’t actually eliminate trust. What they do is minimize the amount of trust required from any single actor in the system. They do this by distributing trust among different actors in the system via an economic game that incentivizes actors to cooperate with the rules defined by the protocol.
  • #19  The term "Colored Coins" loosely describes a class of methods for representing and managing real world assets on top of the Bitcoin Blockchain. While originally designed to be a currency, Bitcoin's scripting language allows to store small amounts of metadata on the blockchain, which can be used to represent asset manipulation instructions.
  • #24 DNS Solidity: https://ethfiddle.com/Vw97YA5xgE
  • #25 Externally owned accounts, which are controlled by private keys and have no code associated with them. Contract accounts, which are controlled by their contract code and have code associated with them nonce: If the account is an externally owned account, this number represents the number of transactions sent from the account’s address. If the account is a contract account, the nonce is the number of contracts created by the account. balance: The number of Wei owned by this address. There are 1e+18 Wei per Ether. codeHash: The hash of the EVM (Ethereum Virtual Machine — more on this later) code of this account. For contract accounts, this is the code that gets hashed and stored as the codeHash. For externally owned accounts, the codeHash field is the hash of the empty string. storageRoot: A hash of the root node of a Merkle Patricia tree (we’ll explain Merkle trees later on). This tree encodes the hash of the storage contents of this account, and is empty by default.
  • #26 https://youtu.be/mCzyDLanA7s Elliptic Curve Digital Signature Algorithm
  • #27 Any kind of cost that happens in Ethereum gets translated to gas. Similarly to how in bitcoin fees get translated in some amount of bitcoin per transaction byte, same applies here Imposing fees prevents users from overtaxing the network. Ethereum is a Turing complete language. (In short, a Turing machine is a machine that can simulate any computer algorithm (for those not familiar with Turing machines, check out this and this). This allows for loops and makes Ethereum susceptible to the halting problem, a problem in which you cannot determine whether or not a program will run infinitely. If there were no fees, a malicious actor could easily try to disrupt the network by executing an infinite loop within a transaction, without any repercussions. Thus, fees protect the network from deliberate attacks. https://medium.com/@preethikasireddy/how-does-ethereum-work-anyway-22d1df506369
  • #31 Demo with Jaxx and Metamask What you need is th eprivate key, because this is what allows you to open … Οπως στις τραπεζικες θυριδες, τα λεφτα ειναι παντα εκει, ωστοσο χρειαζεσαι το κλειδι για να τα μετακινήσεις
  • #33 Programming and interacting with smart contracts