0

In other words, say In Python I have something like that:

signed_txn = w3.eth.account.signTransaction(dict(
    nonce=w3.eth.getTransactionCount('0x0000000000000000000000000000000'),
    gasPrice = w3.eth.gasPrice, 
    gas = 100000,
    to='0x000000000000000000000000000000000',
    value=w3.toWei(0,'ether'),
data='a9059cbb000000000000000000000000583031d1113ad414f02576bd6afabfb302140225000000000000000000000000000000000000000000000000000000000000000c'
  ),
  '0000000000000000000000000000000000000000000000000000000000001')

w3.eth.sendRawTransaction(signed_txn.rawTransaction)

the "data" element above simply holds a sha3 conversion of the transfer function + its 2 arguments (send address and amount), as described by this chap here:

https://medium.com/swlh/understanding-data-payloads-in-ethereum-transactions-354dbe995371

I simply need a way to send the function call to contract via 'simple' way in bytes that I can get from Remix, instead of manually writing the call programically? Thanks!

2
  • I found this on chinese website, apparantly i am on the right track which leads to a new question - do i need to put '0x' in the beginning of data? jianshu.com/p/496c9d833df9
    – Robert Ggg
    Nov 4, 2019 at 19:10
  • Yes, because that is hex-encoded data. Apr 10, 2020 at 11:17

1 Answer 1

0

The to need to be the contract address. And yes, data has to start with 0x.

Your Answer

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

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