DAO CLI
This document contains a comprehensive reference of Chia DAO CLI commands and options.
Chia DAOs are currently an alpha primitive. This means that DAOs are not yet ready for production use, but you can still test them on either a simulator or a testnet. We recommend against creating DAOs with this primitive on mainnet!
Prior to using the DAO alpha primitive, be sure to read the list of known issues.
Reference
add
Functionality: Create a wallet for an existing DAO
Usage: chia dao add [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which key to use |
-n | --name | TEXT | False | Set the DAO wallet name |
-t | --treasury-id | TEXT | True | The Treasury ID of the DAO you want to track |
-a | --filter-amount | INTEGER | False | The minimum number of votes a proposal needs before the wallet will recognise it [default: 1] |
-h | --help | None | False | Show a help message and exit |
Example
Start with a wallet with some XCH or TXCH:
chia wallet show
Response:
Chia Wallet:
-Total Balance: 1.0 txch (1000000000000 mojo)
-Pending Total Balance: 1.0 txch (1000000000000 mojo)
-Spendable: 1.0 txch (1000000000000 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
Next, join a DAO by passing in its Treasury ID:
chia dao add -n "Test DAO Wallet" -t dfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
At first, the response will indicate that the transaction is in process (you will need to choose your wallet fingerprint if more than one exists):
Adding wallet for DAO: dfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
This may take awhile.
Eventually, you will receive a message indicating the Treasury ID and the three relevant wallets that have been created:
Successfully created DAO Wallet
DAO Treasury ID: 0xdfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
DAO Wallet ID: 2
CAT Wallet ID: 3
DAOCAT Wallet ID: 4
At this point, you can show each of these wallets by running chia wallet show
:
chia wallet show
Wallet height: 3181174
Sync status: Synced
Balances, fingerprint: 3046374920
Chia Wallet:
-Total Balance: 1.0 txch (1000000000000 mojo)
-Pending Total Balance: 1.0 txch (1000000000000 mojo)
-Spendable: 1.0 txch (1000000000000 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
Test DAO Wallet:
-Total Balance: 1.0
-Pending Total Balance: 1.0
-Spendable: 1.0
-Type: DAO
-Treasury ID: dfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
-Wallet ID: 2
CAT 07e809aa0324acaf...:
-Total Balance: 0.0 (0 mojo)
-Pending Total Balance: 0.0 (0 mojo)
-Spendable: 0.0 (0 mojo)
-Type: CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 3
CAT 07e809aa0324acaf...:
-Total Balance: 0.0
-Pending Total Balance: 0.0
-Spendable: 0.0
-Type: DAO_CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 4
From here, you can add funds, create proposals, vote on proposals, etc.
add_funds
Functionality: Send funds to a DAO treasury
Usage: chia dao add_funds [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which key to use |
-i | --wallet-id | INTEGER | True | ID of the DAO Treasury Wallet |
-w | --funding-wallet-id | INTEGER | True | The ID of the wallet to send funds from (must be of type STANDARD_WALLET ) |
-a | --amount | TEXT | True | The amount of funds to send, in XCH |
-m | --fee | TEXT | False | Set the fees per transaction, in XCH [default: 0] |
--reuse, --reuse-puzhash | None | False | Set either of these flags to reuse the existing address for the change [default: not set] | |
--new-address, --generate-new-puzhash | None | False | Set either of these flags to generate a new puzzle hash / address for the change [default: not set] | |
-ma | --min-coin-amount, --min-amount | TEXT | False | Ignore coins worth less then this much XCH or CAT units |
-l | --max-coin-amount, --max-amount | TEXT | False | Ignore coins worth more then this much XCH or CAT units |
--exclude-coin | TEXT | False | Exclude the coin with this ID from being spent | |
--exclude-amount | TEXT | False | Exclude any coins with this XCH or CAT amount from being included | |
-h | --help | None | False | Show a help message and exit |
Example
Start by showing the current wallet status:
chia wallet show
Response:
Chia Wallet:
-Total Balance: 2.999987147234 txch (2999987147234 mojo)
-Pending Total Balance: 2.999987147234 txch (2999987147234 mojo)
-Spendable: 2.999987147234 txch (2999987147234 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
Profile 1:
-Total Balance: 1.0
-Pending Total Balance: 1.0
-Spendable: 1.0
-Type: DAO
-Treasury ID: dfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
-Wallet ID: 3
CAT 07e809aa0324acaf...:
-Total Balance: 100.0 (100000 mojo)
-Pending Total Balance: 100.0 (100000 mojo)
-Spendable: 100.0 (100000 mojo)
-Type: CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 4
CAT 07e809aa0324acaf...:
-Total Balance: 0.0
-Pending Total Balance: 0.0
-Spendable: 0.0
-Type: DAO_CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 5
Add funds from the main Chia Wallet (ID 1
) to the DAO Wallet (ID 3
).
Note that the Wallet IDs
shown here are only examples; yours may differ.
chia dao add_funds -i 2 --funding-wallet-id 1 -a 2 -m 0.00001
Response:
Transaction submitted to nodes: [{'peer_id': 'b3d9de85d29931c10050b56c7afb91c99141943fc81ff2d1a8425e52be0d08ab', 'inclusion_status': 'SUCCESS', 'error_msg': None}]
Run 'chia wallet get_transaction -f 3261611401 -tx 0x180ea0da4b8fbe4e696480ff5fa819fbcc8ae069362127c73cf09acecbd378c2' to get status
After a few minutes, verify that the transaction was processed successfully:
chia wallet get_transaction -f 3261611401 -tx 0x180ea0da4b8fbe4e696480ff5fa819fbcc8ae069362127c73cf09acecbd378c2
Response:
Transaction 180ea0da4b8fbe4e696480ff5fa819fbcc8ae069362127c73cf09acecbd378c2
Status: Confirmed
Amount sent: 2 TXCH
To address: txch179tr6euaunzt425l6kyrzgrzyzv572w7820ptan47k3w77x6267s09j0km
Created at: 2023-09-13 21:41:08
At this point, 2 TXCH has been removed from wallet 1
and added to wallet 3
, which can be verified by running balance
:
chia dao balance -i 2
Response:
XCH: 2.0
balance
Functionality: Get the asset balances for a DAO treasury
Usage: chia dao balance [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which key to use |
-i | --wallet-id | INTEGER | True | ID of the wallet to use |
-h | --help | None | False | Show a help message and exit |
Example
chia dao balance -i 2
Response:
XCH: 2.0
close_proposal
Functionality: Close a DAO proposal
Usage: chia dao close_proposal [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which key to use |
-i | --wallet-id | INTEGER | True | ID of the wallet to use |
-p | --proposal-id | TEXT | True | The ID of the proposal you are voting on |
-d | --self-destruct | None | False | If this flag is set, it will self-destruct a broken proposal, thus forcing to force it to close [default: not set] |
-m | --fee | TEXT | False | Set the fees per transaction, in XCH [default: 0] |
--reuse, --reuse-puzhash | None | False | Set either of these flags to reuse the existing address for the change [default: not set] | |
--new-address, --generate-new-puzhash | None | False | Set either of these flags to generate a new puzzle hash / address for the change [default: not set] | |
-ma | --min-coin-amount, --min-amount | TEXT | False | Ignore coins worth less then this much XCH or CAT units |
-l | --max-coin-amount, --max-amount | TEXT | False | Ignore coins worth more then this much XCH or CAT units |
--exclude-coin | TEXT | False | Exclude the coin with this ID from being spent | |
--exclude-amount | TEXT | False | Exclude any coins with this XCH or CAT amount from being included | |
-h | --help | None | False | Show a help message and exit |
Example
First, show the status of a proposal:
chia dao show_proposal -i 2 -p 0x372a3e3d7f502a542d3c926588b62d5ca580d4ff60a158740563470f2114ef2d
Response:
Details of Proposal: 0x372a3e3d7f502a542d3c926588b62d5ca580d4ff60a158740563470f2114ef2d
---------------------------
Type: SPEND
Status: OPEN
Passed: True
Closable: True
Proposal XCH Conditions
0x6ace2ea83d1db903c2fef0237e1cd71cae017fa79fb3eeec4af3c7fc6c25c16e 1000000000000
This proposal's status for Closable
is True
, so it can be closed. To do this, run the close_proposal
command:
chia dao close_proposal -i 2 -p 0x372a3e3d7f502a542d3c926588b62d5ca580d4ff60a158740563470f2114ef2d -m 0.0001
Response:
Submitted proposal close transaction with name: 0x17ff5206551600637d5e5ca57511cf9f0c3ce3dc66466c86102c9e2a8861618e
After the transaction has been confirmed on-chain, view the status of the proposal once again:
chia dao show_proposal -i 2 -p 0x372a3e3d7f502a542d3c926588b62d5ca580d4ff60a158740563470f2114ef2d
Response:
Details of Proposal: 0x372a3e3d7f502a542d3c926588b62d5ca580d4ff60a158740563470f2114ef2d
---------------------------
Type: SPEND
Status: CLOSED
Passed: True
Proposal XCH Conditions
0x6ace2ea83d1db903c2fef0237e1cd71cae017fa79fb3eeec4af3c7fc6c25c16e 1000000000000
This proposal is now closed. The treasury's balance prior to the proposal being created was 2.0 XCH. Verify that 1 XCH was deducted by showing the current balance:
chia dao balance -i 2
Response:
XCH: 1.000001
The extra 0.000001 XCH was added from the proposer's wallet, as a result of the --proposal-minimum
option being enforced on this DAO (see the create command for more details).
Another way to verify that the correct amount of XCH was spent from treasury is to show the recipient puzzle hash using the full_node RPC:
chia rpc full_node get_coin_records_by_puzzle_hash '{"puzzle_hash": "0x6ace2ea83d1db903c2fef0237e1cd71cae017fa79fb3eeec4af3c7fc6c25c16e"}'
Response:
{
"coin_records": [
{
"coin": {
"amount": 1000000000000,
"parent_coin_info": "0x9ffe88ae3b3ff4ae59524cf4ff200998ac68545d7918d6a3824d9781d0cb12b8",
"puzzle_hash": "0x6ace2ea83d1db903c2fef0237e1cd71cae017fa79fb3eeec4af3c7fc6c25c16e"
},
"coinbase": false,
"confirmed_block_index": 3186133,
"spent": false,
"spent_block_index": 0,
"timestamp": 1694663355
}
],
"success": true
}
create
Functionality: Create a new DAO wallet and treasury
Usage: chia dao create [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which key to use |
-n | --name | TEXT | False | Set the DAO wallet name |
--proposal-timelock | INTEGER | False | The minimum number of blocks before a proposal can close [default: 1000] | |
--soft-close | INTEGER | False | The number of blocks a proposal must remain unspent before closing [default: 20] | |
--attendance-required | INTEGER | True | The minimum number of votes a proposal must receive to be accepted | |
--pass-percentage | INTEGER | False | The percentage of 'yes' votes in basis points a proposal must receive to be accepted. 100% = 10000 [default: 5000] | |
--self-destruct | INTEGER | False | The number of blocks required before a proposal can be automatically removed [default: 10000] | |
--oracle-delay | INTEGER | False | The number of blocks required between oracle spends of the treasury [default: 50] | |
--proposal-minimum | INTEGER | False | The minimum amount (in xch) that a proposal must use to be created (this is a spam-prevention measure; it will be donated to the treasury when the proposal is closed) [default: 0.000000000001] | |
--filter-amount | INTEGER | False | The minimum number of votes a proposal needs before the wallet will recognise it [default: 1] | |
--cat-amount | INTEGER | True | The number of DAO CATs (in mojos) to create when initializing the DAO | |
-m | --fee | TEXT | False | Set the fees per transaction, in XCH [default: 0] |
--fee-for-cat | TEXT | False | Set the fees for the CAT creation transaction, in XCH [default: 0] | |
--reuse, --reuse-puzhash | None | False | Set either of these flags to reuse the existing address for the change [default: not set] | |
--new-address, --generate-new-puzhash | None | False | Set either of these flags to generate a new puzzle hash / address for the change [default: not set] | |
-ma | --min-coin-amount, --min-amount | TEXT | False | Ignore coins worth less then this much XCH or CAT units |
-l | --max-coin-amount, --max-amount | TEXT | False | Ignore coins worth more then this much XCH or CAT units |
--exclude-coin | TEXT | False | Exclude the coin with this ID from being spent | |
--exclude-amount | TEXT | False | Exclude any coins with this XCH or CAT amount from being included | |
-h | --help | None | False | Show a help message and exit |
Per singleton rules, --proposal-minimum
needs to be an odd number (in mojos). If you enter an even number, one mojo will automatically be added to this amount. You will then see the following message when creating the DAO:
Adding 1 mojo to proposal minimum amount
This command requires that you have at least two coins in your wallet: one to create the DAO and pay the blockchain fee, and one to mint the DAO CATs.
If you only have one coin, an error similar to the following will be shown:
ValueError: {'error': 'Transaction for 100000 is greater than spendable balance of 0. There may be other transactions pending or our minimum coin amount is too high.', 'success': False}
You can split one coin into multiple coins by running the chia wallet coins split command.
Example
This example will create a DAO with the following options:
- Proposals must exist for at least 10 blocks before being closed (
--proposal-timelock 10
) - Proposals must be unspent for at least 2 blocks before being closed (
--soft-close 2
) - At least 1000 votes ('yes' and 'no' combined) must be received before a proposal can pass (
--attendance-required
) - At least 50% of votes must be 'yes' in order for a proposal to pass (
--pass-percentage 5000
) - At least 10 blocks must pass before a proposal can be removed (
--self-destruct 10
) - At least 5 blocks must pass between oracle spends of the treasury (
--oracle-delay 5
) - One million mojos will be donated to the treasury upon completion of a proposal. This prevents bad actors from spamming a DAO with untennable proposals (
--proposal-minimum 0.000001
) - At least 1 vote must be made for a proposal before the wallet will recognise it (
--filter-amount 1
) - One hundred thousand DAO CATs will be created initially (
--cat-amount 100000
) - A blockchain fee of 0.00001 XCH will be paid for the transaction that creates the DAO (
-m 0.00001
) - A second blockchain fee of 0.00001 XCH will be paid for the transaction that creates the DAO CATs (
--fee-for-cat 0.00001
)
chia dao create --proposal-timelock 10 --soft-close 2 --attendance-required 1000 --pass-percentage 5000 --self-destruct 10 --oracle-delay 5 --proposal-minimum 0.000001 --filter-amount 1 --cat-amount 100000 -m 0.00001 --fee-for-cat 0.00001
Response:
Creating new DAO
Adding 1 mojo to proposal minimum amount
Successfully created DAO Wallet
DAO Treasury ID: 0xdfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
DAO Wallet ID: 3
CAT Wallet ID: 4
DAOCAT Wallet ID: 5
Multiple on-chain transactions will be performed. This will take a few minutes.
To verify that the creation was successful, show your wallet:
chia wallet show
Response:
Chia Wallet:
-Total Balance: 2.999987147234 txch (2999987147234 mojo)
-Pending Total Balance: 2.999987147234 txch (2999987147234 mojo)
-Spendable: 2.999987147234 txch (2999987147234 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
Profile 1:
-Total Balance: 1.0
-Pending Total Balance: 1.0
-Spendable: 1.0
-Type: DAO
-Treasury ID: dfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
-Wallet ID: 3
CAT 07e809aa0324acaf...:
-Total Balance: 100.0 (100000 mojo)
-Pending Total Balance: 100.0 (100000 mojo)
-Spendable: 100.0 (100000 mojo)
-Type: CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 4
CAT 07e809aa0324acaf...:
-Total Balance: 0.0
-Pending Total Balance: 0.0
-Spendable: 0.0
-Type: DAO_CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 5
Recall from the DAO's creation response message that the primary DAO wallet's ID is 3
, the CAT wallet's ID is 4
, and the DAO CAT wallet's ID is 5
.
It is also possible to obtain the DAO's Treasury ID by calling get_id
and supplying the DAO wallet's ID. For example:
chia dao get_id -i 2
Response:
Treasury ID: 0xdfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
create_proposal
Functionality: Create and add a proposal to a DAO
There are currently three supported proposal types: spend some of the treasury, update the DAO rules, and mint more of the DAO's CAT.
mint
Functionality: Create a proposal to mint new DAO CATs
Usage: chia dao create_proposal [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which key to use |
-i | --wallet-id | INTEGER | True | ID of the DAO wallet to use |
-a | --amount | INTEGER | True | The amount of new cats the proposal will mint (in mojos) |
-t | --to-address | TEXT | True | The address new cats will be minted to |
-v | --vote-amount | INTEGER | True | The number of votes to add |
-m | --fee | TEXT | False | Set the fees per transaction, in XCH [default: 0] |
--reuse, --reuse-puzhash | None | False | Set either of these flags to reuse the existing address for the change [default: not set] | |
--new-address, --generate-new-puzhash | None | False | Set either of these flags to generate a new puzzle hash / address for the change [default: not set] | |
-ma | --min-coin-amount, --min-amount | TEXT | False | Ignore coins worth less then this much XCH or CAT units |
-l | --max-coin-amount, --max-amount | TEXT | False | Ignore coins worth more then this much XCH or CAT units |
--exclude-coin | TEXT | False | Exclude the coin with this ID from being spent | |
--exclude-amount | TEXT | False | Exclude any coins with this XCH or CAT amount from being included | |
-h | --help | None | False | Show a help message and exit |
The votes need to be minted from the treasury's funds, so your DAO will need to have sufficient funds to perform the minting.
Example
This example will show how to create a proposal to mint 100 DAO CATs and deliver them to another wallet.
First, a snapshot of the proposer's wallet:
chia wallet show
Response:
Chia Wallet:
-Total Balance: 0.999356147233 txch (999356147233 mojo)
-Pending Total Balance: 0.999356147233 txch (999356147233 mojo)
-Spendable: 0.999356147233 txch (999356147233 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
Profile 1:
-Total Balance: 1.0
-Pending Total Balance: 1.0
-Spendable: 1.0
-Type: DAO
-Treasury ID: dfe486693cddf312eae141688e72a0b5f597df152f7f30dcb7c775d0ffaa1a56
-Wallet ID: 3
CAT 07e809aa0324acaf...:
-Total Balance: 0.0 (0 mojo)
-Pending Total Balance: 0.0 (0 mojo)
-Spendable: 0.0 (0 mojo)
-Type: CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 4
CAT 07e809aa0324acaf...:
-Total Balance: 100000.0
-Pending Total Balance: 0.0
-Spendable: 0.0
-Type: DAO_CAT
-Asset ID: 07e809aa0324acaf274ce1bb1502d18b31236ac46739e90ebf0a042dbbd2c882
-Wallet ID: 5
The following command will be used to create the proposal:
chia dao create_proposal mint -i 2 -a 100000 -t txch1u7l0esj4jet6lc4uwm3qj3u3sgdh5y8h4msgl9g833907rrt4k6sj43nfx -v 1 -m 0.00001
Response:
Successfully created proposal.
Proposal ID: 0x6e11db5e6a94b9f4f867d968ae6f971e6fa4dca9b75ad0d54e0450ebdb1d3c3a
View the proposal:
chia dao show_proposal -i 2 -p 0x6e11db5e6a94b9f4f867d968ae6f971e6fa4dca9b75ad0d54e0450ebdb1d3c3a
Response:
Details of Proposal: 0x6e11db5e6a94b9f4f867d968ae6f971e6fa4dca9b75ad0d54e0450ebdb1d3c3a
---------------------------
Type: MINT
Status: OPEN
Passed: False
Yes votes needed: 499
Closable: False
Total votes needed: 999
Blocks remaining: 0
Amount of CAT to mint: 100000
Address: txch1u7l0esj4jet6lc4uwm3qj3u3sgdh5y8h4msgl9g833907rrt4k6sj43nfx