2

Function: execute(address _to, uint256 _value, bytes _data) ***

MethodID: 0xb61d27f6 [0]:0000000000000000000000001dba1131000664b884a1ba238464159892252d3a [1]:00000000000000000000000000000000000000000000028b78bf6bd677fe7c17 [2]:0000000000000000000000000000000000000000000000000000000000000060 [3]:0000000000000000000000000000000000000000000000000000000000000000 [4]:0000000000000000000000000000000000000000000000000000000000000000

I am looking at the following data above, i understand that line 0 somehow translates into the reveicing address, can someone show me how the translation is done? The second value is the amount to send i believe, can someone explain how this one translates into the correct amount?

Ive been trying to translate it from hex, but im clearly not understanding it.

2

You can use ethereumjs-abi to decode the transaction parameters

const abi = require('ethereumjs-abi');

const data = Buffer.from([
    '0000000000000000000000001dba1131000664b884a1ba238464159892252d3a',
    '00000000000000000000000000000000000000000000028b78bf6bd677fe7c17',
    '0000000000000000000000000000000000000000000000000000000000000060',
    '0000000000000000000000000000000000000000000000000000000000000000',
    '0000000000000000000000000000000000000000000000000000000000000000'].join(''), 'hex');

const decoded = abi.rawDecode(['address', 'uint256', 'bytes'], data);

console.log(`Decoded: ${JSON.stringify(decoded, null, '  ')}`);

The output is

Decoded: [
  "1dba1131000664b884a1ba238464159892252d3a",
  "28b78bf6bd677fe7c17",
  {
    "type": "Buffer",
    "data": []
  }
]

Which means

  • _to: 0x1dba1131000664b884a1ba238464159892252d3a
  • _value: 0x28b78bf6bd677fe7c17
  • _data: [] (empty array)
| improve this answer | |
-1

What you're looking at is the transactionObject. You can see how the transactionObject is being used in the following example with web3.js:

transactionObject = {
  from: sender,
  to: receiver,
  value: amount
}

source: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendtransaction

But there are more than just 3 potential variables, as you can see in the link above.

| improve this answer | |
  • This is contract ABI data - it's completely different from the web3.js transaction object. – benjaminion Aug 19 '17 at 20:27

Your Answer

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

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