I have two transaction, the first from MetaMask (everything is fine)
https://etherscan.io/tx/0x1ab684f4875f8cc28043d9f3c3536a5e4f8a565cadda7a29bc6a96db5f1d0f8f
the second using web3.py (it seems to be identical but fails)
https://etherscan.io/tx/0xc019007895cb7340f65c3bd80df5561c1b1a98d8eac6dc2babf776ab000de067
Here is my part of the code: (I hope it is clear what is going on - it is copied from a class)
# same as in the working one
abidata = '0x338b5dea000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f49800000000000000000000000000000000000000000000000000002d79883d2000'
trans = {
'to': self.address,
'from': self.ethapi.address,
'data': abidata,
'value': 0,
'chainId': 1}
# transaction gas data [pseudocode]
trans_new = trans.copy()
nonce = w3.eth.getTransactionCount(self.address)
gas_price = self.get_gas_price()
gas_price_wei = self.w3.toWei(gas_price,"Gwei")
trans_new["gas"] = 250000
trans_new["nonce"] = nonce
trans_new["gasPrice"] = gas_price_wei
signed_transaction = account.signTransaction(trans)
w3.eth.sendRawTransaction(signed_transaction.rawTransaction)
Thanks for any hint!
approve()
to allow ED to make a transfer from your address?ZrxToken.approve(EtherDelta.address, amount, { from: "YourAccount" })
, 2)EtherDelta.depositToken(ZrxToken.address, amount, { from: "YourAccount" })
.