我正试图在本地的testrpc网络中使用web3.py为用户创建帐户。我已经按照文档的方式试过了。但我知道这个错误
AttributeError: 'Eth' object has no attribute 'account'
我正在尝试的代码:
from web3 import Web3 w3 = Web3(YOUR_PROVIDER) acct = w3.eth.account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530')
我可以看到accounts对象在eth对象中,但这不是我所需要的。
我做错什么了?我可以看到还有另一种类型的帐户,在doc中称为PersonalAccount。
这两者有什么区别呢?
发布于 2017-11-14 17:40:24
更新: web3.py v4已经稳定了一段时间,所以这个问题和答案不再有意义了。w3.eth.account包含在任何现代安装中。
为了使用最新的w3.eth.account特性,您必须:
从源
git clone https://github.com/pipermerriam/web3.py.git
cd web3.py
virtualenv -p python3 venv
. venv/bin/activate
pip install -e .
python
>>> from web3 import Web3, ...您指的web3 3文档是表示“最新”的,它对应于http://github.com/pipermerriam/web3.py主机上的源代码。
要查看v3中可用的特性,请参阅稳定的web3 3文档。
发布于 2017-11-14 06:31:58
Python有多个Ethereum库,尝试使用这个https://github.com/pipermerriam/web3.py --我对这个一致的库没有什么好运气。
docs列表eth.account.create http://web3py.readthedocs.io/en/latest/web3.eth.account.html
git克隆git@github.com:pipermerriam/web3.py.gitcd,web3.py虚拟clone venv。venv/bin/激活pip安装-r要求-dev.txtpip安装-e。web3 Web3 web3 = Web3(HTTPProvider('http://localhost:8545')) web3.eth.account.create("asdf")
https://ethereum.stackexchange.com/questions/30624
复制相似问题