I've read many times that you should never input an address by hand unless you want to accidentally send Ether into no-mans-land. I'd like to know what those checksums might be. Is there a way to tell a typo is occurred? how, and what are the formatting rules to it? Im asking so I can potentially create a wrapper function that checks for these things before submitting to the network.
[Ethereum] How to check if an Ethereum address is valid
addresseschecksumetherpublic-key
Best Answer
Using a Library
Libraries like web3.js and ethers have
isAddress()
.Examples:
ethers.utils.isAddress('0x8ba1f109551bd432803012645ac136ddd64dba72');
// trueweb3.utils.isAddress('blah');
// falseThe following is an answer from 2016.
Regular Address
EIP 55 added a "capitals-based checksum" which was implemented by Geth by May 2016. Here's Javascript code from Geth:
ICAP Address
ICAP has a checksum which can be verified. You can review Geth's icap.go and here's a snippet from it: