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)
print(tx_hash.hex())