# Ethereum Python 开发教程及资料  V2022-04-10

By [qingyun.eth](https://paragraph.com/@qingyun) · 2022-04-10

---

web3.py 官方手册
============

[https://web3py.readthedocs.io/en/stable/index.html](https://web3py.readthedocs.io/en/stable/index.html)

Looking for Ethereum Python tutorials? （Ethereum官方指南）→ ethereum.org/python
--------------------------------------------------------------------------

### GETTING STARTED WITH SMART CONTRACTS AND THE SOLIDITY LANGUAGE

**Take your first steps to integrating Python with Ethereum**

Need a more basic primer first? Check out [ethereum.org/learn](https://ethereum.org/en/learn/) or [ethereum.org/developers](https://ethereum.org/en/developers/).

*   [Blockchain Explained](https://kauri.io/article/d55684513211466da7f8cc03987607d5/blockchain-explained)
    
*   [Understanding Smart Contracts](https://kauri.io/article/e4f66c6079e74a4a9b532148d3158188/ethereum-101-part-5-the-smart-contract)
    
*   [Write your First Smart Contract](https://kauri.io/article/124b7db1d0cf4f47b414f8b13c9d66e2/remix-ide-your-first-smart-contract)
    
*   [Learn How to Compile and Deploy Solidity](https://kauri.io/article/973c5f54c4434bb1b0160cff8c695369/understanding-smart-contract-compilation-and-deployment)
    

### BEGINNER ARTICLES

*   [A (Python) Developer's Guide to Ethereum](https://snakecharmers.ethereum.org/a-developers-guide-to-ethereum-pt-1/)
    
*   [An Introduction to Smart Contracts with Vyper](https://kauri.io/#collections/Getting%20Started/an-introduction-to-smart-contracts-with-vyper/)
    
*   [Deploy your own ERC20 Token with Python and Brownie](https://betterprogramming.pub/python-blockchain-token-deployment-tutorial-create-an-erc20-77a5fd2e1a58)
    
*   [How to develop Ethereum contract using Python Flask?](https://medium.com/coinmonks/how-to-develop-ethereum-contract-using-python-flask-9758fe65976e)
    
*   [Intro to Web3.py · Ethereum For Python Developers](https://www.dappuniversity.com/articles/web3-py-intro)
    
*   [How to call a Smart Contract function using Python and web3.py](https://stackoverflow.com/questions/57580702/how-to-call-a-smart-contract-function-using-python-and-web3-py)
    

### INTERMEDIATE ARTICLES

*   [Dapp Development for Python Programmers](https://levelup.gitconnected.com/dapps-development-for-python-developers-f52b32b54f28)
    
*   [Creating a Python Ethereum Interface: Part 1](https://hackernoon.com/creating-a-python-ethereum-interface-part-1-4d2e47ea0f4d)
    
*   [Ethereum Smart Contracts in Python: a comprehensive(ish) guide](https://hackernoon.com/ethereum-smart-contracts-in-python-a-comprehensive-ish-guide-771b03990988)
    
*   [Using Brownie and Python to deploy Smart Contracts](https://dev.to/patrickalphac/using-brownie-for-to-deploy-smart-contracts-1kkp)
    
*   [Creating NFTs on OpenSea with Brownie](https://www.freecodecamp.org/news/how-to-make-an-nft-and-render-on-opensea-marketplace/)
    

### ADVANCED USE PATTERNS

*   [Compiling, deploying and calling Ethereum smartcontract using Python](https://yohanes.gultom.id/2018/11/28/compiling-deploying-and-calling-ethereum-smartcontract-using-python/)
    
*   [Analyze Solidity Smart Contracts with Slither](https://kauri.io/#collections/DevOps/analyze-solidity-smart-contracts-with-slither/#analyze-solidity-smart-contracts-with-slither)
    
*   [Blockchain Fintech Tutorial: Lending and Borrowing With Python](https://blog.chain.link/blockchain-fintech-defi-tutorial-lending-borrowing-python/)
    

### PYTHON PROJECTS AND TOOLS

### Active:

*   [Web3.py](https://github.com/ethereum/web3.py) - _Python library for interacting with Ethereum_
    
*   [Ape](https://github.com/ApeWorX/ape) - _The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals_
    
*   [Brownie](https://github.com/eth-brownie/brownie) - _Python framework for deploying, testing and interacting with Ethereum smart contracts_
    
*   [Vyper](https://github.com/ethereum/vyper/) - _Pythonic Smart Contract Language for the EVM_
    
*   [py-evm](https://github.com/ethereum/py-evm) - _implementation of the Ethereum Virtual Machine_
    
*   [eth-tester](https://github.com/ethereum/eth-tester) - _tools for testing Ethereum-based applications_
    
*   [eth-utils](https://github.com/ethereum/eth-utils/) - _utility functions for working with Ethereum related codebases_
    
*   [py-solc-x](https://pypi.org/project/py-solc-x/) - _Python wrapper around the solc solidity compiler with 0.5.x support_
    
*   [py-wasm](https://github.com/ethereum/py-wasm) - _Python implementation of the web assembly interpreter_
    
*   [pydevp2p](https://github.com/ethereum/pydevp2p) - _implementation of the Ethereum P2P stack_
    
*   [pymaker](https://github.com/makerdao/pymaker) - _Python API for Maker contracts_
    
*   [siwe](https://github.com/spruceid/siwe-py) - _Sign in with Ethereum (siwe) for Python_
    
*   [Smart contracts for testing](https://github.com/tradingstrategy-ai/smart-contracts-for-testing) - _A Python package that comes with ERC-20, Uniswap and other common contracts for writing tests with Web3.py_
    

### Archived / No longer maintained:

*   [Trinity](https://github.com/ethereum/trinity) - _Ethereum Python client_
    
*   [Mamba](https://mamba.black/) - _framework to write, compile, and deploy smart contracts written in Vyper language_
    

Looking for more resources? Check out [ethereum.org/developers](https://ethereum.org/en/developers/).

### PROJECTS USING PYTHON TOOLING

The following Ethereum-based projects use tools mentioned on this page. The related open-source repositories serve as a good reference for example code and best practices.

*   [Yearn Finance](https://yearn.finance/) and [Yearn Vault Contracts repository](https://github.com/yearn/yearn-vaults)
    
*   [Curve](https://curve.fi/) and [Curve smart contracts repository](https://github.com/curvefi/curve-contract)
    
*   [BadgerDAO](https://badger.com/) and [smart contracts using Brownie toolchain](https://github.com/Badger-Finance/badger-system)
    
*   [Sushi](https://sushi.com/) uses [Python in managing and deploying their vesting contracts](https://github.com/sushiswap/sushi-vesting-protocols)
    
*   [Alpha Finance](https://alphafinance.io/), of Alpha Homora fame, uses [Brownie to test and deploy smart contracts](https://github.com/AlphaFinanceLab/alpha-staking-contract)
    

其他教程
====

Getting started with Python and Web3.py
---------------------------------------

[https://cryptomarketpool.com/getting-started-with-python-and-web3-py/](https://cryptomarketpool.com/getting-started-with-python-and-web3-py)

1.  [How to connect to the Ethereum blockchain using a node](https://cryptomarketpool.com/connect-to-an-ethereum-node/)
    
2.  [How to install Web3.py in Python](https://cryptomarketpool.com/how-to-install-web3-py-in-python/)
    
3.  [Test your connection to the Ethereum blockchain using Web3.py and Python](https://cryptomarketpool.com/test-your-connection-to-the-ethereum-blockchain-using-python-and-web3-py/)
    
4.  [How to get a smart contracts ABI for use in Web3 and Python](https://cryptomarketpool.com/how-to-get-a-smart-contracts-abi-for-use-in-python-web3-py/)
    
5.  [Read Solidity smart contract data using Web3.py in Python](https://cryptomarketpool.com/read-solidity-smart-contract-data-using-web3-py-in-python/)
    
6.  [Get gas prices from the ETH Gas Station using json in Python](https://cryptomarketpool.com/get-gas-prices-from-the-eth-gas-station-and-web3-py-in-python/)
    
7.  [Call a uniswap function using Web3.py in Python](https://cryptomarketpool.com/use-web3-py-in-python-to-call-uniswap)
    
8.  [Get market data from uniswap using Web3.py in Python](https://cryptomarketpool.com/get-market-data-from-uniswap-using-web3-py-in-python/)
    
9.  [How to listen for Ethereum events using Web3.py in Python](https://cryptomarketpool.com/how-to-listen-for-ethereum-events-using-web3-in-python/)
    
10.  [Send an ETH transaction using Web3.py in Python](https://cryptomarketpool.com/send-a-transaction-to-the-ethereum-blockchain-using-python-and-web3-py/)
    
11.  [Can you make money creating an arbitrage bot running on the Ethereum block chain?](https://cryptomarketpool.com/can-you-make-money-creating-an-arbitrage-bot-running-on-the-ethereum-block-chain/)
    
12.  [How to create a snipe bot to monitor IDO’s or new liquidity pairs in Python](https://cryptomarketpool.com/how-to-create-a-snipe-bot-to-monitor-idos-in-python/)
    
13.  [Use The Graph in Python to query Ethereum data](https://cryptomarketpool.com/use-the-graph-in-python-to-query-ethereum-data/)
    
14.  [How to airdrop crypto to multiple accounts using Python](https://cryptomarketpool.com/how-to-airdrop-crypto-to-multiple-accounts-using-python/)
    
15.  [Crypto QR code generator in Python](https://cryptomarketpool.com/crypto-qr-code-generator-in-python)
    
16.  [Create a blockchain in Python](https://cryptomarketpool.com/create-a-simple-blockchain-in-python/)
    
17.  [Convert a string to SHA256 in Python](https://cryptomarketpool.com/convert-a-string-to-sha256-in-python/)
    
18.  [Use Python to monitor Twitter accounts for crypto tweets](https://cryptomarketpool.com/monitor-twitter-accounts-for-crypto-tweets/)
    
19.  [Reddit sentiment indicator for crypto in Python](https://cryptomarketpool.com/reddit-sentiment-crypto-indicator-in-python/)
    
20.  [Build a crypto back running bot](https://cryptomarketpool.com/build-a-crypto-back-running-bot/)
    
21.  [Compound Finance liquidation bot](https://cryptomarketpool.com/compound-finance-liquidation-bot/)
    
22.  [How to use Flashbots](https://cryptomarketpool.com/how-to-use-flashbots/)
    

Access Ethereum Data Using Web3.py, Infura, and The Graph
---------------------------------------------------------

[https://towardsdatascience.com/access-ethereum-data-using-web3-py-infura-and-the-graph-d6fb981c2dc9](https://towardsdatascience.com/access-ethereum-data-using-web3-py-infura-and-the-graph-d6fb981c2dc9)

Build your own Etherscan with web3.py
-------------------------------------

[https://github.com/hackingthemarkets/web3py-etherscan#build-your-own-etherscan-with-web3py](https://github.com/hackingthemarkets/web3py-etherscan#build-your-own-etherscan-with-web3py)

带视频讲解

[![]({{DOMAIN}}/editor/youtube/play.png)](https://www.youtube.com/watch?v=XcHNWuMietY)

get\_price\_on\_dex\_BSC\_Web3.py
---------------------------------

[https://github.com/paowongsakorn/get\_price\_on\_dex\_BSC\_Web3.py](https://github.com/paowongsakorn/get_price_on_dex_BSC_Web3.py)

一个简单的报价实例

web3py 解析智能合约交易结果（event事件日志解析、操作结果解析、log解析）
-------------------------------------------

[https://blog.csdn.net/tz\_zs/article/details/121249588](https://blog.csdn.net/tz_zs/article/details/121249588)

一个获取tx详细信息的实例

如何从web3py获取事件数据？
----------------

[https://www.cnpython.com/qa/284752](https://www.cnpython.com/qa/284752)

awesome-web合集
=============

ahmet/awesome-web3#python
-------------------------

[https://github.com/ahmet/awesome-web3#python](https://github.com/ahmet/awesome-web3#python)

Development Environment

*   [Brownie](https://github.com/eth-brownie/brownie) - Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
    

Solidity

*   [Date and Time tools](https://github.com/pipermerriam/ethereum-datetime) - Contract which implements utilities for working with datetime values in ethereum.
    

Book

*   [Ethereum development with Go](https://goethereumbook.org/en)
    
*   [Mastering Ethereum](https://github.com/ethereumbook/ethereumbook)
    

JoinColony/awesome-web3
-----------------------

[https://github.com/JoinColony/awesome-web3](https://github.com/JoinColony/awesome-web3)

开头一堆列表

*   [https://github.com/btomashvili/awesome-ethereum](https://github.com/btomashvili/awesome-ethereum)
    
*   [https://github.com/bkrem/awesome-solidity](https://github.com/bkrem/awesome-solidity)
    
*   [https://github.com/vinsgo/awesome-ethereum](https://github.com/vinsgo/awesome-ethereum)
    
*   [https://github.com/toadkicker/awesome-ethereum](https://github.com/toadkicker/awesome-ethereum)
    
*   [https://github.com/void4/awesome-ethereum](https://github.com/void4/awesome-ethereum)
    
    *   这里面底部有个很不错
        
        *   [https://github.com/jdourlens/awesome-ethereum-analytics](https://github.com/jdourlens/awesome-ethereum-analytics)
            

grandsmarquis/awesome-ethereum-analytics
----------------------------------------

[https://github.com/grandsmarquis/awesome-ethereum-analytics](https://github.com/grandsmarquis/awesome-ethereum-analytics)

其中DEX trackers

只有这一个可用

*   [0x protocol on DAppBoard](https://dappboard.com/dapp/0x)
    

Datasets（第三方数据集）

Perform data analysis using these publically available Ethereum datasets.

*   [Ethereum BigQuery dataset](https://cloud.google.com/blog/products/data-analytics/ethereum-bigquery-public-dataset-smart-contract-analytics)
    
*   [Function signature database](https://www.4byte.directory/)
    
*   [ERC20 token logos](https://github.com/TrustWallet/tokens)
    
*   [Lot of Ethereum data (tokens, nfts, events signatures...](https://github.com/DAppBoard/dappboard-ethereum-metadata)
    

Blogs

很酷的数据挖掘博客

Interesting analytics blogs that cover data on the Ethereum blockchain.

*   [Token Analyst](https://medium.com/tokenanalyst)
    
*   [Alethio](https://medium.com/@alethioEthstats)
    
*   [Block Science](https://medium.com/block-science)
    

三方学习网站
======

登链社区 中文文档库

[https://learnblockchain.cn/manuals](https://learnblockchain.cn/manuals)

#### Solidity 中文文档

Solidity 是一门面向合约的、为实现智能合约而创建的高级编程语言。Solidity 是静态类型语言，支持继承、库和复杂的用户定义类型等特性。

#### Web3.js 中文文档

web3.js 是一组使用HTTP或IPC连接来和本地或远程以太坊节点进行交互的库。

*   [中文版](https://learnblockchain.cn/docs/web3.js/)
    
*   [官方版](https://web3js.readthedocs.io/en/v1.3.4/)
    

[https://learnblockchain.cn/docs/ethers.js/](https://learnblockchain.cn/docs/ethers.js/)

#### ethers.js 中文文档

#### Etherscan 中文文档

#### CoinGecko文档

---

*Originally published on [qingyun.eth](https://paragraph.com/@qingyun/ethereum-python-v2022-04-10)*
