I'm trying to interact with smart contracts on the RSK Mainnet, and I'm getting this error...
Provided address "0xAb2d290b7a600f5eA8d5B933f6F15c867Fd7e60e" is invalid,
the capitalization checksum test failed,
or its an indirect IBAN address which can't be converted.
The address is obtained from RSK Explorer itself, so I'm not sure why web3.js has this error.
Please, could someone help me?
Thanks in advance!
Web3 contracts, also known as smart contracts, are crucial in today's blockchain ecosystem. They enable users to interact online via the blockchain and the many dapps in the Web3 realm. Further, they set the conditions for decentralized transactions without needing a centralized third-party authority for verification.
Step 1: Create web3 object and connect it with the Ganache. Before that check, Ganache is installed in the system. If Ganache is already installed then one would be able to see an HTTP URL that Ganache provides i.e. Step 3: Ganache can be controlled with the help of web3.
As per RSKIP-60, RSK network has its own checksum validation following EIP1191.
However, some tools and libraries still don't support EIP-1191.
Most Ethereum tools and libraries support EIP-155 only. web3.js is one of them, and it checks the checksum expecting an EIP-155 checksum.
Workarounds
(1) Convert the smart contract address to an all-lowercase string:
return new web3.eth.Contract(coinBackAbi, tokenObj.address.toString().toLowerCase());
Note that both EIP-155 and EIP-1191 define that all-lowercase addresses are to be treated as "skip checksum".
(2) Another approach is to use @rsksmart/rsk-utils
,
using this to convert the address to use the appropriate checksum:
// Ethereum --> use this for web3.js
toChecksumAddress ("0xAb2d290b7a600f5eA8d5B933f6F15c867Fd7e60e", null)
// RSK Mainnet
toChecksumAddress ("0xAb2d290b7a600f5eA8d5B933f6F15c867Fd7e60e", 30)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With