I am building a service that is based on multisig wallets. My current progress is so that I've implemented the multisigs for Bitcoin network and it works fine. Now I am on Litecoin and I am facing some issues and would appreciate any help or guidance on that.
Disclaimer: This may be related to how Electrum-LTC works, I am not sure. I am happy to hear experts oppinion on that.
On Bitcoin network your multisig wallet is composed of 3 parts:
ScriptSig Signatures 0 <Sig1> <Sig2> ... <SigM> Redeem script M <PubKey1> <PubKey2> ... <PubKeyN> N OP_CHECKMULTISIG ScriptPubKey OP_HASH160 <Redeem script hash> OP_EQUAL
And that works just fine with my implementation. I can generate 2-of-2 multisig with Electrum (btc) and sign it with both keys, both with my code and with Electrum wallets. Outcome transaction in both cases is correct and accepted by network.
Now, for Litecoin I am using Electrum-ltc and the process is exactly the same. I can successfully generate multisig address on Litecoin
Suppose I Have following Redeem script 2 028c895128a8113bb5d599b4f463df685220ba726fc664013b3df56cb0bae74dc4 02c09fdcf2cd2281ac5d35dedb8b19499db847fad469c151428d28c9cf1aabf435 2 OP_CHECKMULTISIG
The address I see in Electrum-ltc matches the one I generated myself which tells me I am on the right way.
However, when I sing a transaction with wallet a redeem script in the transaction hex looks totally different and does not match my manually generated redeem script
Manually generated redeem script 5221028c895128a8113bb5d599b4f463df685220ba726fc664013b3df56cb0bae74dc42102c09fdcf2cd2281ac5d35dedb8b19499db847fad469c151428d28c9cf1aabf43552ae broken apart 52 - OP_2 21028c895128a8113bb5d599b4f463df685220ba726fc664013b3df56cb0bae74dc4 - PubKey1 2102c09fdcf2cd2281ac5d35dedb8b19499db847fad469c151428d28c9cf1aabf435 - PubKey2 52 - OP_2 ae - OP_CHECKMULTISIG
And here is a redeem script that I get from Electrum-ltc once I signed transaction with one key
524c53ff0488b21e0000000000000000006a88a8afff7c30e2adc4ebee877e842b7868f11c6fafe5635fecd85337366bd802f8ecc3fc0be1c7b7d7bf4968df349845ede9dd6044beb0bcf25145612fa3b4e4000000002102c09fdcf2cd2281ac5d35dedb8b19499db847fad469c151428d28c9cf1aabf43552ae broken apart 52 - OP_2 4c53ff0488b21e0000000000000000006a88a8afff7c30e2adc4ebee877e842b7868f11c6fafe5635fecd85337366bd802f8ecc3fc0be1c7b7d7bf4968df349845ede9dd6044beb0bcf25145612fa3b4e4000000002102c09fdcf2cd2281ac5d35dedb8b19499db847fad469c151428d28c9cf1aabf435 52 - OP_2 ae - OP_CHECKMULTISIG
So, what this thing the middle? And why it does not match my redeem script? Is this a bug with Electrum-ltc or I am missing something. Would appreciate any feedback.