2

web3.isAddress (and other web3 methods such as toWei) works fine in the geth console, but when called from RPC (or IPC), it always returns

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"The method is_address does not exist/is not available"}}

web3 is enabled by default, but still i explicitly used --rpcapi web3. This is confirmed by socat

{"jsonrpc":"2.0","id":1,"result":{"admin":"1.0","debug":"1.0","eth":"1.0","miner":"1.0","net":"1.0","personal":"1.0","rpc":"1.0","txpool":"1.0","web3":"1.0"}}

i tried all possible combinations i can think of, such as web3_is_address. still no luck. any one can shed some light on this? Thanks.

2
  • how do you call it using rpc?
    – Badr Bellaj
    Jun 23, 2017 at 11:01
  • For example: curl -X POST --data '{"jsonrpc":"2.0","method":"web3_is_address","params":"0xafsdf","id":67}' http://localhost:8545
    – underst00d
    Jun 24, 2017 at 10:12

1 Answer 1

1

Acoording to the wiki, the isAddress function is not exposed over json rpc.

When using JS: You can make the call locally by installing the web3 node package (npm install web3) when using JS.

When not using JS: You can also take the regex from the web3 source and implement the function in your langauge of choice.

2
  • Thanks for the response. Yes, I read that wiki before. Some methods such personal.newAccount() are not listed in that wiki, but I can still call them from JSON RPC. That's why I thought util methods like isAddress() and toWei() should be available via JSON RPC as well. And yes, I can copy the regex but that would be my last resort.
    – underst00d
    Jun 24, 2017 at 10:09
  • Unfortunately I don't know about the possibility to call the function over json rpc.
    – nNickSize
    Jun 24, 2017 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.