Python, Blockchain, and Byte-Size Change

Download Python, Blockchain, and Byte-Size Change

Post on 16-Apr-2017

534 views

Category:

Technology

2 download

TRANSCRIPT

Python, Blockchain, and Byte-Size ChangePortia Burton@pkafeiPyDX 2016Who am I?My name is Portia BurtonI am a full-stack developer at the Atlantic magazineBecame interested in blockchains earlier this yearNot a cryptographic expertWhat is a Blockchain?A blockchain is a cross between a decentralized data store and bittorrent. What is Bitcoin?Type of CryptocurrencyCreation based on paper by Satoshi Nakamoto titled Bitcoin: Peer-to-Peer Electronic Cash SystemPeer-to-peer which means transactions happen without a third party. Alice can send money directly to BobMany Different Types of CryptocurrenciesBitcoin vs. BlockchainBitcoin is part of a blockchainBlockchain is a digital ledger of transactionsEach transaction is cryptographically signedBlockchains are trustlessEthereumIntroduction to EthereumEthereum is a programmable blockchain, every new blockchain spawned from Ethereum has the same properties as EthereumEthereum Virtual Machine is the low level machine languageIs Turing complete, unlike bitcoin which does not have looping capabilitiesIt 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 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. 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 withTestnet blockchain: The official test chain of Ethereum. Good way to test contracts without wasting real etherPrivate 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 onlyCan an average developer build blockchain applications?Indeed, We Can!But first, some more backgroundSmart Contracts (also known as DApps)What is a Smart Contract?Stored on the blockchain and executed by codeMany smart contracts are written in SolidityPowered by gas which can be computationally mined or purchased in an exchangeTransaction: 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 blockchainVALUE (field): The amount of wei to transfer from sender to the recipientSTARTGAS (value): Representing the maximum number of computational steps the transaction execution is allowed to takeGASPRICE (value): Representing the fee the sender is willing to pay for gasApplications of Ethereum Blockchain of Smart ContractsSelf-executing legal contractsCreate American Idol where people can vote using generated tokensCompany boards can be ran virtually Dropbox business model create and sell encrypted storage space Predicting financial futures based on an oraclehttps://www.ethereum.org/daohttps://www.ethereum.org/daohttps://www.ethereum.org/daoDemo 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 ParityActionable Ways Python Developers Can Interact with Blockchain1. Checkout BigchainDB2. Contribute to Open Bazaar3. Get web3 to interact with Django or FlaskBigchain DB This DB is actually in production (used by ascribe.io) Hybrid of a database and blockchain NoSql datastoreBigchainDB compared to other data storesWeb3.jsJavaScript library that connects applications to a blockchainThe blockchain act as an alternative or complements the databaseCurrently web3 is used in the Javascript framework meteor but could be used in Flask or DjangoWhy Should We Care?Democracy and GovernanceDemocracy as We Know It Can ChangeVoting can occur on the blockchainAgreements will be controlled by code as opposed to legal contractsAlternative way to keep track of identityLaws and bill can be kept on the blockchain which will create a permanent immutable recordFinancial IndustryMore 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 systemLess Sharing in the Sharing EconomyPeer-to-Peer ProfitsAbility to rent out rooms and rides without giving a portion of the profits to a third-party companyMusicians earn more money when listeners stream their musicAlternative marketplace for creators (such as ascribe.io and OpenBazaar)Solidity Contract BugsTransaction-Ordering Bug (TOD): Smart contract assumes a particular state of a contract that doesnt existTimestamp Dependence Bug: Asynchronous network is disconnected from a synchronized global clock. Some contracts assume that network is on global contractUnchecked Send: Most common exploit. Attacker elicits unexpected behavior from the contract by calling if from a carefully constructed call-stack https://ethereum.karalabe.com/talks/2016-hackethon.html#1Smart Contract BloopersHow to Get Started TodaySolidity Tutorial: https://solidity.readthedocs.io/en/develop/Bootstrap Meteor App: https://github.com/SilentCicero/meteor-dapp-boilerplateExample Dapps: http://ethereum.stackexchange.com/questions/2940/where-can-i-find-some-solidity-smart-contract-source-code-examplesCommand Line Interface of Interacting with the Ethereum Network: https://www.ethereum.org/cliMeteor: https://www.meteor.com/ https://solidity.readthedocs.io/en/develop/https://github.com/SilentCicero/meteor-dapp-boilerplatehttp://ethereum.stackexchange.com/questions/2940/where-can-i-find-some-solidity-smart-contract-source-code-exampleshttp://ethereum.stackexchange.com/questions/2940/where-can-i-find-some-solidity-smart-contract-source-code-exampleshttps://www.ethereum.org/clihttps://www.meteor.com/Contribute to Existing Blockchain ProjectsOpenBazaar: https://github.com/OpenBazaar/OpenBazaar-Server/issuesBigChainDB: https://github.com/bigchaindb/bigchaindb/issueshttps://github.com/OpenBazaar/OpenBazaar-Server/issuesPortia Burton@pkafeihttp://bit.ly/2dyGohHThank You!References1. http://ethdocs.org/en/latest/mining.html#what-is-mining2. http://ethdocs.org/en/latest/frequently-asked-questions/frequently-asked-questions.html#what-s-the-difference-between-account-and-wallet-contract3. http://www.coindesk.com/making-sense-smart-contracts/ 4. https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options5. http://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.html6. https://blog.ethereum.org/2016/07/12/build-server-less-applications-mist/http://ethdocs.org/en/latest/mining.html%23what-is-mininghttp://ethdocs.org/en/latest/mining.html%23what-is-mininghttp://ethdocs.org/en/latest/frequently-asked-questions/frequently-asked-questions.html%23what-s-the-difference-between-account-and-wallet-contracthttp://ethdocs.org/en/latest/frequently-asked-questions/frequently-asked-questions.html%23what-s-the-difference-between-account-and-wallet-contracthttp://ethdocs.org/en/latest/frequently-asked-questions/frequently-asked-questions.html%23what-s-the-difference-between-account-and-wallet-contracthttp://www.coindesk.com/making-sense-smart-contracts/http://www.coindesk.com/making-sense-smart-contracts/https://github.com/ethereum/go-ethereum/wiki/Command-Line-Optionshttps://github.com/ethereum/go-ethereum/wiki/Command-Line-Optionshttp://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.htmlhttp://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.htmlhttp://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.html7.http://www.techrepublic.com/article/uk-government-using-blockchain-to-track-welfare-spending/8. https://github.com/ethereum/pyethapp9. https://www.bigchaindb.com/whitepaper/bigchaindb-whitepaper.pdf http://www.techrepublic.com/article/uk-government-using-blockchain-to-track-welfare-spending/http://www.techrepublic.com/article/uk-government-using-blockchain-to-track-welfare-spending/http://www.techrepublic.com/article/uk-government-using-blockchain-to-track-welfare-spending/https://github.com/ethereum/pyethapphttps://www.bigchaindb.com/whitepaper/bigchaindb-whitepaper.pdf