Pages:
Author

Topic: Extracting Bitcoin Gold from 2FA & Multisig Electrum Wallet (Read 2932 times)

full member
Activity: 189
Merit: 100
Just had a success in extracting BTG from my old 2/2 multisig BitPay wallet.
It's not hard if you know what to do.
All that is needed is BIP39 Mnemonic Code Converter and ElectrumG.
newbie
Activity: 4
Merit: 0
Many, many thanks again. I will check back in once I've looked at your suggestion.
HCP
legendary
Activity: 2086
Merit: 4363
Yeah... Should just be a "legacy" MultiSig wallet then... In which case, I've no idea why it is giving you errors about the witness program...

The only other thing I can think of, without seeing specific details like TXIDs and addresses, is that you've selected the wrong "vout" value from the transaction... and so it is attempting to use a UTXO belonging to a SegWit address and therefore giving the error due to there being no witness data supplied.

Double check the "vout" value (labelled in Electrum as "prevout_n") given when you look up the TXID that generated the UTXO that you're trying to use by entering he following in the Electrum console:
Code:
deserialize(gettransaction("Your_TXID"))
newbie
Activity: 4
Merit: 0
It's a multisig 2 of 3 wallet, created in Electrum. I say it has a "3" address because it is multisig Electrum. The reason I don't think it's segwit is because I created it before Electrum supported Segwit, and because it doesn't use the bech32 format.

If I am wrong about this, please let me know, and thank you again.
HCP
legendary
Activity: 2086
Merit: 4363
The wallet I'm coming from is definitely not a segwit wallet. If nothing else, the fact that it is using "3" addresses (and not bech32 addresses) should confirm this -- unless you know something I don't!
Guessing you have not heard of P2SH-P2WPKH addresses then...

Like any other P2SH address, P2SH-P2WPKH address has prefix 3.

Most of the SegWit wallets use addresses that start with a "3"... they're "backwards compatible" and indistinguishable from other "3" addresses... so it's POSSIBLE that you have a SegWit wallet... but just because they start with a "3" doesn't mean they are SegWit addresses. MultiSig and 2FA wallets also use addresses that start with "3".

How did you make this wallet? What does it say in  the [ ]'s after the wallet name in the titlebar? It should be something like "standard", "imported", "2-of-X" or "2fa"...


Quote
The template you sent makes a lot of sense, structurally. Can you give me some idea where I can find the "SEGWIT_witnessScript" you mentioned? From the research I've done, that seems like the only thing I'm missing. If I could find out how to retrieve that, I'm pretty sure it would solve everything.
That's going to depend a lot on whether or not you actually have a SegWit wallet... If you do indeed have a SegWit wallet, the "SEGWIT_witnessScript" is just: ripemd160(sha256(pubkey_of_your_segwit_address))
newbie
Activity: 4
Merit: 0
Thank you SO much for getting back to me so quickly.

The wallet I'm coming from is definitely not a segwit wallet. If nothing else, the fact that it is using "3" addresses (and not bech32 addresses) should confirm this -- unless you know something I don't!

The template you sent makes a lot of sense, structurally. Can you give me some idea where I can find the "SEGWIT_witnessScript" you mentioned? From the research I've done, that seems like the only thing I'm missing. If I could find out how to retrieve that, I'm pretty sure it would solve everything.

I'd really like to try to get it going on my own, but if we can't solve it here, publicly, then I will DM you with the more private details. If we must do it that way, I'll post the solution back here for any others who need it, once I have success.

Thank you again for your help and your quick response. I just can't tell you how much I appreciate it!
HCP
legendary
Activity: 2086
Merit: 4363
I doubt that the version of Electrum you are using has any bearing on this... the redeem scripts and public/private keys *should* be the same regardless of version... UNLESS your wallet is indeed a SegWit wallet.

The "Witness Program" error would indicate that the input you are attempting to spend is, in fact, a SegWit input... or maybe it was included in a "SegWit" transaction (ie. one of the other outputs was a SegWit transction) and now you need to provide all the witness data.

Are you able to provide any more information? Maybe the Transaction ID and vout of the inputs you are trying to spend? If you'd rather not post publicly for privacy reasons, you can PM me...

