Create a Multisig using CLI
Create a multisig using CLI
You may create a multisig on Stargaze using CLI if you prefer this to options like Keplr Multisig or DAO DAO. Follow the steps below to create your multisig and feel free to ask the Stargaze team for help if required.
Install starsd
starsd
First you'll need to get the starsd
binary. This is the program that is used to run the chain, as well as do a bunch of other useful things like signing transactions and managing keys. If you feel technically competent, checkout the source code on the Stargaze GitHub repository and build it yourself.
Otherwise, you can do it the easy way and download a pre-built binary. To do that, open a terminal and copy and paste the following:
Linux
This downloads the file and copies it to /usr/local
.
Mac
Build from source:
Verify it's working with:
You should see it respond with 1.0.0. Now you're ready to make some keys.
STARS address and pubkey
Note, we highly recommend that you use a ledger for this. All commands will assume you are using one.
Add your key (replace <your-key-name>
with your desired key name):
This should output some information about the key that was added, including your STARS address and pubkey.
Take note of your pubkey. We'll use it later to create the multisig. The pubkey looks like this: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A7KWJjHeJpLKwSC7lsPMeQYngdI87x5etEDoNtH5aHKW"}'
Each member of your team that wants to join a multisig should create a key, take note of their public keys, and share them with each other. Write them down in a list or in a shared document.
If you want to show your key info again: starsd keys show <your-key-name>
If you want to list all your keys: starsd keys list
Create the Multisig
To create the multisig, you'll need to add everyone's pubkey to the keyring:
Finally, when you have everyone's pubkey, you can create the multisig:
Note the --multisig-threshold
flag. This controls how many of the keys have to sign in order for a transaction to be valid. If the multisig
account had a threshold of 1, anyone on the multisig could sign. However, the threshold is 2, so 2 out of 3 have to sign.
For larger multisigs (more than 3 people), it may make sense to not to have to require everyone to sign, but rather some majority of key holders. Think about this number before you set it.
Configure the Chain
These commands will make the rest of the commands in this tutorial simpler. They set a global config which is used by all future commands.
Set the default node to talk to (so you don't have to run your own):
Set the default chain ID:
Sign Transactions
Let’s say you want to spend some of your funds.
When making a transaction, use the --generate-only
flag.
This will not submit the transaction to the chain, but rather generate a JSON file for everyone to sign on their respective machines with their private keys. When one team member generates a transaction like this, they need to share the JSON file with the entire group.
Generate example spend proposal:
Everyone should take that tx.json
file and sign it on their own machines with their private keys. The both specify the address of the multisig account using the --multisig
flag.
You:
Your teammate:
Alice and Bob take their respective JSON files and use them to create a single transaction JSON file containing both of their signatures.
Finally, one of them broadcasts the transaction to the chain!
Alice and Bob just sent their developer friend funds from their multisig. 🎉
More Transactions
Often you want to do more than just send tokens! Here are some other transaction examples you can generate and then multisign using the steps above.
Staking
You'll want to stake your multisig assets to earn staking rewards. Figure out which validator you want to delegate to from the list of validators and use their address where it says <validator-address>
. For example, starsvaloper1jxv0u20scum4trha72c7ltfgfqef6nscdghxyx
.
Withdraw Rewards
This will withdraw your staking rewards so you can actually spend or stake them.
Last updated