Is there documentation and examples for using the personal api via JSON-RPC?
However it does not say what the method would be in JSON-RPC.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityIs there documentation and examples for using the personal api via JSON-RPC?
However it does not say what the method would be in JSON-RPC.
Ethereum's JSON-RPC spec https://github.com/ethereum/wiki/wiki/JSON-RPC doesn't contain the personal APIs, because the personal APIs are an extension by Geth.
The JSON-RPC spec represents what a compliant Ethereum client should implement.
@BokkyPooBah has linked to other helpful answers, which mention risks of managing accounts via JSON-RPC, and probably the reason why the spec doesn't advocate implementation of them by all compliant clients (such as cpp-ethereum, pyethapp).
The reason that the "personal" methods are not listed in the JSON-RPC spec is that they are not "official" API methods, i.e. they are not necessarily implemented across all clients.
What you're looking for is the GO-Ethereum client's management API, which includes the "personal" commands. Note that this only applies to geth, and is not necessarily supported in the same manner across all clients.
It is generally not recommended to expose these commands over RPC, since local applications can communicate via IPC, and RPC can be accessed by remote, possibly unauthorized clients, and because it is transmitted via plaintext HTTP, passwords should be handled carefully over it.
If you're sure you know what you're doing, you can enable RPC access to management commands using the --rpcapi
flag in geth.
Once they are enabled, you can access them the same way you would access any method over RPC, for example:
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["0x4bb96091ee9d802ed039c4d1a5f6216f90f81b01","myPassword"],"id":1}' localhost:8545`
The answers to your question are available in the following Q&As: