I've got the following transaction's input:

    name: 'trade',
    types: [
    inputs: ['ac709fcb44a43c35f0da4e3163b117a17f3770f5',
        <BN: 878678326eac900000>,
        <BN: bf2aa18455018000>, 
        <BN: 302bdf>,
        <BN: dc51da3a>,
        <BN: 1c>,
        <Buffer b4 bf 0 d cd 37 ca 73 bd 5 a bc e9 53 2 b 03 3 d cc 64 27 be 16 06 83 de 11 3e fc a4 13 20 c2 7 f 3e>, 
        <Buffer 78 79 9 d 84 04 0e 5 c 24 58 28 b1 b5 31 ef 97 e1 af 12 49 46 f4 dc 1 d b5 a2 0 c f2 8 a 70 73 b2 69>, 
        <BN: 275dcc081d0c2351e0>

This data came from raw transaction input which is


How can I convert inputs to readable string values?

PS: by readable string values I mean converted values from BN and Buffer types to utf8 strings.

  • Can you explain where this data came from and what you're trying to get out? (What would "readable string values" look like?) – user19510 Feb 11 '18 at 10:37
  • @smarx I've updated my question, hope this more makes sense now :) – Erik Feb 11 '18 at 10:45
  • 2
    I'm still not sure what you mean. Does .toString() on the BNs and .toString('hex') on the Buffers do what you want? – user19510 Feb 11 '18 at 10:47
  • Let me check please – Erik Feb 11 '18 at 10:48

The tool ethereum-input-data-decoder, which you used to decode the encoded input data, returns uint types as Big Numbers and byte32 types as Buffers.

To convert to a readable format simply call the toString method.


// big number to decimal string

// buffer to hex string
| improve this answer | |

Here is one of the many ways to do it. For this method you need source code and address of the contract.

  1. Use either metamask or enter your custom web3 provider on online ide
  2. Compile your source code
  3. Enter address of deployed contract to load on ide
  4. Enable listen to the network radio button
  5. You will be able to read input of submitted transactions
| improve this answer | |

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.