Loading...
Hello Folks,
So in this session we will be discussing about checksum addresses and to convert any ethereum address to checksum address using web3 from nodejs.
To do that we need to have web3 Node module installed on our system.
We can do this by running the following code on the cmd
npm install web3
Then let's run our node server. Just run the following code on cmd.
node
Then we need web3 module in our server so run the following code
var Web3 = require('web3')
we will be needing a Blockchain network to create an account so get an rpc url from here
Just click on the link -> Login to your account ->Click on ethereum on left side bar ->create project ->settings->keys->endpoints
and choose your respective testnet rpc url
rpc url it will look like this - https://kovan.infura.io/v3/your_api_key
var url = 'your RPC url here'
Then run this one
var web3 = new Web3(url)
Our Ethereum address, as well as every other Ethereum address in existence, has two versions - one that includes uppercase letters and one that doesn’t. These are called the checksummed and non-checksummed version. Here’s an example of the same address as a:
Checksummed addresses contain both uppercase and lowercase letters whereas the non-checksummed addresses contain either uppercase letters or lowercase letters
To convert an upper or lowercase Ethereum address to a checksum address.
we can use the following utility function
web3.utils.toChecksumAddress('your address here')
This will return the checksum version of the given address.
To check whether the given address is checksummed or not we can use this utility function
web3.utils.checkAddressChecksum('your address here')
This will return false if the given address is non-checked address.
So that's all for today's session.
For test ethers and link tokens. Click Here
For many more exciting tutorials keep following my username @BlockTalks_Raj
!!!!!HAPPY LEARNING!!!!