Python, Blockchain, and Byte-Size Change

Download Python, Blockchain, and Byte-Size Change

Post on 16-Apr-2017




2 download


  • Python, Blockchain, and

    Byte-Size ChangePortia Burton

    @pkafeiPyDX 2016

  • Who am I?My name is Portia Burton

    I am a full-stack developer at the

    Atlantic magazine

    Became interested in blockchains

    earlier this year

    Not a cryptographic expert

  • What is a Blockchain?

    A blockchain is a cross between a decentralized data store and bittorrent.

  • What is Bitcoin?Type of Cryptocurrency

    Creation based on paper by Satoshi Nakamoto titled

    Bitcoin: Peer-to-Peer Electronic Cash System

    Peer-to-peer which means transactions happen without

    a third party. Alice can send money directly to Bob

  • Many Different Types of Cryptocurrencies

  • Bitcoin vs. BlockchainBitcoin is part of a blockchain

    Blockchain is a digital ledger of transactions

    Each transaction is cryptographically signed

    Blockchains are trustless

  • Ethereum

  • Introduction to Ethereum

    Ethereum is a programmable blockchain, every new blockchain spawned from

    Ethereum has the same properties as Ethereum

    Ethereum Virtual Machine is the low level machine language

    Is Turing complete, unlike bitcoin which does not have looping capabilities

    It also is aware of multiple states, unlike bitcoin which is only aware of two states

    (spent and unspent)

  • Different Consensus MechanismsProof of Work: Uses the Etash DAG algorithm. The Etash

    DAG algorithm is based on Bitcoins the Dagger-Hashimoto


    Proof of Stake: Proof of Stake is another way of validating. It

    calculates the weight of the node, being proportional to its

    computational resources. Its less resource intensive than

    Proof of Work.

  • Ethereum Chains (not all blockchains are the same)

  • Different BlockchainsPublic blockchain: It is the official Ethereum chain that everyone can read and interact


    Testnet blockchain: The official test chain of Ethereum. Good way to test contracts

    without wasting real ether

    Private blockchain: This is a blockchain that you can create yourself. This blockchain

    can be freely accessed by others, or you can add addresses by invite only

  • Can an average developer build blockchain applications?

  • Indeed, We Can!

  • But first, some more background

  • Smart Contracts (also known as DApps)

  • What is a Smart Contract?Stored on the blockchain and executed

    by code

    Many smart contracts are written in


    Powered by gas which can be

    computationally mined or purchased in

    an exchange

  • Transaction: Signed data package that stores a message to be sent

    GAS: the name for the execution fee that senders

    of transactions need to pay for operations on

    Ethereum blockchain

    VALUE (field): The amount of wei to transfer

    from sender to the recipient

    STARTGAS (value): Representing the maximum

    number of computational steps the transaction

    execution is allowed to take

    GASPRICE (value): Representing the fee the

    sender is willing to pay for gas

  • Applications of Ethereum Blockchain of Smart Contracts

    Self-executing legal contracts

    Create American Idol where people can vote using generated tokens

    Company boards can be ran virtually

    Dropbox business model create and sell encrypted storage space

    Predicting financial futures based on an oracle

  • Demo Time!

  • But what about Python?

  • Python Ethereum Client Regular commits Interacts with private blockchains AND the

    official Ethereum blockchain Doesnt download blocks as fast as Go or

    Rusts Ethereum client Parity

  • Actionable Ways Python Developers Can Interact with Blockchain

    1. Checkout BigchainDB2. Contribute to Open Bazaar3. Get web3 to interact with

    Django or Flask

  • Bigchain DB This DB is actually in production (used

    by Hybrid of a database and blockchain NoSql datastore

  • BigchainDB compared to other data stores

  • Web3.jsJavaScript library that connects applications to a blockchain

    The blockchain act as an alternative or complements the database

    Currently web3 is used in the Javascript framework meteor but could be used in Flask

    or Django

  • Why Should We Care?

  • Democracy and Governance

  • Democracy as We Know It Can ChangeVoting can occur on the blockchain

    Agreements will be controlled by code as opposed to legal contracts

    Alternative way to keep track of identity

    Laws and bill can be kept on the blockchain which will create a

    permanent immutable record

  • Financial Industry

  • More Transparency, More ControlMoney transfers can happen more seamlessly (less reliance on Western Union)

    Transparent immutable ledger (do not have to trust banks with personal funds)

    Access to capital for nations that lack a dependable banking system

  • Less Sharing in the Sharing Economy

  • Peer-to-Peer ProfitsAbility to rent out rooms and rides without giving a portion of the profits to a

    third-party company

    Musicians earn more money when listeners stream their music

    Alternative marketplace for creators (such as and OpenBazaar)

  • Solidity Contract BugsTransaction-Ordering Bug (TOD): Smart contract assumes a particular state of a

    contract that doesnt exist

    Timestamp Dependence Bug: Asynchronous network is disconnected from a

    synchronized global clock. Some contracts assume that network is on global contract

    Unchecked Send: Most common exploit. Attacker elicits unexpected behavior from the

    contract by calling if from a carefully constructed call-stack


    Smart Contract Bloopers

  • How to Get Started TodaySolidity Tutorial:

    Bootstrap Meteor App:

    Example Dapps:

    Command Line Interface of Interacting with the Ethereum Network:


  • Contribute to Existing Blockchain ProjectsOpenBazaar:


  • Portia Burton


  • Thank You!

  • References1.








  • 7.