1

I'm trying to make a sendTransaction json rpc call and I don't know how to calculate the data paramether.

From the documentation:

data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI

There is no specification how this should be made: the hash of the invoked method signature and encoded parameters

Tadej Vengust
  • 379
  • 4
  • 11

1 Answers1

0

Yes, there's an Application Binary Interface Specification

The Application Binary Interface is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Data is encoded according to its type, as described in this specification. The encoding is not self describing and thus requires a schema in order to decode.

There are several questions here about it:

Ismael
  • 30,570
  • 21
  • 53
  • 96
  • Yeah but I'm not trying to communicate with a contract just a simple eth transfer.. – Tadej Vengust Mar 28 '18 at 07:11
  • That is really easy, data should be empty. – Ismael Mar 28 '18 at 14:24
  • So its an none optional paramether but it has to be empty? – Tadej Vengust Mar 29 '18 at 18:23
  • 1
    Sorry, I didn't express myself correctly, I meant it can be empty. Usualy an empty data is enough, but you can embed any string there. Some application use data to embed a transaction id for example. – Ismael Mar 29 '18 at 20:31
  • Sorry, coming in late. Could you invoke another method from a smart contract (using the data field) thus deceiving the transfer the user thought it was signing? I am afraid after signing such a message. Or is it purely informative in the case of this kind of transaction? Thanks – Nre Nov 29 '21 at 22:18
  • @Nre It will be better if you create a new question for that. You can link to this one if it helps to set the context. – Ismael Nov 30 '21 at 04:37