Mostly, multi-signature permissions are setup using account names to sign transactions. Example:
Permission: active (Threshold 2):
aliceaccount@active (1)
bobaccount@active (1)
Alice and Bob must sign the above transactions for the transaction to execute.
Here is a real example:
But, what happens if you have set your permissions using the Public Keys instead of account names?
Permission: active (Threshold 2):
PUB_K1_6ies8fT5dUNmVDG6CSSfwVcn6jvJakW6R3YLfHgUPcknxna9nT (1)
PUB_K1_5fHPq9GpZxTPQHAw8pq3SpYFLday8q9T6ezsMwBCNydphTjamt (1)
This means the transactions of this account must be signed by the two public keys for the transaction to execute.
The problem is that there is no option to sign transactions with multiple keys on a user-friendly EOS wallet. Therefore, a command line has to be used to solve this problem.
Configuring `cleos` to sign with the multiple keys
Cleos is the command line interface that interacts with all the AntelopeIO blockchains. If you don’t have cleos, you can install it here:
After installing Cleos, create a wallet. In this example, we will create a wallet called support (this is only a reference name, not an EOS account name) and ask cleos to print the result to the terminal console to get the password that is automatically generated for this wallet:
cleos wallet create -n support --to-console
Important: Copy and save your new password for the created wallet. You will need this password every time the wallet is locked.
Cleos locks wallets when they are idle. To unlock, use the following command line replacing support with YOURWALLETNAME:
cleos wallet unlock -n support
For this example, we will add two private keys.
Import the Private Keys of the accounts:
cleos wallet import --private-key PVT_K1_28t8rJAwm2ezAxNUJjLjHJ4bFvMMPfDocTJxz23NePNWPe5gVp -n support
cleos wallet import --private-key PVT_K1_QCknBCMuqAhKF7STxFNHR8Rdx8HEoNg9rUP8rgWDfQvm9vfoC -n support
Note: do it again for the other key/s if needed
This will set up your wallet to sign using two keys simultaneously.
You can put the RAW transaction, but it's cleaner using a file:
.json cleos -u https://eos.greymass.com push transaction transaction.json
Once executed, a JSON data (see the image above) will return. Copy your transaction ID, and verify on the block explorer.
Author: Erick Birbe
Editor: Markus Hinrichs; Randall Roland
Translation: -
Sources & References: