I built a private chain on my computer using geth
and I want to interact with it using web3.py
. But there was something wrong.
I started the private chain(containing only one node) with the command
$ geth --datadir datadir --rpc --rpcport 8545 --port 30301 --ipcpath /tmp/geth.ipc --rpccorsdomain '*' --unlock 0
Having started the chain, I was able to use the environment in remix IDE via RPC. Then I followed the docs of web3.py and wrote some simple code:
from web3 import Web3, HTTPProvider
w3 = Web3(HTTPProvider('http://localhost:8545'))
print(w3.eth.blockNumber)
print(w3.personal.listAccounts)
What upset me was that the w3.eth.blockNumber
worked just fine but the listAccounts
didn't.
Here is a picture of the error message :
Some info: OS: ubuntu16.04 geth: 1.8.2 web3.py: 3.16.5
A noobie here, please help T_T. I googled this but didn't find similar problems (maybe this is too simple?).
w3.eth.accounts
to fetch accountsgeth --help
for enablingpersonal
api's over HTTP (but please don't do this on mainnet, with real assets at stake).