js-algorand-sdk
js-algorand-sdk copied to clipboard
Allow creating multisig txns and appending signatures without access to private keys
Summary
This SDK provides the functions signMultisigTransaction
and appendSignMultisigTransaction
which are used to create and add signatures to an encoded multisig transaction. These functions work well if the SDK has access to the private keys of the members of the multisig account, but this is not always the case.
It should be possible to create and compile a multisig transaction using only the raw signatures obtained through another method.
Based on the discussion from #402.
Scope
A solution would be to add the following new methods:
-
createMultisigTransaction(txn: txnBuilder.TransactionLike, msigMeta: MultisigMetadata): { txid: string, blob: Uint8Array }
- This would create a multisig transaction without any signatures and return its txid and encoded form. This can then be used with the next method.
-
appendMultisigTransactionSignature(multisigTxnBlob: Uint8Array, msigMeta: MultisigMetadata, signer: string, signature: Uint8Array): { txid: string, blob: Uint8Array }
- This would be similar to the existing
appendSignMultisigTransaction
function, except it accepts the signature and signing address directly as arguments, not the private key to create the signature. ~~This should probably (?) verify the input signature to ensure it matches the transaction.~~ I don't think this should verify the signature. But we should expose theverifyMultisig
function in order to verify the signature.
- This would be similar to the existing
Ideally we could refactor the existing multisig functions to internally use these new functions as well.
@jasonpaulos Would be nice if the appendMultisigTransactionSignature
accepts the signer address, just in case the address was rekeyed.
@Alex99y yes, I believe the function needs the signer address in order to figure out which public key singed the transaction