0

Why does web3js 0.20.6 returns all-lowercase addresses on contract creation not a checksumed address?!

How to deal with this trouble?

0

You can use

web3.utils.toChecksumAddress

EDIT: Sorry, just saw you mean 0.20.6, so its:

web3.toChecksumAddress()
0

I think that was not supported in web3 0.x , try to implement the function by yourself

found this code hier eip-55

const createKeccakHash = require('keccak')

function toChecksumAddress (address) {
  address = address.toLowerCase().replace('0x', '')
  var hash = createKeccakHash('keccak256').update(address).digest('hex')
  var ret = '0x'

  for (var i = 0; i < address.length; i++) {
    if (parseInt(hash[i], 16) >= 8) {
      ret += address[i].toUpperCase()
    } else {
      ret += address[i]
    }
  }

  return ret
}

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.