Ich habe zwei Transaktionen, die erste von MetaMask (alles ist in Ordnung)
https://etherscan.io/tx/0x1ab684f4875f8cc28043d9f3c3536a5e4f8a565cadda7a29bc6a96db5f1d0f8f
die zweite mit web3.py (scheint identisch zu sein, schlägt aber fehl)
https://etherscan.io/tx/0xc019007895cb7340f65c3bd80df5561c1b1a98d8eac6dc2babf776ab000de067
Hier ist mein Teil des Codes: (Ich hoffe, es ist klar, was los ist - es wird aus einer Klasse kopiert)
# 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)
Danke für jeden Hinweis!
Wie von Ismael in den obigen Kommentaren vorgeschlagen, war mein Fehler, dass MetaMask zwei Transaktionen durchgeführt hat. Das erste war also eine Genehmigung, die fehlte.
Ismael
approve()
, um ED eine Überweisung von Ihrer Adresse zu ermöglichen?Michael Razum
Michael Razum
Ismael
ZrxToken.approve(EtherDelta.address, amount, { from: "YourAccount" })
, 2)EtherDelta.depositToken(ZrxToken.address, amount, { from: "YourAccount" })
.Michael Razum
Michael Razum