Alternatively, I think that if you provide the "witness" info... you should be able to make it work. Basically, you "double up" on the the "Input" section and include the witness script in the 2nd one... like this:
Quote
signrawtransaction "OUTPUT_HEX_FROM_CREATERAWTRANSCTION" '[{"txid": "your_tx_id","vout": X,"scriptPubKey": "whatever_your_scriptpubkey_is","redeemScript":"theReedemScriptForYourMultiSig","amount": "0.10000000"},{"txid": "same_tx_id","vout": X,"scriptPubKey": "whatever_your_scriptpubkey_is","redeemScript":"SEGWIT_witnessScript","amount": "0.10000000"}]','["private_key1","privatekey2"]'
Note that txid, vout and scriptPubKey should be the same for both records... it is just the "redeemScript" section that should change.
newbie
Activity: 4
Merit: 0
I am able to run the "createrawtransaction" command, after which I am given the appropriate "raw transaction hash".

After that, however, when I enter the "raw transaction hash" as the first argument in the following command ("signrawtransaction"), I am given this error:

Quote
"error": "Witness program was passed an empty witness"

My best guess is that this is happening because I'm using the latest version of Electrum. To be more clear: even though the address I'm using to create the raw transaction is NOT segwit, the latest version of Electrum IS segwit-ready. Could that explain this error?

I tried using an older version of Electrum to generate the necessary data (redeem scripts, public keys, private keys, etc), but again, when I tried to run everything in the Bitcoin Gold console, I received the same error.

Does anyone here know why I'm getting this "empty witness error?" What do I need to add to my commands to satisfy this requirement?

Many thanks in advance...

 
newbie
Activity: 6
Merit: 0
As it is for me to complicated to create for all forks a wallet and download the blockchain.
I used the above mentioned service for a lot of coins BCH, BCG, BCD ...
for my electrum 2fa wallet and it worked great:
https://dig.walleting.services/#/aff/g0NlUXlciy4gwkabmMnd
OK it cost a 10% fee but worked great for me and saved a lot of time.
But it's your choice
HCP
legendary
Activity: 2086
Merit: 4363
We've been quite busy extracting BTG & BCH for clients & working on our automated digging website, which should launch in the next week or two.

When things settle down we'll post the step-by-step for SegWit.
Any chance we'll get that step-by-step for SegWit? I'm just curious to know if it was basically the same as what I did for a guy over the weekend... in short:

- importprivkey's into Bitcoin Gold Core, without rescan (saves some time Wink)
- addmultisigaddress using public keys that match imported priv keys (gives "Legacy" MultiSig address)
- addwitnessaddress using "legacy" multisig address (gives SegWit MultiSig address)
- restart Bitcoin Gold Core using -rescan (wait "patiently" for an hour)
- create transaction as normal in the GUI, using coin control to spend from just the SegWit MultiSig address coins.
- PROFIT! Cheesy
newbie
Activity: 54
Merit: 0
Gosh, I didnt. Thanks for pointing that out. I actually followed a set of instructions from elsewhere, and only referenced point 6 here as it had to do with the xprv issue that you kindly clarified. I got the addresses from coinb.in and finally got my complete command configured. I tested it in offline mode as I don't have the chain synced yet and got the error "Method not found (code -32601)"....
I went online repeated all the steps and finally got "Complete" :  true     Smiley

I avoided having to sync the entire blockchain by broadcasting the transaction hash from https://btgexplorer.com/tx/send and I've got my BTG now!  Smiley

Thanks OP and HCP.
HCP
legendary
Activity: 2086
Merit: 4363
Did you actually do points 2), 3) and 4)? If so, then you should know exactly which "1xxxx" addresses you need to get the private keys for. When you paste the redeemscript in the "Verify" section you'll see something like:


You should find that two of the three "1xxx" addresses displayed can be in found in the X1 and X2 wallets.

NOTE: you did to get the redeemscript for EACH of your "3" addresses from your Electrum 2FA that you are trying to spend the coins from... and then find the "1xxxx" addresses... and then get those private keys.


newbie
Activity: 54
Merit: 0
hi, I got to the last step for signing the raw transaction, but now get the error message:

Invalid private key (code -5)

The 1st private key starts with 'xprv.....' and I got it from the wallet text file. I tried the 2nd priv key and got the same error code. Its a 2 of 3 multisig wallet. Its a restored wallet with disabled 2fa.

You didn't follow the process correctly. You don't sign with the "xprv"... you need to create two standard wallets using the xrpvs... and get the private keys from those wallets... the private keys should start with either a "K" or an "L"...

Thanks, I made it up-to point 6 "Make a 2 new standard electrum wallets using the 2 xprv keys and find one of the addresses needed to sign your 2FA address in each of them."

