Multi-owner dapp deployment and updates
This guide provides step-by-step instructions for deploying and updating decentralized applications (dapps) on Chromia using multiple private keys and voter sets. Multi-owner configurations enhance decentralization by requiring consensus among dapp providers.
Prerequisites
- A deployed dapp container on Chromia
- Access to Chromia CLI tools (e.g.,
pmc
,chr
) - Public keys for all intended dapp providers
Steps for multi-owner deployment
1. Create a container lease
- Navigate to staking.chromia.com to create a container lease.
- Use the specifications required for your dapp.
2. Configure voter sets
- Promote others to dapp providers:
chr deployment voterset add-dapp-provider
- To include additional members in the voter set without promoting them to dapp providers:
chr deployment voterset list
chr deployment voterset update -vs <voter set name> --add-members <pk1>,<pk2>
3. Set the voting threshold
Adjust the number of approvals required for proposals to pass:
chr deployment voterset update -vs <voter set name> --threshold <int>
The threshold is calculated as a fraction of total members. For example, setting the threshold to 2
in a set of 3
members requires two-thirds approval.
Steps for updating a dapp
- Initiate an update:
pmc blockchain update
- For multi-owner dapps, ensure all required votes are collected:
pmc proposal vote --accept --id <proposal ID>
Steps for managing proposals
- List pending proposals:
chr deployment proposal list
- Vote on a proposal:
chr deployment proposal vote --id <proposal ID> --accept
- Withdraw an incorrect proposal (must be done by the creator):
chr deployment proposal revoke --id <proposal ID>
Example configurations
Single-provider configuration
$ pmc voterset info --name chain_of_alliance
╭─────────────┬────────────────────────────────────────────────────────────────────╮
│ Voter set │ chain_of_alliance │
├─────────────┼────────────────────────────────────────────────────────────────────┤
│ Threshold │ 1 │
├─────────────┼────────────────────────────────────────────────────────────────────┤
│ Member 0 │ 02FEA5C0D8396B38C50200F2A583DCC8ED23416B9F9700A4AA435D57865939A536 │
╰─────────────┴────────────────────────────────────────────────────────────────────╯
Multi-provider configuration
$ pmc voterset info --name chain_of_alliance
╭─────────────┬────────────────────────────────────────────────────────────────────╮
│ Voter set │ chain_of_alliance │
├─────────────┼────────────────────────────────────────────────────────────────────┤
│ Threshold │ 2 │
├─────────────┼───────────────────────── ───────────────────────────────────────────┤
│ Member 0 │ 02FEA5C0D8396B38C50200F2A583DCC8ED23416B9F9700A4AA435D57865939A536 │
│ Member 1 │ 0250648F440B481A2E9AD30FD7A34EDFCF698F9D2C4ADD33B3B4836B114CCBEF9E │
╰─────────────┴────────────────────────────────────────────────────────────────────╯
$ pmc container info --name coa
╭──────────────┬────────────────────────────────────────────────────────────────────────────────╮
│ Deployer: │ chain_of_alliance │
├──────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ Threshold: │ 2 │
╰──────────────┴────────────────────────────────────────────────────────────────────────────────╯
In this setup, both providers must approve updates to the dapp.