Keystore API
Every node has a built-in keystore. Clients create users on the keystore, which act as identities to be used when interacting with blockchains. A keystore exists at the node level, so if you create a user on a node it exists only on that node. However, users may be imported and exported using this API.
You should only create a keystore user on a node that you operate, as the node operator has access to your plaintext password.
For validation and delegation on main net, you should issue transactions through the wallet. That way control keys for your funds won't be stored on the node, which significantly lowers the risk should a computer running a node be compromised.

Format

This API uses the json 2.0 API format. For more information on making JSON RPC calls, see here.

Endpoint

1
/ext/keystore
Copied!

Methods

keystore.createUser

Create a new user with the specified username and password.

Signature

1
keystore.createUser(
2
{
3
username:string,
4
password:string
5
}
6
) -> {success:bool}
Copied!
    username and password can be at most 1024 characters.
    Your request will be rejected if password is too weak. password should be at least 8 characters and contain upper and lower case letters as well as numbers and symbols.

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"keystore.createUser",
5
"params" :{
6
"username":"myUsername",
7
"password":"myPassword"
8
}
9
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!

keystore.deleteUser

Delete a user.

Signature

1
keystore.deleteUser({username: string, password:string}) -> {success: bool}
Copied!

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"keystore.deleteUser",
5
"params" : {
6
"username":"myUsername",
7
"password":"myPassword"
8
}
9
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{"success" : true}
5
}
Copied!

keystore.exportUser

Export a user. The user can be imported to another node with keystore.importUser. The user’s password remains encrypted.

Signature

1
keystore.exportUser(
2
{
3
username:string,
4
password:string,
5
encoding:string //optional
6
}
7
) -> {
8
user:string,
9
encoding:string
10
}
Copied!
encoding specifies the format of the string encoding user data. Can be either "cb58" or "hex". Defaults to "cb58".

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"keystore.exportUser",
5
"params" :{
6
"username":"myUsername",
7
"password":"myPassword"
8
}
9
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"user":"4CsUh5sfVwz2jNrJXBVpoPtDsb4tZksWykqmxC5CXoDEERyhoRryq62jYTETYh53y13v7NzeReisi",
6
"encoding":"cb58"
7
}
8
}
Copied!

keystore.importUser

Import a user. password must match the user’s password. username doesn’t have to match the username user had when it was exported.

Signature

1
keystore.importUser(
2
{
3
username:string,
4
password:string,
5
user:string,
6
encoding:string //optional
7
}
8
) -> {success:bool}
Copied!
encoding specifies the format of the string encoding user data . Can be either "cb58" or "hex". Defaults to "cb58".

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"keystore.importUser",
5
"params" :{
6
"username":"myUsername",
7
"password":"myPassword",
8
"user" :"4CsUh5sfVwz2jNrJXBVpoPtDsb4tZksWykqmxC5CXoDEERyhoRryq62jYTETYh53y13v7NzeReisi"
9
}
10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!

keystore.listUsers

List the users in this keystore.

Signature

1
keystore.ListUsers() -> {users:[]string}
Copied!

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"keystore.listUsers"
5
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"users":[
6
"myUsername"
7
]
8
}
9
}
Copied!
Last modified 2mo ago