Last modified: 2024-09-23
importprivkey Method
Imports the private key to the wallet.
Before you can invoke this method you must:
Install the plugin RpcServer
Call the RPC method
openwallet
to open the wallet first.
Parameter Description
key: The WIF-format private key.
Exception
-
-302, No opened wallet.
Example
Request 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.