Ethereum Blockchain Development

Ego Slide

francesco.strazzullo@ideato.it

@TheStrazz86

https://github.com/francesco-strazzullo

https://medium.com/@TheStrazz86

https://slides.com/francescostrazzullo

Why are you here?

Blockchain

What problems does it solve?

Lack of trust

Trasparency

Immutability

Blockchain is a decentralized consensus mechanism. In a blockchain, all peers eventually come to an agreement regarding the state of a transaction.

Imran Bashir

 Blockchain can be considered a shared ledger of transactions.

Imran Bashir

Blockchain is a data structure; it is basically a linked list that uses hash pointers instead of normal pointers. Hash pointers are used to point to the previous block.

Imran Bashir

Graph by Imran Bashir

Graph by Imran Bashir

Challenges

Scalability

Off-Chain

Sidechains

Proof of Stake

Privacy

Security

Immature Technology

History

Electronic cash

David Chaum published a seminal paper in 1984 about electronic cash. The main problems that he tried to address are accountability and anonymity 

Hashcash

Hashcash was created by Adam Back in 1997 as a system to control e-mail spam. When a user want to send an email they are required to compute a hash as a proof that they have spent a reasonable amount of computing resources before sending the e-mail.

Generate this Hash is a very demanding task, but for a normal user it's acceptable. This mechanism would instead destroy any kind of spambot because of the large volume of mails they send

While Hashcash is hard to generate is quite easy to verify. Verification is performed by the user who receives the e-mail.

b-money

Introduced by Wei Dai in 1998, it's a peer-to-peer network where money is created by solving computational puzzles such as hashcash

Bitcoin

In 2008 Satoshi Nakamoto, a nickname for an unknown person published the paper "Bitcoin: A Peer-to-Peer Electronic Cash System". 

Satoshi Nakamoto introduced the term chain of blocks. This term over the years has now evolved into the word blockchain.

In 2009 Bitcoin goes live

Graph by Imran Bashir

Key Elements

Distributed systems

Blockchain at its core is a decentralized distributed system

Distributed systems are a computing paradigm whereby two or more nodes work with each other in a coordinated fashion in order to achieve a common outcome and it's modeled in such a way that end users see it as a single logical platform.

Imran Bashir

CAP Theorem

any distributed system cannot have Consistency, Availability, and Partition tolerance simultaneously

Consistency

is a property that ensures that all nodes in a distributed system have a single latest copy of data

Availability

means that the system is up, accessible for use, and is accepting incoming requests and responding with data without any failures as and when required

Partition tolerance

ensures that if a group of nodes fails the distributed system still continues to operate correctly

Graph by Hamzeh Khazaei

Eventual Consistency

Consistency is achieved over time, as a result of validation from multiple nodes. This process of validation is called a Consensus algorithm

Consensus

Consensus is a process of agreement between distrusting nodes on a final state of data

Imran Bashir

Byzantine Generals problem

The Byzantine Generals Problem is a situation where involved parties must agree in order to avoid failure, but where some of the involved parties are corrupt and disseminating false information

Proof of Work

A type of consensus mechanism that relies on proof that enough computational resources have been spent before proposing a new block to the network

The nodes that try to find new block are called miners.

Every time that a miner "find" a new block they get a reward (new money)

Mining difficulty increase over time

Problems?

Ecological

Political

Proof of stake

This algorithm works on the idea that for a node that has enough stake in the system, any malicious attempt would outweigh the benefits of performing an attack on the system

Proof of Stake (PoS) is a category of consensus algorithms for public blockchains that depend on a validator's economic stake in the network

Byzantine Nodes will lose the stake

Usually, the stake is the money

Cryptography

Asymmetric cryptography

Public key cryptography

A private key is basically a randomly generated number that is kept secret

A public key is available publicly and published by the private key owner

Graph by Imran Bashir

Graph by Imran Bashir

Transactions

A transaction is the basic operation of a blockchain

The transaction lifecycle

  1. The user sends the transaction signing it the transaction using the private key

  2. The transaction is broadcasted to the Bitcoin network

  3. Mining nodes include this transaction in the next block to be mined

  4. Once a miner who solves the Proof of Work problem broadcasts the newly mined block to the network

  5. The nodes verify the block and propagate the block further, and confirmation starts to generate

  6. Finally, the confirmations start to appear in the receiver's wallet

Smart contracts

A Smart Contract a software that resides on the blockchain

Ethereum

By Ethereum Foundation [CC BY 3.0  (https://creativecommons.org/licenses/by/3.0)], via Wikimedia Commons

Ethereum is an open-source, public, blockchain-based distributed computing platform and operating system featuring smart contract (scripting) functionality

Wikipedia

Ethereum was initially described in a white paper by Vitalik Buterin, a programmer involved with Bitcoin Magazine, in late 2013 with a goal of building decentralized applications. Buterin had argued that Bitcoin needed a scripting language for application development. Failing to gain agreement, he proposed the development of a new platform with a more general scripting language

Wikipedia

The system went live on 30 July 2015

The DAO event

In 2016 a decentralised autonomous organisation called The DAO, a set of smart contracts developed on the platform, raised a record US$150 million in a crowd-sale to fund the project. The DAO was exploited in June when US$50 million in ether were claimed by an anonymous entity.

Wikipedia

The event sparked a debate in the crypto-community about whether Ethereum should perform a contentious "hard fork" to reappropriate the affected funds. As a result of the dispute, the network split in two. Ethereum continued on the forked blockchain, while Ethereum Classic continued on the original blockchain

Wikipedia

Bitcoin is created as an alternative to regular money, Ethereum is developed as a platform which facilitates peer-to-peer contracts

Key Elements

Types of accounts

Externally owned accounts

Contract accounts

Ether

Ethers are a reward for miners

But What's the purpose of Ethers?

All transactions on the Ethereum blockchain are required to cover the cost of computation they are performing

The cost is covered by something called gas

If you run out of gas during a transaction, any operation is reverted and the gas consumed is lost

Token

Tokens are specific kinds of Smart Contracts that let developers ​create new kind of money

ERC20

contract ERC20Interface {
    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}

ICO / ITO

Solidity

By Ethereum Foundation [CC BY-SA 3.0  (https://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons

Solidity is a statically-typed programming language designed for developing smart contracts that run on the EVM

Truffle Suite

References

Thanks!

Ethereum Blockchain Development

By Francesco Strazzullo

Ethereum Blockchain Development

  • 2,013