Checksums are a method of capitalizing certain characters in an address for a specific EVM network. This includes Ethereum, Ethereum testnets, RKS, and its testnet. It is meant for users to confirm that an address is for a specific network. Once passed to a web3 provider, server, or blockchain, checking the checksum is no longer needed.
Take a look at the following addresses:
0x3Dd03d7d6c3137f1Eb7582Ba5957b8A2e26f304A // Ethereum 0x3DD03d7d6c3137f1EB7582bA5957b8A2e26F304A // RSK Mainnet 0x3dD03d7d6c3137f1Eb7582bA5957B8a2E26f304A // RSK Testnet
The characters in the address are exactly the same, but the capitalization is different. They are all the same address but for different networks.
The checksummed address exists for human users when copying and pasting an address, or entering an address into a field. When a dapp, running in RSK Testnet, is handed an address that is checksummed for RSK Mainnet, it should prompt the user that the address is formatted for the wrong network. The user can then fix the error or, if the address is correct, convert the address to lowercase. All web providers will accept a lowercase address and in some cases will only accept an address if it is lower.
When would an address be correct, but encoded for the wrong network?
Metamask web wallet for example only encodes addresses for Ethereum. When coping an address from Metamask it will always be checksummed for Ethereum.
How to calculate it
To create a checksummed address, the address and chainId can be passed to this function. It loops through the characters in the string and capitalizes letters based on the chainId. The exact method goes beyond the scope of this document, however, you can learn more by checking out the resources below or take a look at this implementation.
Convert the address to lowercase
The user has corrected the checksummed error or has confirmed that the address is correct. The address should be converted to lowercase to be sent to a contract or the web3 wallet. There is no need to check the address again as it has been confirmed as valid.
Let’s say the address is passed around our dapp and used in multiple places. The user has already confirmed that the address is correct so there is no need to convert it to a checksummed version.
Checksums are for humans, not computers.