How to list wallet names through api?

I amcurrently using the c# api wrapper Chia-Client-API

the wrapper basically implements the rpc commands from the official documentation.
I can use the following command:

chia rpc wallet get_public_keys

Response:

{
    "public_key_fingerprints": [
        2104826454,
        3792481086,
        2818719465,
        2121994410
    ],
    "success": true
}

but this only returns the machine-readable fingerprints. How can I obtain the human-readable names someone may have specified in the wallet?
are they located somewhere in a file?

Somehow the chia client manages to do that:

I have found the following cmd command but no corresponding rpc yet:

chia keys label show

Unfortunately, we don’t have a direct RPC call to show the same info as the chia keys label show CLI command. The reference wallet GUI obtains those labels from the OS keyring.

One way you can obtain this info is by connecting to the daemon over a websocket by using wscat:

wscat -n --cert ~/.chia/mainnet/config/ssl/daemon/private_daemon.crt --key ~/.chia/mainnet/config/ssl/daemon/private_daemon.key -c wss://localhost:55400

From there, you can use the get_keys command, similar to the following example (the request_id can be any string):

{"ack": false, "command": "get_keys", "data": {}, "destination": "daemon", "origin": "client", "request_id": "43dc226cef76963ddd56c7068972947f373918c24b0fdf5bfa767a1340271da6"}

This command will return a payload with all of the pubkeys/fingerprints/labels – private keys omitted.

If you want the private keys included, pass "include_secrets":true in the data object. For example:

{"ack": false, "command": "get_keys", "data": {"include_secrets":true}, "destination": "daemon", "origin": "client", "request_id": "43dc226cef76963ddd56c7068972947f373918c24b0fdf5bfa767a1340271da6"}

1 Like

hmm is this also possible with the rest api?

wss wont work with .net c# so far.

Sorry but unfortunately you currently can only use wss if you need to obtain the labels. If you only need the fingerprints, you can use the get_public_keys RPC.