python, blockchain, and byte-size change
TRANSCRIPT
![Page 1: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/1.jpg)
Python, Blockchain, and
Byte-Size ChangePortia Burton
@pkafeiPyDX 2016
![Page 2: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/2.jpg)
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
![Page 3: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/3.jpg)
What is a Blockchain?
A blockchain is a cross between a decentralized data store and bittorrent.
![Page 4: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/4.jpg)
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
![Page 5: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/5.jpg)
Many Different Types of Cryptocurrencies
![Page 6: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/6.jpg)
![Page 7: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/7.jpg)
Bitcoin vs. BlockchainBitcoin is part of a blockchain
Blockchain is a digital ledger of transactions
Each transaction is cryptographically signed
Blockchains are trustless
![Page 8: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/8.jpg)
Ethereum
![Page 9: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/9.jpg)
![Page 10: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/10.jpg)
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)
![Page 11: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/11.jpg)
Different Consensus MechanismsProof of Work: Uses the Etash DAG algorithm. The Etash
DAG algorithm is based on Bitcoin’s the Dagger-Hashimoto
algorithm.
Proof of Stake: Proof of Stake is another way of validating. It
calculates the weight of the node, being proportional to its
computational resources. It’s less resource intensive than
Proof of Work.
![Page 12: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/12.jpg)
Ethereum Chains (not all blockchains are the same)
![Page 13: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/13.jpg)
![Page 14: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/14.jpg)
Different BlockchainsPublic blockchain: It is the official Ethereum chain that everyone can read and interact
with
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
![Page 15: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/15.jpg)
Can an average developer build blockchain applications?
![Page 16: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/16.jpg)
Indeed, We Can!
![Page 17: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/17.jpg)
But first, some more background
![Page 18: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/18.jpg)
Smart Contracts (also known as DApps)
![Page 19: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/19.jpg)
What is a Smart Contract?Stored on the blockchain and executed
by code
Many smart contracts are written in
Solidity
Powered by gas which can be
computationally mined or purchased in
an exchange
![Page 20: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/20.jpg)
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
![Page 21: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/21.jpg)
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
![Page 22: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/22.jpg)
Demo Time!
![Page 23: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/23.jpg)
But what about Python?
![Page 24: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/24.jpg)
Python Ethereum Client● Regular commits● Interacts with private blockchains AND the
official Ethereum blockchain● Doesn’t download blocks as fast as Go or
Rust’s Ethereum client Parity
![Page 25: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/25.jpg)
Actionable Ways Python Developers Can Interact with Blockchain
1. Checkout BigchainDB2. Contribute to Open Bazaar3. Get web3 to interact with
Django or Flask
![Page 26: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/26.jpg)
Bigchain DB● This DB is actually in production (used
by ascribe.io)● Hybrid of a database and blockchain● NoSql datastore
![Page 27: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/27.jpg)
BigchainDB compared to other data stores
![Page 28: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/28.jpg)
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
![Page 29: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/29.jpg)
Why Should We Care?
![Page 30: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/30.jpg)
Democracy and Governance
![Page 31: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/31.jpg)
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
![Page 32: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/32.jpg)
Financial Industry
![Page 33: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/33.jpg)
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
![Page 34: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/34.jpg)
Less Sharing in the Sharing Economy
![Page 35: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/35.jpg)
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 ascribe.io and OpenBazaar)
![Page 36: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/36.jpg)
Solidity Contract BugsTransaction-Ordering Bug (TOD): Smart contract assumes a particular state of a
contract that doesn’t 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
![Page 37: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/37.jpg)
https://ethereum.karalabe.com/talks/2016-hackethon.html#1
Smart Contract Bloopers
![Page 38: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/38.jpg)
How to Get Started TodaySolidity Tutorial: https://solidity.readthedocs.io/en/develop/
Bootstrap Meteor App: https://github.com/SilentCicero/meteor-dapp-boilerplate
Example Dapps:
http://ethereum.stackexchange.com/questions/2940/where-can-i-find-some-solidity-smart-contract-source-code-examples
Command Line Interface of Interacting with the Ethereum Network: https://www.ethereum.org/cli
Meteor: https://www.meteor.com/
![Page 39: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/39.jpg)
Contribute to Existing Blockchain ProjectsOpenBazaar: https://github.com/OpenBazaar/OpenBazaar-Server/issues
BigChainDB: https://github.com/bigchaindb/bigchaindb/issues
![Page 40: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/40.jpg)
Portia Burton
@pkafei
http://bit.ly/2dyGohH
![Page 41: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/41.jpg)
Thank You!
![Page 42: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/42.jpg)
References1. http://ethdocs.org/en/latest/mining.html#what-is-mining
2. http://ethdocs.org/en/latest/frequently-asked-questions/frequently-asked-questions
.html#what-s-the-difference-between-account-and-wallet-contract
3. http://www.coindesk.com/making-sense-smart-contracts/
4. https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options
5. http://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-an
d-transactions.html
6. https://blog.ethereum.org/2016/07/12/build-server-less-applications-mist/
![Page 43: Python, Blockchain, and Byte-Size Change](https://reader033.vdocument.in/reader033/viewer/2022052219/586fba241a28abe57d8b865b/html5/thumbnails/43.jpg)
7.http://www.techrepublic.com/article/uk-government-using-blockchain-to-track-welfare-spending/
8. https://github.com/ethereum/pyethapp
9. https://www.bigchaindb.com/whitepaper/bigchaindb-whitepaper.pdf