Bitcoin Forum

Bitcoin => Electrum => Topic started by: heropzy on June 28, 2017, 11:47:08 AM



Title: How to get the redeem script form P2SH address?
Post by: heropzy on June 28, 2017, 11:47:08 AM
I am using Electrum two factor Authentictation wallet which is P2SH start with 3.
want to claim XLM, it said 'For P2SH (multisig) addresses, you will be asked for a redeem script' How can I get the redeem script?
Any one can support?
Many thanks


Title: Re: How to get the redeem script form P2SH address?
Post by: ranochigo on June 28, 2017, 12:01:06 PM
Could you PM me or post your address? It's kinda hard to get the redeem script without public key.

If you have sent a transaction from that address before, it will be easier.


Title: Re: How to get the redeem script form P2SH address?
Post by: heropzy on June 28, 2017, 01:14:05 PM
Please check the PM


Title: Re: How to get the redeem script form P2SH address?
Post by: Abdussamad on June 28, 2017, 03:19:42 PM
You can't get it from the address alone. You have to construct it yourself using the 3 address specific public keys which can be obtained by right clicking on the address and choosing public keys. You have to put the public keys in lexicographic order and then use the createmultisig command line option in electrum.

For example:

Code:
abdussamad@linux:~/temp/electrum> electrum createmultisig 2 '["04351dfbaccad6c4c49db52062b711ec79b3cb364b490d9477cb3f4f66ac923c3faac1c0bfcd6edbd58c5b69ee8376fc4f9a935243602b451e92ce8ade093b9c74","04dec12260ff33763e4f52885fe05b8d7ed3017a286bf108b9ebe9cceae495525768b24a0d6519d602581bf2e12982b30b2f14405e504c3bd20b67deecc02ae3dc"]'
{
    "address": "3KbGQXxWrScoMdZBnb21ZJ8UrKZbQhCFMu",
    "redeemScript": "524104351dfbaccad6c4c49db52062b711ec79b3cb364b490d9477cb3f4f66ac923c3faac1c0bfcd6edbd58c5b69ee8376fc4f9a935243602b451e92ce8ade093b9c744104dec12260ff33763e4f52885fe05b8d7ed3017a286bf108b9ebe9cceae495525768b24a0d6519d602581bf2e12982b30b2f14405e504c3bd20b67deecc02ae3dc52ae"
}


Type `electrum help createmultisig` in a terminal to get more details.


Title: Re: How to get the redeem script form P2SH address?
Post by: heropzy on June 29, 2017, 02:23:10 AM
With the help of Ranochigo, I got the redeem script, thanks a lot. ;) ;)

But I Met further question.
Stellar told me as below.And I try to sign the message with Electrum it said 'address not in the wallet'
I believe the P2SH address start with '3' has 3 normal address start with '1', how to sign the address with '1' while I have the private key of '3' address?

'Paste your cryptographic signature.
You are claiming P2SH address. Please sign the message above using any 2 of the following addresses:
15Xj78LjAxWRwzm3YfJTjn2ScnDSqBpbc9
1G7v3viTSXevSF1vjCnuXNoyDTfNQRproa
1bimRR8Lj5H5FEBFWbjV8fhyp1MYvhZaS
Separate the signatures using space.
Message signing is available in most Bitcoin clients and hardware wallets. Need more info? See this article.'


Title: Re: How to get the redeem script form P2SH address?
Post by: dedocry on June 29, 2017, 02:15:46 PM
I have received same message.

the I tried to signing  on of them, but I have received "the address is not in your wallet"..that next?

how can I signing new addresses?


Title: Re: How to get the redeem script form P2SH address?
Post by: heropzy on June 29, 2017, 02:29:52 PM
I have received same message.

the I tried to signing  on of them, but I have received "the address is not in your wallet"..that next?

how can I signing new addresses?

Yeah, I met the exactly same problem you met.


