# Ethereum for Python Developers

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2018-10-07
- Duration: 12:02
- Watch: https://streameth.org/watch/yt-w5bOnMKQUvI
- YouTube: https://www.youtube.com/watch?v=w5bOnMKQUvI

## Description

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more.
https://archive.devcon.org/archive/watch/3/ethereum-for-python-developers

Everything you need to know to get started with Ethereum with Python.

Speaker(s): Piper Merriam
Skill level: Advanced
Track: Developer Infrastructure


Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum
Learn more about devcon: https://www.devcon.org/
Learn more about ethereum: https://ethereum.org/ 

Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. 
Devcon 3 was held in Cancún, Mexico on Nov 1 - 4, 2017
Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

## Transcript

[Music] hi everybody my name is Piper and I've been making tooling and things like that in the Python Python ecosystem since about well since the frontier network launched and today we're gonna do a really fast run through of the entire Python toolset that that I've been working on and talked sort of about the road map there and then at the end I'm gonna talk to you about PI EVM which is the project I'm most excited about right now cool so uh python etherium let's first let's talk about why python python is slow people have complaints about python there's the global interpreter to lock things like that but the big thing here is that diversity matters ëthere IAM is not a language specific tool and if developers can pickup tooling and languages that the languages that they are familiar with then it will speed up adoption and that's a big deal so we need more tooling in more languages and python is a big deal python is used for all kinds of stuff it is an extremely accessible language it's used heavily in data science and web development and all these things and so we need good tools in Python because lots of people use it and this is my favorite Python is the second best language for everything I this rings so true to me pythons got its works and its problems but it's also a wonderful language also we have tons of cute animal pictures in our github cool so the Python III I'm told chain first we'll start with web 3py thank you web 3j s team we literally copied your codebase converted it to Python and then took it from there so what three py is your sort of way to access the bought chain it handles all your all of your RPC communications when you want to talk to a node it does things like converting the responses to Python objects so that they're nice and friendly for you things that you don't want to be working on when you're building your product it has tons of built-in utilities for doing conversions converting things to hex and from hex and between bytes and text formats those currency conversions again things you don't want to be implementing you can focus on your product we have contract abstractions for a contract objects that give you really convenient all you have to do is feed us your ABI tell us what address you're at you can interact with your contract this does deployment all of the ABI in coatings of arguments and things like that that's again things you don't want to be building we also have an Accounts API this is currently in sort of a alpha stage if you're familiar with the web PHAs new accounts API again we generally kind of copied this you can do generation of accounts management of private keys from right there within your Python code base loading key files signing messages sending signed transactions things like that and we have this great middleware API and this is a much lower level API but impact it enables a lot of really powerful things caching interception of requests and signing them in flight things like that that you can build using this middleware API all right let's talk about populist populist is a development framework written in Python and it should be pretty familiar for Python developers they're really the biggest thing that it that it focuses on is testing but populist will handle all of your compilation and deployment for you which means finding all of your contracts scraping them all up feeding them into the solidity compiler and giving you the results same with deployment deploying those and then recording those deployments so that for future deployments you can still reference old deployments things like that it handles library linking so when you use libraries you end up with something like this in your bytecode you see that thing at the bottom there and that's a placeholder and what needs to go there is the actual address of the deployed version of that greeter library and this stuff is is you need to get it right and populist just automates and does all of this sort of stuff for you and package management we have this sort of unmerged branch that has all of the ERC 190 management's stuff in it it is a high priority for us to get this stuff in real soon and well package management's a big deal alright there's also a bunch of other tools there's a youth a theorem utils library that has a bunch of low-level stuff that's just functional functions that you can use that do all kinds of nice convenient useful things that are that that prop up commonly when you're doing ether name development we have an ABI utils library that does all the ABI encoding and decoding so if you need to do low-level stuff you know pulling old transactions seeing what data they sent stuff like that you can do that we have a Keyes library that handles the elliptical curve cryptography stuff for you so if you want to do low-level message signing things like that it has a native Python implementation it'll also detect the coin curve is installed and use coin curve which is much faster and it has a back-end system so if you have some other implementation of ECC that you want to use you can plug it right in you thin room key file loading key files off disk generating key files from private keys key stretching that sort of thing it's all handled for you we have this library called PI soul C which is a wrapper around the solidity compiler which is nice because you can do compilation from your Python code you know feet in feet in just the sources text or reference some files and just compilation but the thing that's really great here is that we have automation built into it for installing specific versions of solidity from source so if you have a CI environment and you want to run your stuff in Travis and you want to run it against a specific solidity version this library will let you do that right off the bat we zaardon almost all of our other repos that need solidity and it lets us test against specific versions of solidity aetherium tester is a library that we've been working on it's a sort of wrapper around using test block chains so right now it supports the PI II theory and blockchain but sort of an older version of it we're working on more backends for more options for testing specifically PI EVM is the one that we're focusing on and it has really nice web 3 integration so if you're using web 3 py in your application and you want to test again blockchain all you have to do is swap out the provider rather than changing a bunch of your code and you can test and you can run your application against a test bachi blockchain and we've got a bunch of more things there's this pi f library that has some nice wrappers around the etherium command line and implementation of the of the patricia tree and implementation of the bloom filter lots of tools wides wide array of them that are all supported where they're all actively developed and you should give them a try but what I really want to talk about is PI EVM PI a VM is a new implementation of the theory and virtual machine in Python and it came about sort of in this roundabout way originally there's PI e theorem and PI 3 and PI EVM are not the same thing pi e theorem is a library that's been around since the since for well as long as I can remember I was written by the talaq it's a library dependency and a ton of our code bases and it is used heavily right now by the by the Kasper research team Python is a great research tool because it's so mutable I just reach in do whatever you want and and PI aetherium has been key for so much of the research and things that have been done for the etherium network however it has not been a very good library for us to build on top of and I'll go into some reasons there and then there's PI Etha pand PI Etha is the Python aetherium node so if you want to run connect to the network then PI e thapa's is the thing that in theory could do that however for a very long time it has not been able to sync with the main net network so we had these two existing libraries and they facilitated a ton of research but but over the last two and a half or three years or however long it's been these libraries have also been a huge thorn in my side because there's no definition of what is a public and private API and and therein they're big and there's and they're monoliths and and things changed out from under us and and they're just not the foundation that we needed them to be so about a year ago I started tinkering with okay well what if I write my own so anyway so I started this experimental project evm and it sort of festered and and kept going and kept going and let me tell you some of the origins so one of the big things was don't bother Vitalik that was one of the main motivations here I didn't think that I could fix by aetherium without interrupting his work there was so much that needed to be changed that I felt that the scope of the changes it was so large that I that I assumed that it would be impossible for me to fix pi-theorem without disrupting metallics work I wanted to better understand the EVM and it's that thing that I need I needed a foundational library that I could build on top of um we are shooting for something that is the easiest to install client it'll be primarily focused on being a light client although we will support being a full node and we're hoping that it's gonna facilitate research really well but we have every intention of this be being a full node or a light client node that you can run and use in production this is our status right now we've got most of the fork rules done byzantium is still in progress and we've got the le s protocol in progress right now we have we're probably a month or two from a very alpha stage version of this that can sync up with the main net and run as a light client so we're very close on this and and it's a this project is intended to be sort of a foundational piece to the Python ecosystem um I'm very proud of this library and I and I think it's going to be one of the cornerstone pieces that helps bring the Python ecosystem up to par with some of the other rika III AM tooling out there and that's really sort of part of a broader goal of mine which is I set out earlier this year with the sort of abstract goal of maturing all of the Python tooling because we needed better tooling and and and so many people were flocking to the JavaScript stack which is fine because the JavaScript stack has been the superior stack for a long time and it's a great stack but people need choices and so I wanted to set out to actually give them those choices all right one last note Python three starting in 2018 we will begin dropping support for Python 2 so if you're using these tools and you're using Python 2 you need to upgrade because they are going to break on you it's time you need to upgrade your code base Python 3 is great upgrading to it is very easy there are a ton of resources out there we are dropping support for this if this is a problem for you please come talk to me but the answer is likely to be that you need to upgrade your code base thank you all for your time [Music]
