enter image description here

I receive the input data as the image shows. And when I try to decode it with the method:

String inputdata = null;

Optional<Transaction> tx = web3.ethGetTransactionByHash(txHash).send().getTransaction();

if (tx.isPresent()) {
    inputdata = tx.get().getInput();

byte[] bytes = Hex.decodeHex(inputdata.substring(2).toCharArray());
System.out.println(new String(bytes, "UTF-8"));

this is what I have in the output:

enter image description here

So I wanted to know if there is another way to decode or what am I doing wrong to decode it?

  • 2
    You would essentially need the ABI for the smart contract to do this. Without that, you don't know what the data types of the parameters are, so you can't decode them. – user19510 Jan 9 '19 at 3:59
  • 1
    I have the ABI file and the container, as well as having the contract envelope. Also in Rinkeby.etherscan.io add the contract code so that the input data can be decoded. – Nicolas Flores Muñoz Jan 9 '19 at 20:32
  • 1
    I don't know what a "container" or "contract envelope" mean in this context. But if you have the ABI, then you can accomplish this task, though I don't know how to do it in web3j. You may have to write your own code or dive into the ABI module. – user19510 Jan 9 '19 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.