importprivkey Method
Imports the private key to the wallet.
note
Before you can invoke this method you must:
Install the plugin RpcServer
Call the RPC method
openwallet
to open the wallet first.
#
Parameter Descriptionkey: The WIF-format private key.
#
Exception- -302, No opened wallet.
#
ExampleRequest body:
{ "jsonrpc": "2.0", "method": "importprivkey", "params": ["KwYRSjqmEhK4nPuUZZz1LEUSxvSzSRCv3SVePoe67hjcdPGLRJY5"], "id": 1}
Response body:
{ "jsonrpc": "2.0", "id": 1, "result": { "address": "NPvKVTGZapmFWABLsyvfreuqn73jCjJtN1", "haskey": true, "label": null, "watchonly": false }}
Response description:
Returns the address corresponding to the key.