Linked Questions

1 vote
1 answer
775 views

How convert hex number to decimal in solidity? [duplicate]

I would like to convert a hex number to decimal.
Amirali Sahraei's user avatar
3 votes
0 answers
54 views

Solidity hex literal on variable [duplicate]

In solidity, I can take advantage of the hex literal in order to get back the corresponding hex value of a string, in the following way: hex"001122FF" I am wondering how to apply such ...
Riccardo Perego's user avatar
0 votes
0 answers
41 views

Solidity: Convert hex-string variable into bytes [duplicate]

I am looking for an option to efficiently convert a string passed to a function as a parameter, interpreted as hex, into bytes. In Solidity. I.e. doing the same that this piece of code would do bytes ...
Xenonite's user avatar
  • 214
5 votes
3 answers
3k views

Converting from bytes in 0.5.x?

I'd like to convert bytes into any other type. I.e. "0x57D80C61128d608857d5310BB514223Bb6011CAB" into the address 0x57D80C61128d608857d5310BB514223Bb6011CAB, "5" into the uint256 5 and so on. I have ...
FlashyQpt's user avatar
0 votes
1 answer
1k views

Compute address of public key string in Solidity

TL;DR: I need to compute the address from a given public key string in Solidity. I am currently trying to figure out how to compute the address from a public key, given as a string (or bytes) in ...
Xenonite's user avatar
  • 214
0 votes
1 answer
2k views

Convert Hex String to Bytes32

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= "...
Jitendra Kumar. Balla's user avatar
0 votes
1 answer
302 views

Read String as bytes (Oraclize callback)

I have an Oraclize call that returns the following (a string): "00000000000000000000000000000000000000000000000000000000000003e8" Now this is 1000 (bytes32 hex) You can check here: https://www....
thefett's user avatar
  • 3,813
0 votes
0 answers
272 views

convert a hex string to bytes32[] using web3js

I have a string thats 64 characters long and I need to convert it into a bytes32[] to be passed into a contract method call. How can I do it using web3js? I tried using hexToBytes in the utils package ...
blockers's user avatar
0 votes
0 answers
177 views

Can string be changed to equivalent bytes and bytes32 in solidity?

I was wondering if it is possible to convert a string to a bytes32 or bytes in solidity like this, I want an input in string and require an equivalent bytes32 and bytes both. input string = "...
Pooja M Gupta's user avatar
1 vote
1 answer
107 views

Not sure why keccak hashing of encodePacked address and bytes not equal

address addr1 = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8; bytes memory addr2 = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"; require(keccak256(abi.encodePacked(addr1)) == ...
basketball9's user avatar