Web3.js: How to determine if an Ethereum address exists

Created on 19 Dec 2018  路  3Comments  路  Source: ChainSafe/web3.js

I tested the interface 'getAccounts',return an empty array.

support

Most helpful comment

@TinyWJL All addresses exist. Do you mean is there a way to know if someone owns a private key that maps to a particular address?
Or if you want to check if a given string is a valid Ethereum address or not you can use web3.utils.isAddress(); which returns boolean.

More info about it can be found here.

All 3 comments

@TinyWJL which getAccounts method are you calling, web3.eth.getAccounts() or web3.eth.personal.getAccounts()`?

According to the documentation the method returns a Promise<array> so an empty array suggests that the node does not control any accounts.

@TinyWJL All addresses exist. Do you mean is there a way to know if someone owns a private key that maps to a particular address?
Or if you want to check if a given string is a valid Ethereum address or not you can use web3.utils.isAddress(); which returns boolean.

More info about it can be found here.

Closed because of the ongoing clean up of the issue list. Feel free to ask this in our gitter channel or on stackoverflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

connectdotz picture connectdotz  路  3Comments

zamoore picture zamoore  路  3Comments

praveengupta0895 picture praveengupta0895  路  3Comments

sundbry picture sundbry  路  3Comments

SCBuergel picture SCBuergel  路  3Comments