1

I already get the bytecode of a contract from web3 through this method: web3.eth.getCode(address), but I am having trouble decoding this code to a human readable form. How do I do it?

Take the OMG Token contract code as an example: https://etherscan.io/address/0xd26114cd6EE289AccF82350c8d8487fedB8A0C07#code

I was trying to convert the contract creation code in the bottom:

6003805460a060020a61ffff0219169055600060045560a0604052600860608190527f4f4d47546f6b656e000000000000000000000000000000000000000000000000608090815261005491600591906100c1565b506040805180820190915260038082527f4f4d4700000000000000000000000000000000000000000000000000000000006020909201918252610099916006916100c1565b5060126007555b60038054600160a060020a03191633600160a060020a03161790555b610161565b828054600181.............................................

to a human readable contract source code on the top.

1

There are no good proven solutions, however, you can try using a decompiler, see https://www.pnfsoftware.com/blog/ethereum-smart-contract-decompiler/.

Of course this isn't well tested, so I can't guarantee this will work.

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.