Now, there are two wallets with different addresses starting with 1xxxx and no balance or history. Will signing with the key of any address do, or is there a way to figure out which 3xxx address corresponds to which two 1xxx addresses?
HCP
legendary
Activity: 2086
Merit: 4363
hi, I got to the last step for signing the raw transaction, but now get the error message:

Invalid private key (code -5)

The 1st private key starts with 'xprv.....' and I got it from the wallet text file. I tried the 2nd priv key and got the same error code. Its a 2 of 3 multisig wallet. Its a restored wallet with disabled 2fa.

You didn't follow the process correctly. You don't sign with the "xprv"... you need to create two standard wallets using the xrpvs... and get the private keys from those wallets... the private keys should start with either a "K" or an "L"...


Does the same procedure work also for extracting Bitcoin Cash from a Multisig Electrum Wallet? I still have them sitting there since all usual procedures didn't work...
Technically yes, but you can simply use "ElectronCash" (https://electroncash.org/#download)... open your "restored/disabled" 2FA wallet in ElectronCash and you should be able to simply send the BCH out Wink

full member
Activity: 340
Merit: 100
Does the same procedure work also for extracting Bitcoin Cash from a Multisig Electrum Wallet? I still have them sitting there since all usual procedures didn't work...
newbie
Activity: 54
Merit: 0
hi, I got to the last step for signing the raw transaction, but now get the error message:

Invalid private key (code -5)

The 1st private key starts with 'xprv.....' and I got it from the wallet text file. I tried the 2nd priv key and got the same error code. Its a 2 of 3 multisig wallet. Its a restored wallet with disabled 2fa.
HCP
legendary
Activity: 2086
Merit: 4363
No... in the "signrawtransaction" command you are supposed to provide ["PRIVATE_KEY"]... but you would need to provide ["PRIVATE_KEY_ADDRESS1", "PRIVATE_KEY_ADDRESS2", "PRIVATE_KEY_ADDRESS3"] if you want to take all the inputs from the 3 different addresses... these private keys are generated from the x1_xpv

You would then do the same with the 2nd "signrawtransaction"... you would need to provide the 3 private keys for the 3 different addresses (generated from x2_xprv)

As for why your addresses are "missing", by default, a new Electrum wallet only generates 5 change addresses... chances are your "missing" coins are out past the "gap limit"... and just aren't found when Electrum has scanned 5 change addresses, so it stops... try this command in the console:

Code:
for x in range(0, 20): print wallet.create_new_address(True)

That should generate 20 new "change" addresses... and you should see the ones you need Wink  Do that command in both of the new standard wallets you created with the x1 and x2 xrpvs
newbie
Activity: 4
Merit: 0
I used the "xprv"s.

Quote
(ie. x1_xprv_Address1, x1_xprv_Address2, x1_xprv_Address3 for first signrawtransaction... and then x2_xprv_Address1, x2_xprv_Address2 and x2_xprv_Address3 for the second signrawtransaction)

x1_xprv_Address1 = x1_xprv_Address2 = x1_xprv_Address3 and x2_xprv_Address1 = x2_xprv_Address2 = x2_xprv_Address3 in my case? Or I don't understand where I get the other 2 from as they are all in the same wallet.

I just noticed that I have 12 addresses in my "Addresses" "change" 2FA wallet but only 6 addresses in the new wallets in the same tab. That must be the missing addresses. So how can the change list be incomplete in the new wallet?
HCP
legendary
Activity: 2086
Merit: 4363
You can do it all in one transaction... it just becomes slightly more complicated as you need to include all the different transaction information.... (makes the JSON quite long)... and you also need to provide 3 private keys at each signrawtransaction (ie. x1_xprv_Address1, x1_xprv_Address2, x1_xprv_Address3 for first signrawtransaction... and then x2_xprv_Address1, x2_xprv_Address2 and x2_xprv_Address3 for the second signrawtransaction)

I have succesfully done this several times with two addresses... so I see no reason why it won't work with 3 Wink


As for why you can't see the public keys... Are you creating the new standard wallets with the "xprv"s... or just with a specific WIF private key (ie. starts with "K" or "L")?
newbie
Activity: 4
Merit: 0
I'm stuck at step 6.

My BTG are in 3 different multisig addresses in the same 2FA wallet.

I thought I have to make 3 seperate transactions then. Or can I merge it together into one?

After making the 2 new standard wallets I can only find the public keys for one of the 3 multisig addresses in my new wallets.

The other 2 addresses should be there as well as the BTC were held in the same wallet, no?
Pages:
Jump to: