0

Currently, I am working on a project, I'll get Oracalize response bytes32 string as a hex string. How can I construct hex string back to bytes32 in solidity?

For eg: string value= "0x2a1acd26847576a128e3dba3aa984feafffdf81f7c7b23bdf51e7bec1c15944c"

I want byes32: bytes32 _value=0x2a1acd26847576a128e3dba3aa984feafffdf81f7c7b23bdf51e7bec1c15944c

  • Sending a 32-bytes values as strings to a contract and then converting it in Solidity may not be the best idea - basically it's wasted gas. Can you arrange receiving bytes32 or uint256 instead? Same number o bytes, but much cheaper gas-wise. – Utgarda Sep 15 '18 at 16:26
  • I've done the conversion to bytes in another question ethereum.stackexchange.com/a/40247, it should not be hard to use bytes32 instead. – Ismael Sep 15 '18 at 21:51

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.