Generate a Multisig key
aurad keys add --multisig=name1,name2,name3[...] --multisig-threshold=K new_key_name
K
is the minimum number of private keys that must have signed the transactions that carry the public key's address as signer.
The --multisig
flag must contain the name of public keys that will be combined into a public key that will be generated and stored as new_key_name
in the local database. All names supplied through --multisig
must already exist in the local database.
Unless the flag --nosort
is set, the order in which the keys are supplied on the command line does not matter, i.e. the following commands generate two identical keys:
aurad keys add --multisig=p1,p2,p3 --multisig-threshold=2 multisig_address
aurad keys add --multisig=p2,p3,p1 --multisig-threshold=2 multisig_address
Example
First, you need the wallets which will be the owners of the multisig wallet. Let's assume that you will create multisig wallet with 2/3 threshold.
Add test1
, test2
, test3
wallet:
aurad keys add test1
- name: test1
type: local
address: aura1ahwqzlu0wzd0uyp53x6l2ygftxmquy57tz6jj5
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Asc2LPPqgjWTuKvGZMKrhLXUxFjyLRtxy4mBtxqw3RG2"}'
mnemonic: ""
aurad keys add test2
- name: test2
type: local
address: aura1l0q4uzycmlm2s3cvqhje3dfjyuevazz0wqmt2t
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AmFtbMlegjibAduEBfNyZcVjrIN3W8JzGu/eIGzBUDVI"}'
mnemonic: ""
You can import the public keys of the wallet into your keyring. Example for test3
wallet:
aurad keys add \
test3 \
--pubkey='{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Arow5Hb8CbBYKWjuWIM5KWoEvbwCUmNti+2Kdaqrjd/T"}'
Generate the multisig key with 2/3 threshold.
aurad keys add \
multi \
--multisig=test1,test2,test3 \
--multisig-threshold=2
You can see its address and details:
aurad keys show multi
- name: multi
type: multi
address: aura1tk736vetmgplrefcak0l62gak8h28m9ccqynxj
pubkey: '{"@type":"/cosmos.crypto.multisig.LegacyAminoPubKey","threshold":2,"public_keys":[{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Arow5Hb8CbBYKWjuWIM5KWoEvbwCUmNti+2Kdaqrjd/T"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Asc2LPPqgjWTuKvGZMKrhLXUxFjyLRtxy4mBtxqw3RG2"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AmFtbMlegjibAduEBfNyZcVjrIN3W8JzGu/eIGzBUDVI"}]}'
mnemonic: ""
Let's add 2 AURA to the multisig wallet:
aurad tx bank send \
test1 \
aura1tk736vetmgplrefcak0l62gak8h28m9ccqynxj \
2000000uaura \
--chain-id=aura_6322-2 \
--gas=auto \
--fees=100000uaura \
--node https://rpc.aura.network:443
Query balance:
aurad query bank balances --chain-id aura_6322-2 --node https://rpc.aura.network:443 aura1tk736vetmgplrefcak0l62gak8h28m9ccqynxj
balances:
- amount: "2000000"
denom: uaura
pagination:
next_key: null
total: "0"