I have been using Web3.py, and Web3's TestRPCProvider to create some utility functions in Python to deploy a smart contract meant to generate an ERC20 Token, and then communicate with that smart contract to transfer funds. I would now like to try it on Infura's Ropsten test network. I created a wallet on the network using MyEtherWallet, and used web3 with the private/public keys of the wallet to build and sign the transaction necessary to deploy the ERC20 contract, however I am getting this error

ValueError: {'code': -32000, 'message': 'insufficient funds for gas * price + value'}

My question is this since it is a test network, is there a way to generate test Ropsten ether in my new wallet using Web3.py or MyEtherWallet? To me it seems a little more pointless to use a test network if you have to top up your account with real money anyway.

Code "As method of class"

def deploy(self):
    instance = self.w3.eth.contract(abi=self.abi, bytecode=self.bin)

    construct_txn = instance.constructor().buildTransaction({
        'from': self.pub,
        'value': 0,
        'gas': 100000,
        'gasPrice': w3.eth.gasPrice,
        'nonce': self.w3.eth.getTransactionCount(self.pub),

    signed = self.acct.signTransaction(construct_txn)
    tx_hash = self.w3.eth.sendRawTransaction(signed.rawTransaction)
  • It's not clear to me- are you testing it on Ropsten testnet using Infura or on your RPC client? If it's the Ropsten testnet, then there's already an answer by @aquila, if it's your local testnet, then please edit the question.
    – DaveIdito
    Commented Oct 20, 2018 at 10:26

1 Answer 1


You can ask somebody to transfer ethers to your address or try to use faucets like https://faucet.metamask.io/ https://faucet.ropsten.be/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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