Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 视频教程 | 打赏(Donations) | About
知乎专栏多维度架构微信号 netkiller-ebook | QQ群:128659835 请注明“读者”

第 18 章 web3.py - A python interface for interacting with the Ethereum blockchain and ecosystem.

目录

18.1. 安装 web3.py 开发环境
18.1.1. CentOS
18.1.2. MAC OS
18.2. 连接到以太坊节点
18.2.1. HTTP
18.2.2. IPC
18.2.3. Websocket
18.3. 交易
18.3.1. 发送 ETH
18.3.2. 签名发送 ETH
18.4. ERC20 代币合约
18.4.1. 签名发送ERC20代币

文档地址 http://web3py.readthedocs.io/

18.1. 安装 web3.py 开发环境

18.1.1. CentOS

			
[root@iZj6c39y62jl5b1wmfv6u8Z ~]# yum install python34-pip

[root@iZj6c39y62jl5b1wmfv6u8Z ~]# pip3 install --upgrade pip
Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 68.9MB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-10.0.1
			
			
			
python3.6 -m venv env --without-pip
source env/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python3
python3.6 -m pip install web3			
			
			

18.1.2. MAC OS

首先去 python.org 官网下载 Python 3.6.5 dmg格式,安装后进入终端。

			
You should consider upgrading via the 'pip install --upgrade pip' command.
neo@MacBook-Pro ~/ethereum/web3.py % pip3.6 install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-10.0.1
			
neo@MacBook-Pro ~/ethereum/web3.py % pip3.6 install web3