I have a web3.py project that is successfully performing basic tasks (read from blockchain, send tx, process data, etc.). It is connected to a remote server that is running an ETH node, a Rinkeby node, and an ETC node. The project works perfectly using the web3.py auto detection.

When I switch to Web3(Web3.HTTPProvider("")), I am having an issue only when I try to send a transaction. I can use this HTTPProvider and still read all the correct data, such as addresses, balances, nonce, etc. The only thing I error out on is when I run sendTranscation(). The error I am receiving is:

{'code': -32000, 'message': 'no key for given address or file'}

I assume this has something do with my key, but I cannot imagine what. The directory in my server is completely normal (~/.ethereum/keystore, ~/.ethereum/testnet/keystore, and ~/ethereum-classic/keystore). This doesn't totally make sense, though, because I can still read the nonce.

I am connecting to the server via SSH and the ~/.ssh/config file.

Do I need to point my connection to the correct keystore location? If so where in the stack do I do this?

  • The error is saying that the node you connected to doesn't have the private key for the address you want to send from. So it appears you are connecting to a different node than you thought (or don't have the private key imported). What happens if you use from web3.auto.http import w3? The automatic connection could be connecting to an unexpected node over IPC. – carver Nov 29 '18 at 18:43
  • @carver that seems to work. What exactly does adding the http do? And if I want to connect to a different port, how do I do that? – mypythonquestions Nov 30 '18 at 2:14
  • It works, as in you can send transactions? I would expect the web3.auto.http to work exactly the same as Web3(Web3.HTTPProvider('http://localhost:8545')). Unless you have the WEB3_HTTP_PROVIDER_URI environment variable set. – carver Nov 30 '18 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.