So, the question is in the title, let me describe scenario:

I make raw rpc call via method eth_call to contract Token to a function name to get token name of type string. Below is my original response and some metrics:

Original response: 0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000557494e4753000000000000000000000000000000000000000000000000000000
Length of response (with 0x prefix): 194
Formatted uncut response:               // just whitespace
Formatted cut response (only last 32 bytes): WINGS
Unused bytes (first 64 bytes): 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005

It would be great to understand what lays in those first 64 bytes and how is it calculated.

First I thought that it is somehow related to RLP, but I didn't find any evidence of that, so this is just my assumption.

Thanks for help.

P.S.: For formatting I used this answer.

  • 2
    I think you're looking for ABI encoding: solidity.readthedocs.io/en/v0.4.25/abi-spec.html. – smarx Nov 6 '18 at 17:37
  • Thanks for the link, @smarx. This is really it. Looks like the first bytes32 is just the location of the data and the second bytes32 is the length of the data in bytes. – Roman Frolov Nov 6 '18 at 17:46
  • Yup, you got it. – smarx Nov 6 '18 at 17:46
  • Appreciate your help, @smarx. I will be glad to accept your answer if you don't mind to publish it. – Roman Frolov Nov 6 '18 at 17:49

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.