Skip to main content

DID CLI Reference

Note about Windows command escaping

This document will use Linux/MacOS RPC syntax. When running rpc commands on Windows, you'll need to escape all quotes with backslashes.

For example, here is a typical RPC command on Linux and MacOS:

chia rpc wallet create_new_wallet '{"wallet_type": "nft_wallet"}'

To run the same command on Windows, you need to escape the quotes, so it looks like this:

chia rpc wallet create_new_wallet '{\"wallet_type\": \"nft_wallet\"}'

Reference​

create​

Functionality: Create a DID wallet

Usage: chia wallet did create [OPTIONS]

Options:

Short CommandLong CommandTypeRequiredDescription
-wp--wallet-rpc-portINTEGERFalseSet the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml
-f--fingerprintINTEGERFalseSet the fingerprint to specify which wallet to use
-n--nameTEXTFalseSet the DID wallet name [default: None]
-a--amountINTEGERFalseSet the DID amount in mojos. Value must be an odd number. [default: 1]
-m--feeTEXTFalseSet the fees per transaction, in XCH. [default: 0]
-h--helpNoneFalseShow a help message and exit.
Example

Create a new DID:

chia wallet did create -n My_DID

Response:

Successfully created a DID wallet with name My_DID and id 2 on key 4288332900
Successfully created a DID did:chia:17jvhl9z8zj6jma2uxk4mqj22p90hfpf29svlvlyalu8ksyefsvpql7f403 in the newly created DID wallet

View your wallet and DID:

chia wallet show

Response:

Wallet height: 1117451
Sync status: Synced
Balances, fingerprint: 4288332900

Chia Wallet:
-Total Balance: 0.999989999992 txch (999989999992 mojo)
-Pending Total Balance: 0.999989999991 txch (999989999991 mojo)
-Spendable: 0.0 txch (0 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1

My_DID:
-Total Balance: 0.0
-Pending Total Balance: 1.0
-Spendable: 0.0
-Type: DECENTRALIZED_ID
-DID ID: did:chia:17jvhl9z8zj6jma2uxk4mqj22p90hfpf29svlvlyalu8ksyefsvpql7f403
-Wallet ID: 2

get_did​

Functionality: Get the DID and Coin ID for a DID wallet

Usage: chia wallet did get_did [OPTIONS]

Options:

Short CommandLong CommandTypeRequiredDescription
-wp--wallet-rpc-portINTEGERFalseSet the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml
-f--fingerprintINTEGERFalseSet the fingerprint to specify which wallet to use
-i--idINTEGERTrueID of the wallet to use
-h--helpNoneFalseShow a help message and exit.
Example

Get info for DID with ID 2:

chia wallet did get_did -i 2

Response:

DID:                    did:chia:17jvhl9z8zj6jma2uxk4mqj22p90hfpf29svlvlyalu8ksyefsvpql7f403
Coin ID: 0xe6c28c30c7dd2801a4cbfdb0e61186315ae9695dde0a75a6901c1394c3300db8

set_name​

Functionality: Get the DID and Coin ID for a DID wallet

Usage: chia wallet did get_did [OPTIONS]

Options:

Short CommandLong CommandTypeRequiredDescription
-wp--wallet-rpc-portINTEGERFalseSet the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml
-f--fingerprintINTEGERFalseSet the fingerprint to specify which wallet to use
-i--idINTEGERTrueID of the wallet to use
-n--nameTEXTTrueSet the DID wallet name
-h--helpNoneFalseShow a help message and exit.
Example

Set the name for Wallet ID 2 to New Name:

chia wallet did set_name -i 2 -n "New Name"

Response:

Successfully set a new name for DID wallet with id 2: New Name

Confirm changes:

chia wallet show

Response:

Wallet height: 1117563
Sync status: Synced
Balances, fingerprint: 4288332900

Chia Wallet:
-Total Balance: 0.999989999991 txch (999989999991 mojo)
-Pending Total Balance: 0.999989999991 txch (999989999991 mojo)
-Spendable: 0.999989999991 txch (999989999991 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1

New Name:
-Total Balance: 1.0
-Pending Total Balance: 1.0
-Spendable: 1.0
-Type: DECENTRALIZED_ID
-DID ID: did:chia:17jvhl9z8zj6jma2uxk4mqj22p90hfpf29svlvlyalu8ksyefsvpql7f403
-Wallet ID: 2

Connections:
Type IP Ports NodeID Last Connect MiB Up|Dwn
FULL_NODE 127.0.0.1 58444/58444 f40100b8... Jun 15 12:22:02 0.0|1.7
-Height: No Info -Hash: No Info -Trusted: True