-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth.getBalance() returns nonsensical value when called without parameters #197
Comments
Thanks for submitting this. I just checked and when you call
Interestingly GO is returning:
So i guess the problem here is on the go side, which should return |
Even if there is an issue with the underlying implementation, it's not good that web3.js assumes to fill in "0x0000000000000000000000000000000000000000" when a required parameter is missing In the scenario you described, the user would execute an invalid |
Nope Fun fact, someone send that amount to the zero'd address :-) It's correct that a nothing address defaults to the zero'd address (on the go implementation). This doesn't mean that web3.js should allow it. |
so its not a bug? |
No, not a bug. See ethereum/go-ethereum#919 |
@frozeman What are your thoughts on having this method return the balance of all accounts when called without a parameter? It would be nice to have a slightly easier way than defining the checkAllBalances() function each time you start geth |
@tgerring that's not a bad idea actually. I agree that undefined should be treated differently than 0, but this would even be better.. |
@frozeman @tgerring @alexvandesande that's something that we can easily add to geth. We already have startup js files. Feel free to send a PR on go-ethereum that includes this method. |
I agree, get all balances etc, are not part of the API, this a simple scripts one can write, which we can add to the geth console |
According to https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgetbalance, eth.getBalance() requires the account as first parameter, however, when calling without any, it returns a very large number that doesn't appear to correspond to the actual account balances.
I would expect to return an error indicating that the first parameter is required when missing or make it print total of all account balances.
The text was updated successfully, but these errors were encountered: