目前,我正在使用web.utils.isAddress函数检查ETH地址是否有效。是对的吗?
谢谢你的进阶。
发布于 2018-02-06 06:51:03
是啊!如果您使用的是web3版本1.x,那么web3.utils.isAddress是正确的方法。
https://web3js.readthedocs.io/en/1.0/web3-utils.html#isaddress
如果您使用的是较早版本(0.2x.x)的web3,那么web3.isAddress是确定给定的十六进制字符串是否为有效Ethereum地址的正确方法。
https://github.com/ethereum/wiki/wiki/JavaScript-API#web3isaddress
https://ethereum.stackexchange.com/questions/38694
复制相似问题