personal_replaceRawKey
Replaces the encrypted key file in the key store with the given unencrypted private key (hex string without leading '0x') or a Kaia wallet key, encrypting it with the new passphrase. It also receives the old passphrase to decrypt the old private key before replacement. If it is failed to decrypt, or can not find the matching account, it throws an error.
Returns the address of the replaced account if successful.
JSONRPC: personal_replaceRawKey
Request
- application/json
Body
Array [
]
params
undefined[]
required
The unencrypted private key (hex string without leading '0x') or a Kaia wallet key.
The passphrase to decrypt the old private key.
The passphrase to encrypt the new private key.
Responses
- 200
Return the address of the replaced account.
- application/json
- Schema
- Example (from schema)
Schema
error
object
The address of the replaced account.
{
"jsonrpc": "2.0",
"id": 0,
"error": {
"code": -32700,
"message": "Parse error",
"data": "string"
},
"result": "0xfa415bb3e6231f488ff39eb2897db0ef3636dd32"
}
- curl
- python
- nodejs
- java
- Curl
curl -X 'POST' \
'https://public-en-kairos.node.kaia.io' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"method": "personal_replaceRawKey",
"id": 1,
"jsonrpc": "2.0",
"params": [
"ba4a5bbc0dc57d6348047be71773686d1739bf0a5ac6ca4c390f0e4d596a09a6",
"hello@1234",
"hello@1234"
]
}'
- CURL
curl -L 'https://public-en-kairos.node.kaia.io/' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"method": "personal_replaceRawKey",
"id": 1,
"jsonrpc": "2.0",
"params": [
"0xcd87934ee007b7a458fa00dc0314fff8b2bd43b3071f46c820c379e483b4fd8e",
"df4=B@0@xe$d",
"gr8=B!0@uc$b"
]
}'