---
title: "适合 Python 开发者的以太坊"
description: "学习如何使用基于 Python 的项目和工具在以太坊上进行开发"
lang: zh
incomplete: true
---

<FeaturedText>学习如何使用基于 Python 的项目和工具在以太坊上进行开发</FeaturedText>

使用以太坊创建去中心化应用（或称“dapp”），利用加密货币和区块链技术的优势。这些 dapp 是值得信赖的，这意味着一旦它们被部署到以太坊上，它们将始终按程序运行。它们可以控制数字资产，从而创建新型的金融应用。它们可以是去中心化的，这意味着没有单一实体或个人控制它们，并且几乎不可能被审查。

## 智能合约和 Solidity 语言入门 {#getting-started-with-smart-contracts-and-solidity}

**迈出将 Python 与以太坊集成的第一步**

需要先了解更基础的入门知识？请查看 [ethereum.org/learn](/learn/) 或 [ethereum.org/developers](/developers/)。

- [区块链解释](https://kauri.io/article/d55684513211466da7f8cc03987607d5/blockchain-explained)
- [了解智能合约](https://kauri.io/article/e4f66c6079e74a4a9b532148d3158188/ethereum-101-part-5-the-smart-contract)
- [编写你的第一个智能合约](https://kauri.io/article/124b7db1d0cf4f47b414f8b13c9d66e2/remix-ide-your-first-smart-contract)
- [学习如何编译和部署 Solidity](https://kauri.io/article/973c5f54c4434bb1b0160cff8c695369/understanding-smart-contract-compilation-and-deployment)
- [2023 年区块链中 Python 状态报告](https://tradingstrategy.ai/blog/the-state-of-python-in-blockchain-in-2023)

## 初学者文章 {#beginner-articles}

- [Web3.py 概述](https://web3py.readthedocs.io/en/latest/overview.html)
- [以太坊 Python 生态系统之旅](https://snakecharmers.ethereum.org/python-ecosystem/)
- [（Python）开发者以太坊指南](https://snakecharmers.ethereum.org/a-developers-guide-to-ethereum-pt-1/)
- [值得获奖：以太坊 Python 黑客松指南](https://snakecharmers.ethereum.org/prize-worthy/)
- [使用 Vyper 的智能合约简介](https://kauri.io/#collections/Getting%20Started/an-introduction-to-smart-contracts-with-vyper/)
- [如何使用 Python Flask 开发以太坊合约？](https://medium.com/coinmonks/how-to-develop-ethereum-contract-using-python-flask-9758fe65976e)
- [Web3.py 简介 · 适合 Python 开发者的以太坊](https://www.dappuniversity.com/articles/web3-py-intro)
- [如何使用 Python 和 Web3.py 调用智能合约函数](https://stackoverflow.com/questions/57580702/how-to-call-a-smart-contract-function-using-python-and-web3-py)

## 进阶文章 {#intermediate-articles}

- [Web3.py 之友：Ape 简介](https://snakecharmers.ethereum.org/intro-to-ape/)
- [面向 Python 程序员的 dapp 开发](https://www.youtube.com/watch?v=tE-8bG35VNw)
- [创建 Python 以太坊接口：第 1 部分](https://hackernoon.com/creating-a-python-ethereum-interface-part-1-4d2e47ea0f4d)
- [Python 中的以太坊智能合约：一份（相对）全面的指南](https://hackernoon.com/ethereum-smart-contracts-in-python-a-comprehensive-ish-guide-771b03990988)

## 高级使用模式 {#advanced-use-patterns}

- [Web3.py 模式：实时事件订阅](https://snakecharmers.ethereum.org/subscriptions/)
- [Web3.py 模式：WebSocketProvider](https://snakecharmers.ethereum.org/websocketprovider/)
- [使用 Python 编译、部署和调用以太坊智能合约](https://yohanes.gultom.id/2018/11/28/compiling-deploying-and-calling-ethereum-smartcontract-using-python/)
- [使用斯莱瑟分析 Solidity 智能合约](https://kauri.io/#collections/DevOps/analyze-solidity-smart-contracts-with-slither/#analyze-solidity-smart-contracts-with-slither)
- [区块链金融科技教程：使用 Python 进行借贷和借款](https://blog.chain.link/blockchain-fintech-defi-tutorial-lending-borrowing-python/)

## 存档文章 {#archived-articles}

- [使用 Python 和 Brownie 部署你自己的 ERC-20 代币](https://betterprogramming.pub/python-blockchain-token-deployment-tutorial-create-an-erc20-77a5fd2e1a58)
- [使用 Brownie 和 Python 部署智能合约](https://dev.to/patrickalphac/using-brownie-for-to-deploy-smart-contracts-1kkp)
- [使用 Brownie 在 OpenSea 上创建 NFT](https://www.freecodecamp.org/news/how-to-make-an-nft-and-render-on-opensea-marketplace/)

## Python 项目和工具 {#python-projects-and-tools}

- [Web3.py](https://github.com/ethereum/web3.py) - _用于与以太坊交互的 Python 库_
- [Vyper](https://github.com/ethereum/vyper/) - _适用于 EVM 的 Python 风格智能合约语言_
- [Titanoboa](https://github.com/vyperlang/titanoboa/) - _Vyper 的原生测试工具；一个具有主网分叉、调试和美观回溯功能的解释器_
- [Moccasin](https://github.com/Cyfrin/moccasin) - _一个基于 Titanoboa 构建的，用于 Vyper 和 Python 的智能合约开发和测试框架_
- [Ape](https://github.com/ApeWorX/ape) - _面向 Python 开发者、数据科学家和安全专业人员的智能合约开发工具_
- [py-evm](https://github.com/ethereum/py-evm) - _以太坊虚拟机的实现_
- [eth-tester](https://github.com/ethereum/eth-tester) - _用于测试基于以太坊的应用的工具_
- [eth-utils](https://github.com/ethereum/eth-utils/) - _用于处理以太坊相关代码库的实用函数_
- [py-solc-x](https://pypi.org/project/py-solc-x/) - _支持 0.5.x 版本的 solc Solidity 编译器的 Python 包装器_
- [pymaker](https://github.com/makerdao/pymaker) - _用于 Maker 合约的 Python API_
- [siwe](https://github.com/signinwithethereum/siwe-py) - _适用于 Python 的以太坊登录 (SIWE)_
- [用于以太坊集成的 Web3 去中心化金融 (DeFi)](https://github.com/tradingstrategy-ai/web3-ethereum-defi) - _一个包含 ERC-20、尤尼斯瓦普和其他热门项目现成集成的 Python 包_
- [Wake](https://getwake.io) - _用于合约测试、模糊测试、部署、漏洞扫描和代码导航的一体化 Python 框架（语言服务器 - [Tools for Solidity](https://marketplace.visualstudio.com/items?itemName=AckeeBlockchain.tools-for-solidity)）_
- [DeFiPy](https://github.com/defipy-devs/defipy) - _用于跨尤尼斯瓦普 V2/V3、Balancer 和 Curve 进行 DeFi 分析和自动做市商 (AMM) 模拟的 Python SDK_
### 已存档 / 不再维护： {#archived--no-longer-maintained}

- [Trinity](https://github.com/ethereum/trinity) - _以太坊 Python 客户端_
- [Mamba](https://github.com/arjunaskykok/mamba) - _用于编写、编译和部署用 Vyper 语言编写的智能合约的框架_
- [Brownie](https://github.com/eth-brownie/brownie) - _用于部署、测试和与以太坊智能合约交互的 Python 框架_
- [pydevp2p](https://github.com/ethereum/pydevp2p) - _以太坊 P2P 堆栈的实现_
- [py-wasm](https://github.com/ethereum/py-wasm) - _WebAssembly 解释器的 Python 实现_

寻找更多资源？请查看 [ethereum.org/developers](/developers/)。

## 使用 Python 工具的项目 {#projects-using-python-tooling}

以下基于以太坊的项目使用了本页提到的工具。相关的开源代码库可作为示例代码和最佳实践的良好参考。

- [Yearn Finance](https://yearn.finance/) 和 [Yearn 金库合约代码库](https://github.com/yearn/yearn-vaults)
- [Curve](https://www.curve.finance/) 和 [Curve 智能合约代码库](https://github.com/curvefi/curve-contract)
- [BadgerDAO](https://badger.com/) 和 [使用 Brownie 工具链的智能合约](https://github.com/Badger-Finance/badger-system)
- [Sushi](https://sushi.com/) 使用 [Python 管理和部署其归属合约](https://github.com/sushiswap/sushi-vesting-protocols)
- [Alpha Finance](https://alphaventuredao.io/)（以 Alpha Homora 闻名）使用 [Brownie 测试和部署智能合约](https://github.com/AlphaFinanceLab/alpha-staking-contract)

## Python 社区讨论 {#python-community-contributors}

- [以太坊 Python 社区 Discord](https://discord.gg/9zk7snTfWe)，用于 Web3.py 和其他 Python 框架的讨论
- [Vyper Discord](https://discord.gg/SdvKC79cJk)，用于 Vyper 智能合约编程的讨论

## 其他汇总列表 {#other-aggregated-lists}

Vyper wiki 有一个[极好的 Vyper 资源列表](https://github.com/vyperlang/vyper/wiki/Vyper-tools-and-resources)
