Management APIs¶
In addition to implementing the standard JSON-RPC API, Ethereum clients, such as Geth and OpenEthereum provide additional management via JSON-RPC.
One of the key common pieces of functionality that they provide is the ability to create and unlock Ethereum accounts for transacting on the network. In Geth and OpenEthereum, this is implemented in their Personal modules, details of which are available below:
Support for the personal modules is available in web3j. Those methods that are common to both Geth and OpenEthereum reside in the Admin module of web3j.
You can initialise a new web3j connector that supports this module using the factory method:
Admin web3j = Admin.build(new HttpService()); // defaults to http://localhost:8545/
PersonalUnlockAccount personalUnlockAccount = admin.personalUnlockAccount("0x000...", "a password").send();
if (personalUnlockAccount.accountUnlocked()) {
// send a transaction
}
For Geth specific methods, you can use the Geth connector, and for OpenEthereum you can use the associated
OpenEthereum connector. The Parity
connector also provides support for OpenEthereum's Trace module. These connectors are available in the web3j geth and parity modules respectively.
You can refer to the integration test ParityIT for further examples of working with these APIs.