4

I signed up for Infura and they gave me a URL for a node to talk to, like https://ropsten.infura.io/mytokenjsifejsij39kdjkjfdk. (The part beginning mytoken isn't my real token.)

I'd like to deploy and manage my contracts using Populus; How do I get it to connect? I tried setting the following in my populus.ini and various other permutations of port numbers, but when I try to connect to it, for example with populus chain init testnet, it results in socket.error: [Errno 111] Connection refused.

[chain:testnet]
rpc_host = https://ropsten.infura.io/mytokenjsifejsij39kdjkjfdk
is_external = True
provider = web3.providers.rpc.RPCProvider

Is it possible to connect to an Infura node from populus, and if so how should I configure it?

2

For versions of populus pre 1.5.0 the short answer is that you cant. This is due to an upstream bug in the gevent-http-client dependency in how it handles SSL certificates.

For versions >=1.5.0 you'd put this in your config file.

Note that the new configuration file format is JSON. Populus will try to upgrade your old configuration file for you automatically.

{
  "chains": {
    "testnet": {
      "chain": {"class": "populus.chain.ExternalChain"},
      "web3": {
        "provider": {
          "class": "web3.providers.rpc.HTTPProvider",
          "settings": {
            "endpoint_uri": "https://ropsten.infura.io",
          }
        }
      }
    }
  }
}

The default settings file that populus ships with provides a shorter way to do this with a pre-configured Infura web3 connection.

{
  "chains": {
    "testnet": {
      "chain": {"class": "populus.chain.ExternalChain"},
      "web3": {"$ref": "web3.InfuraRopsten"}
    }
  }
}

Let me know if this doesn't work for you. The populus Gitter channel is typically the fastest way to get answers for questions but I'm supportive of them being posted here as well :)

1

Can you try without your infura token?

i.e. simply:

rpc_host = https://ropsten.infura.io

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.