Multisig
Multisig (multi-signature) accounts enhance security and decentralization by requiring multiple signatures to approve transactions. A multisig account in LagomChain is a special type of account that requires multiple private keys to sign transactions before they are considered valid.
Multisig accounts are useful for:
Enhancing security by distributing signing authority.
Enforcing multi-party approvals for transactions.
Reducing risks of a single point of failure.
How Multisig Works
A multisig account is defined by:
Threshold – The minimum number of required signatures.
Public Keys – The set of keys that can sign transactions.
Each transaction must be signed individually by the specified keys. Once the required number of signatures is collected, they are combined into a multi-signature to authorize the transaction. If fewer than the threshold signatures are present, the transaction is invalid.
Creating a Multisig Account
Step 1: Generate a Multisig Key
Use the following command to create a multisig key:
K
is the minimum number of required signatures.--multisig
specifies the public keys that will be combined.new_multisig_key
is the name of the new multisig account.
Example:
This command creates a multisig account that requires two out of three (2/3
) signatures.
Multisig addresses can also be generated on-the-fly using:
Signing a Multisig Transaction
Step 1: Create the Multisig Key
Assume that three users (test1
, test2
, and test3
) want to create a multisig account.
First, import the public key of
test3
into the keyring:
Generate the multisig key with a 2/3 threshold:
Verify the multisig account:
Add tokens to the multisig wallet:
Step 2: Create an Unsigned Transaction
To send 5 LAGOM from the multisig account to another address:
This creates an unsigned transaction file (unsignedTx.json
).
Step 3: Sign Individually
Each signer (test1
and test2
) must sign the transaction separately.
Sign with test1:
Sign with test2:
Step 4: Combine Multisignatures
Now, combine the individual signatures into a final multisig transaction:
This produces the final signed transaction file (signedTx.json
), which contains the required threshold signatures.
Step 5: Broadcast the Multisig Transaction
To broadcast the fully signed transaction:
Once broadcasted, the transaction will be processed and recorded on the LagomChain blockchain.
Summary of Multisig Commands
Action
Command
Create a multisig key
lagomd keys add --multisig=name1,name2 --multisig-threshold=K new_key
Check multisig details
lagomd keys show multi
Send funds to multisig account
lagomd tx bank send sender multi amount --chain-id=lagom_986-1
Create an unsigned transaction
lagomd tx bank send recipient multi amount --generate-only > unsignedTx.json
Sign transaction (each signer)
lagomd tx sign unsignedTx.json --from=signer --output-document=signerSig.json
Combine signatures
lagomd tx multisign unsignedTx.json multi sig1.json sig2.json --output-document=signedTx.json
Broadcast the transaction
lagomd tx broadcast signedTx.json --chain-id=lagom_986-1
Security Considerations
Private keys should never be shared. Each participant must sign transactions independently.
Ensure the correct threshold is set to prevent unwanted transactions.
Backup your multisig key and participants' public keys to avoid losing access.
Last updated