6

Is there documentation and examples for using the personal api via JSON-RPC?

I found this.

However it does not say what the method would be in JSON-RPC.

3

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).

3

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`
1

The answers to your question are available in the following Q&As:

  • Not all that useful other than seeing '{"jsonrpc":"2.0","method":"personal_newAccount","params":["password"],"id":1}' which shows that the rpc method format for personal calls. – ByronP Apr 18 '16 at 14:56
  • 1
    I also disagree with the idea that doing this is unsafe and thus not well documented. Many systems require this functionality and while I would not have it enabled by default I do think it should be more open and documented. – ByronP Apr 18 '16 at 14:58
  • I've been wondering about the safety, as enabling the RPC API over 127.0.0.1 only allows connections from the local machine, which is what the IPC API also provides access from. One difference is that the RPC API can be accessed from different web pages within the browser that the IPC API would be harder to get access to due to browser sandboxing. But in a controlled server environment, both the RPC API and IPC API provide the same access. This speedbump does however help protect users less familiar with the security implications of the JSON-RPC API. – The Officious BokkyPooBah Apr 18 '16 at 15:22
  • One of the issues is that passwords sent over RPC are not encrypted, so using the personal commands could leave passwords visible if you're not careful – Tjaden Hess Apr 20 '16 at 4:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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