blockchain - web3 - 对ETH地址进行转换和验证 大小写 uppercase downcase address capital

访问量: 291

refer to: https://ethereum.stackexchange.com/questions/2045/is-ethereum-wallet-address-case-sensitive

ETH网络: 大小写不敏感

唯一作用: 看到大写的时候往往都是 待验证的地址

如下:

> Web3.utils.toChecksumAddress("0x03fB09251eC05ee9Ca36c98644070B89111D4b3F".toLowerCase());
'0x03FB09251eC05ee9Ca36c98644070B89111D4b3F'
> Web3.utils.toChecksumAddress("0x03fB09251eC05ee9Ca36c98644070B89111D4b3f".toLowerCase());
'0x03FB09251eC05ee9Ca36c98644070B89111D4b3F'
> Web3.utils.toChecksumAddress("0x03fB09251eC05ee9Ca36c98644070B89111D4b3e".toLowerCase());
'0x03Fb09251ec05eE9CA36c98644070B89111D4b3e'
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3f".toLowerCase());
true
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3F".toLowerCase());
true
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3F");
true
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3f");
false
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3e");
false
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3E");
false

订阅/RSS Feed

Subscribe