I asked this question, and then I figured out the answer with help from folks here in this exchange.


I have contract functions that return a uint256 amount. This amount is related to the contract's balance. So it shows up in Wei (I guess), as a very large number, in Ethereum Wallet.

Can I return this number in Ether so that it shows up in a more friendly way in the Wallet and I don't risk messing up units in calculations? Or do I have to manually convert units and return a uint256 as divided by some constant?


Well, a function returns a value of a given type, for example, in this case, uint256.

The money units available in solidity are constants, and have no relation to the type system.

1 Answer 1


You can manually convert it once the contract function has returned the value with the web3 object.

For the old web3 object you can do web3.fromWei(weiValue, 'ether') where 'weiValue' is the value your contract function returns, to get the value as Ether.

For the new web3 object, version 1.0, it will be web3.utils.fromWei(weiValue, 'ether') where 'weiValue' is a string of the value your contract returns. Note you have to convert it to a string first. See: http://web3js.readthedocs.io/en/1.0/web3-utils.html#towei

  • Thanks for the answer, but there is a point missing and I would be very thankful if you could help as well: can I configure the Ethereum Wallet to read those values in friendlier way?
    – blue-dino
    Commented Jan 16, 2018 at 15:16
  • When you say Ethereum Wallet, are you referring to Mist?
    – willjgriff
    Commented Jan 16, 2018 at 22:20
  • I was using the default ethereum wallet. I don't know if it is mist; but I figured out what was wrong and I will edit the question and turn it into a KB page.
    – blue-dino
    Commented Jan 17, 2018 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.