Imports the private key to the wallet.
- Install the plugin RpcServer
- Call the RPC method
openwallet
to open the wallet first.
{
"jsonrpc": "2.0",
"method": "importprivkey",
"params": [key],
"id": 1
}
- key: The WIF-format private key.
Request body:
{
"jsonrpc": "2.0",
"method": "importprivkey",
"params": ["L5c6jz6Rh8arFJW3A5vg7Suaggo28ApXVF2EPzkAXbm94ThqaA6r"],
"id": 1
}
Response body:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"address": "Ad8S24trcuchyLfEbJWqRP7BUScUT4t2pw",
"haskey": true,
"label": null,
"watchonly": false
}
}
Response description:
Returns the address corresponding to the key.