Title: Re: How to get the redeem script form P2SH address?
Post by: Abdussamad on June 29, 2017, 08:14:46 PM
Why don't you guys just create a new single key wallet? You can have more than one wallet in electrum you know? A "Standard wallet" in electrum will be a single key wallet. It'll be much easier to sign messages with a single key wallet. You can follow this guide here (https://bitcoinelectrum.com/creating-an-electrum-wallet/) to create your wallet. Use file menu > open to switch  wallets in future.


Title: Re: How to get the redeem script form P2SH address?
Post by: gcasilva on June 29, 2017, 08:54:39 PM
Hi did you manage to solve this?
I'm not even able to create the redeem script, if you can help please.
I'm on windows.

I have received same message.

the I tried to signing  on of them, but I have received "the address is not in your wallet"..that next?

how can I signing new addresses?

Yeah, I met the exactly same problem you met.


Title: Re: How to get the redeem script form P2SH address?
Post by: heropzy on June 30, 2017, 01:14:03 AM
Why don't you guys just create a new single key wallet? You can have more than one wallet in electrum you know? A "Standard wallet" in electrum will be a single key wallet. It'll be much easier to sign messages with a single key wallet. You can follow this guide here (https://bitcoinelectrum.com/creating-an-electrum-wallet/) to create your wallet. Use file menu > open to switch  wallets in future.
Because the snapshot of the bitcoin blockchain was taken by Stellar on June 26th.  It's too late for them to create single key addresses and transfer their bitcoins to it. Anyone with Bitcoins can receive free Lumens (XLM) - the process requires to sign a message provided by Stellar, with the private keys of the address(es) that were holding bitcoins on June 26th.

Yes, exactly...


Title: Re: How to get the redeem script form P2SH address?
Post by: HCP on June 30, 2017, 05:46:09 AM
Hey guys... I have posted instructions in the other thread (https://bitcointalk.org/index.php?topic=1989369.msg19853098#msg19853098) on how you can (might?) be able to sign a message from 2 of 3 addresses so that you can claim Lumens...

Please note that the method is UNTESTED, as I didn't have any coins in a 2FA MultiSig address when the Lumens snapshot was taken, so the claim form won't let me try and sign a message etc.


Title: Re: How to get the redeem script form P2SH address?
Post by: Edgemaster on August 01, 2017, 10:30:38 PM
Hey guys... I have posted instructions in the other thread (https://bitcointalk.org/index.php?topic=1989369.msg19853098#msg19853098) on how you can (might?) be able to sign a message from 2 of 3 addresses so that you can claim Lumens...

Please note that the method is UNTESTED, as I didn't have any coins in a 2FA MultiSig address when the Lumens snapshot was taken, so the claim form won't let me try and sign a message etc.

There is a much easier way , using electrum 2.9.

1. In the addresses list, Right click the multisig address on one of the signing wallets and press details. The redeem script is given to you.
2. Then you are asked to sign a message from 2 address. This is easy too, obtain the private key by right clicking the the multisig address then private key option. Get the private key down
3. Make a standard address in electrum and import that key. You will get a standard address which starts with 1 and it will be one of the addresses in that list. Use this address to sign the message required.
4. Repeat steps 2 and 3 for the co-signers wallet.
5. Insert both signatures into the required fields and you are done !
 


Title: Re: How to get the redeem script form P2SH address?
Post by: HCP on August 02, 2017, 02:08:23 AM
There is a much easier way , using electrum 2.9.
Wow... this is fantastic... Nicely spotted!  8)

I had totally missed this new(?) feature in 2.9... I thought adding in custom "Derivation Path" values was the best new feature... but this is pretty awesome too! It should make it stupidly easy for MultiSig folks to be able to get their redeem scripts/private keys and sign messages as required for Lumens et al.  ;)



Title: Re: How to get the redeem script form P2SH address?
Post by: BasBas on August 22, 2017, 06:09:20 PM
Hey guys... I have posted instructions in the other thread (https://bitcointalk.org/index.php?topic=1989369.msg19853098#msg19853098) on how you can (might?) be able to sign a message from 2 of 3 addresses so that you can claim Lumens...

Please note that the method is UNTESTED, as I didn't have any coins in a 2FA MultiSig address when the Lumens snapshot was taken, so the claim form won't let me try and sign a message etc.

There is a much easier way , using electrum 2.9.

1. In the addresses list, Right click the multisig address on one of the signing wallets and press details. The redeem script is given to you.
2. Then you are asked to sign a message from 2 address. This is easy too, obtain the private key by right clicking the the multisig address then private key option. Get the private key down
3. Make a standard address in electrum and import that key. You will get a standard address which starts with 1 and it will be one of the addresses in that list. Use this address to sign the message required.
4. Repeat steps 2 and 3 for the co-signers wallet.
5. Insert both signatures into the required fields and you are done !
 

Thank god for finding this thread! I'm stuck at step 4 here. Where do I find the private Keys for the co-signers wallet? There is only one when I right click private key. If I understand it correctly there are 2 more private keys from which I have to create at least one other wallet and sign it?


Title: Re: How to get the redeem script form P2SH address?
Post by: HCP on August 23, 2017, 03:05:30 AM
Thank god for finding this thread! I'm stuck at step 4 here. Where do I find the private Keys for the co-signers wallet? There is only one when I right click private key. If I understand it correctly there are 2 more private keys from which I have to create at least one other wallet and sign it?
Is your wallet 2FA or MultiSig?  If it is 2FA, then because it works in a slightly different way to a normal MultiSig (ie. you have TWO master private keys in the wallet) what you want to do is this:

NOTE: this exposes the xprvs for your 2FA wallet, be VERY careful and mindful of the security implications of doing this. An offline computer/VM/Live distro with no networking is recommended.

NOTE: Electrum v2.9+ required (Tested on v2.9.3)

1. Restore you 2FA wallet and DISABLE 2FA when prompted. ("File -> New\Restore -> 2FA wallet -> I already have a seed -> DISABLE")

2. DO NOT use a password

3. On the addresses tab (Wallet -> Show Addresses), right click the address you need to sign with and select details, this will give you your redeem script.

4. Goto https://coinb.in/#verify and paste your redeem script (Note down the 3 public addresses it gives you)

5. Find your "restored2FA" wallet file (%appdata%\Electrum\wallets) and open it in the Text editor of your choice. You should find sections labelled "x1/" and "x2/" that contain your two xprv "rootKeys":
https://talkimg.com/images/2023/11/15/zepVZ.png

6. Create a new wallet using the "x1" xprv ("File -> New\Restore -> Standard wallet -> Use public or private keys -> Paste in the xprv")

7. Look in the addresses tab for a matching address from step 4, right click and "sign/verify message"

8. Sign the message required

9. Repeat Steps 6 thru 8 with the "x2" xprv.

10. Make sure you have deleted the unencrypted "restored2FA" wallet. or alternatively, move all your coins out of your 2FA wallet as you should probably consider it compromised.