I'm trying to convert a hashed block number "30054a" into readable format but I'm getting logs something like this:


For another hashed value:


I'm using the following code on my NodeJS server:

const util = require('ethjs-util'); const value = util.toAscii('30054a'); console.log(value);

I had even tried toUtf8. I'm using ethjs library.

Where am I wrong?


You said the value is "hashed," but I think you're just looking at the hexadecimal number?

If so, parseInt('30054a', '16') == 3147082. 3147082 is the decimal representation of the hexadecimal number 0x30054a.

If you actually have a value that's been hashed, there's generally no way to reverse that process. (A cryptographic hash function is designed to be one-way.)

  • What about hexadecimal string, object or function? – Sowmay Jain May 2 '18 at 5:03
  • I tried converting this cded53d631ce4a38a1f90d59e5f2f9c023cd28c64aa66488e9462cc4a64a032f using web3.toAscii(). It returned - ÍíSÖ1ÎJ8¡ù YåòùÀ#Í(ÆJ¦déF,ĦJ/ – Sowmay Jain May 2 '18 at 5:35
  • I didn't say anything about web3.toAscii. That would only be appropriate if the value you have came from an ASCII string. Where did those values come from? – user19510 May 2 '18 at 12:25
  • I called the etherscan API of event logs. All the key's field are in hexadecimal format. How can I convert it in readable format? – Sowmay Jain May 2 '18 at 13:34
  • Can you suggest any accurate article or course which explains the whole concept ot hexa to big number to whatever? – Sowmay Jain May 2 '18 at 13:36

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.