Bitcoin Cash Forum

Welcome, Guest. Please login or register.
Advanced search  

News:

Learn more about Bitcoin Cash.

Author Topic: [TUTORIAL] How to extract Bitcoin Gold from a 2fa Electrum Wallet [STEP BY STEP]  (Read 211 times)

CryptoInterest

  • Newbie
  • *
  • Posts: 2
    • View Profile

I see all over this forum that people are charging a lot of money (up to 100$/hour, that’s ridiculous) to recover your wallet and you even have to give them private keys so you can be scammed or if not, they can get your next coin because of forks. The Bitcoin community helps each other.
The process to extract Bitcoin Gold from a 2fa Electrum wallet is very simple, don’t be scared from codes etc, everyone is able to do that, but it needs time and patience and you just need a simpler guide which I’ll provide you, let’s start.



First, we need to disable 2fa.
On Electrum go to File->New/Restore
Call it: “2fa disabled”
Select “Wallet with two-factor authentication”
Select I already have a seed
Insert your 12 words seed
Now, when it asks if you want to keep 2fa Trusted Coin select no
Here we are, you have a wallet with 2fa disabled wallet (you will see 2fa on the top but don’t worry)


Now, let’s create a note on the desktop, let’s call it “BTG.txt”
Open it and paste this pastebin: https://pastebin.com/3LzufK6A
This is our txt now: https://i.imgur.com/SOigtZN.png
Now let’s see how to fill these spaces.



x1/ xprv and x2/ xprv:
Ok, go to C:\Users\User\AppData\Roaming\Electrum\wallets and open with block note the file “2fa disabled.dat” or whatever you called it (the wallet we just generated without 2fa)
Go full screen, go to the bottom of the note, you will see this:
https://i.imgur.com/L0NxPu0.png
Copy x1/ xprv and paste it in that note we created from pastebin
Copy x2/ xprv and paste in that note
Ok we have them, close 2fadisabled.dat, we have done with it.



Address:

Ok, now, in Electrum select View->Show Addresses, go to Addresses Tab and select “Receiving” and “Used”, ok now we take care only of “Receiving” and not “Change” addresses, we’ll take care of them afterwards (check the spoiler at the bottom of the tutorial*), one thing at a time.
Let’s do one address at a time, right click the first address, copy, and paste it in the note.



Transaction ID:
Then paste it here: https://btgexplorer.com we will see all the BTG balance in “Final Balance” and all the transactions.
Ok this is the first difficult part, we have to identify all the transactions ID we need to take care of, let’s suppose it’s only one transaction ID, I’ll explain afterwards separately too (check second spoiler at the bottom) if you have more than one transaction ID to keep the tutorial simpler and more orderly as possible.
Go to the previous note, paste the first transaction ID in the transaction ID space (make sure it has a “U” that means Unspent). I’ll try to explain this in this picture, I hope it’s clear (simplest way I can explain): https://i.imgur.com/EltO5QN.png
Ok now copy the transaction ID and paste it in the note we previously created.
 


Redeem script:

Right click on the address in Electrum, select “Details”, copy and paste the Redeems script of this address in the note.
https://i.imgur.com/7es6PRf.png

Ok we filled the note https://i.imgur.com/SJcgCVY.png with all we need for now.







Let’s proceed.

Open: https://coinb.in/#verify VERY IMPORTANT: use it offline or download it as HTML, right click on the page->Save with name
Paste your redeem script.
You will get 3 addresses that starts with “1”.
https://i.imgur.com/ZXWvPJJ.png
Keep this page open


Ok now go to https://iancoleman.io/bip39/ VERY IMPORTANT: use it offline or download it as HTML, right click on the page->Save with name
In "BIP32 Root Key" box paste the x1 /xprv from BTG.txt we created, select “BIP32” and in Client select “Custom derivation path”, in “BIP32 Derivation Path” leave “m/0
https://i.imgur.com/cPfdILb.png


Return to the opened page of coinb.in with redeem script etc
We have 3 addresses, right? Copy one of them, go to iancoleman again and click “CTRL+F” and paste it in search box and see if you can find it in that list, if not, try with the second address in coinb.in and do the same, if nothing with the third.
You will find one of them for sure
Look at here: https://i.imgur.com/am5EtOL.png
Keep this page open

Now, do the same with another address of the two in a new page of iancoleman but this time use the x2 /xprv instead of the x1 /xprv like before.

So, go to https://iancoleman.io/bip39/ (VERY IMPORTANT: use it offline or download it as HTML, right click on the page->Save with name)
In "BIP32 Root Key" box paste the x2 /xprv from BTG.txt we created, select “BIP32” and in Client select “Custom derivation path”, in “BIP32 Derivation Path” leave “m/0”
Use another address from coinb.in, search one of them in the list of address given by iancoleman, and keep this page opened.


Ok now go back to the famous note we created, add this at the bottom: https://pastebin.com/jaRAgMJB

We’ll have this: https://i.imgur.com/4BSS1gx.png

Fill the first “Address 1” space with the first address we matched between coinb.in and iancoleman, and the related private key.
Do the same with “Address 2” with the second address and the related private key.




Now we really have everything to start to sign the transaction.

Open Electrum, select “View”->”Show console”.

Run this command:

Code: [Select]
deserialize(gettransaction("TXID_HERE"))
Replace TXID_HERE with the transaction ID (leave the “ “)

You will get something like this: https://i.imgur.com/sKXBZNm.png
Go to the section in the bottom with where it says: "address": "our address",

Ok, now copy all that thing in the note at the bottom.
Now we have the prevout_n, the scriptPubKey, the type and the value of this transaction ID.
Now close Electrum.






We are almost finished, now open Bitcoin Gold Core wallet.
Create a wallet of course, click receive, generate an address in which we will receive our BTG, paste it in a new block note to not get confused.

Ok, go to “Help”->”Debug Window”->”Console"”, now run this command:

Code: [Select]
createrawtransaction '[{"txid": "INPUT_TRX_ID", "vout": PREVOUT }]' '{"YOUR_BTG_ADDRESS":  AMOUNT_TO_SEND}'
Replace INPUT_TRX_ID with the transaction ID we have in the note
Replace PREVOUT with prevout_n
Replace YOUR_BTG_ADDRESS with your BTG address
Replace AMOUNT_TO_SEND with the amount in BTC to send (not satoshi as we got, so convert in BTC), minus the fee (from 5 to 30 satoshi/byte is fine)

Quote
P.S. See this if you don’t know which amount to write:
Let’s suppose your “value” of the transaction is 9782200 (we have this in the note, took from Electrum console, remember).
We have it in Satoshi, we have to convert it in Bitcoin with this tool http://satoshitobitcoin.co/
Ok so, 9782200 satoshi is 0.09782200
Go to Electrum, “Tools”->”Preferences” and set this options exactly like this: https://i.imgur.com/6VSb3Zl.png
Now go to “Send” tab, paste the amount in BTC, and it will give you the fee. Subtract this fee from the original amount of BTC and you will have your AMOUNT_TO_SEND



After that Bitcoin Gold Core console will give us a Hex code, copy that on a new block note, this is called “RAW_TRANSACTION_HASH” that we will need for the next command

So, what is the next command?
Code: [Select]
signrawtransaction "RAW_TRANSACTION_HASH" '[{"txid": "INPUT_TRX_ID", "vout": PREVOUT, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD"}]' '["FIRST_PRIVATE_KEY_FOR_SIGNING"]'

Replace RAW_TRANSACTION_HASH with the hex code we got before
Replace INPUT_TRX_ID with the transaction ID
Replace PREVOUT with prevout_n
Replace INPUT_SCRIPT_PUB_KEY with the scriptPubKey we have in the note aswell
Replace REDEEM_SCRIPT with the redeem script
Replace INPUT_VALUE_FIELD with the amount without fee, so the first one not converted with the fee in BTC, not satoshi (use satoshitobitcoin.co to have the amount in BTC from Satoshi)
Replace FIRST_PRIVATE_KEY_FOR_SIGNING with the first private key of “Address 1” we have in the note

Click enter and you will get another Hex code (ignore the error message), in the block note in which we pasted the previous hex code, delete it and paste the new one.




Guess what? We need this new long Hex code (really long), for another command:
Code: [Select]
signrawtransaction "REALLYLONG _RAW_TRANSACTION_HASH" '[{"txid": "INPUT_TRX_ID", "vout": PREVOUT, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD"}]' '["SECOND_PRIVATE_KEY_FOR_SIGNING"]'

Replace REALLYLONG_RAW_TRANSACTION_HASH with the hex code we got at latest
Replace INPUT_TRX_ID with the transaction ID
Replace PREVOUT with prevout_n
Replace INPUT_SCRIPT_PUB_KEY with the scriptPubKey
Replace REDEEM_SCRIPT with the redeem script
Replace INPUT_VALUE_FIELD with the amount without fee just like before
Replace SECOND_PRIVATE_KEY_FOR_SIGNING with the second private key of “Address 2” we have in the note




And here we are, we have the final Hex code, this is the signed transaction. Let’s call it “FUCKING_CODE_FOR_FINALLY_SIGNING_THE_FUCKING_TRANSACTION

Now the final (I swear) command:
Code: [Select]
sendrawtransaction "FUCKING_CODE_FOR_FINALLY_SIGNING_THE_FUCKING_TRANSACTION"
Replace FUCKING_CODE_FOR_FINALLY_SIGNING_THE_FUCKING_TRANSACTION with the final Hex code

Here you are, you just signed a transaction, check on the BTG Explorer pasting your BTG address to which you sent the transaction to check confirmations.








WHAT TO DO WITH CHANGE ADDRESSES:
Ok I said that this was only for “Change” addresses, let’s discuss about “Change” addresses (https://i.imgur.com/aZ7XHJd.png):

There is only one simple thing that changes:
In the step where we paste the x1 /xprv and the x2 /xprv code in iancoleman website you need to select “m/1” instead of “m/0” in “BIP32 Derivation Path”.
That’s it.










MORE THAN ONE INPUT:
Ok, now let’s talk about address with more than one INPUT, so more than one transaction IDs to take care of.
What do I mean?
https://i.imgur.com/EltO5QN.png
Remember this?
You have to pick all the transaction IDs that has an “U” in parallel.
I take a random address on the internet to show you, I paste it on https://btgexplorer.com
https://i.imgur.com/vaX0FNt.png
As you see this address has more than one input and more than one “Unspent” voices so we take all the transaction IDs that we see.


Now, what we do when we have more than one transaction ID?
The only things that will change are the commands that we will run:
When we run


Code: [Select]
deserialize(gettransaction("TXID_HERE"))
in Electrum console, we have to run it once for each transaction ID and copy paste in a new note block each of this for each transaction ID:

prevout_n (remember, vout value)
scriptPubKey
value



Then, when we run in BTG Core Wallet this command:
Code: [Select]
createrawtransaction '[{"txid": "INPUT_TRX_ID", "vout": VOUT_VALUE}]' '{"YOUR_BTG_ADDRESS":  AMOUNT_TO_SEND}'

we replace:
Code: [Select]
{"txid": "INPUT_TRX_ID", "vout": VOUT_VALUE}
with:
Code: [Select]
{"txid": "INPUT_TRX_ID_1", "vout": PREVOUT _1}, {"txid": "INPUT_TRX_ID_2", "vout": PREVOUT_2}, {"txid": "INPUT_TRX_ID_3", "vout": PREVOUT _3}

Add as many
Code: [Select]
, {"txid": "INPUT_TRX_ID_X", "vout": VOUT _X}
as many transaction IDs you have.

Then, you have to:
Replace INPUT_TRX_ID_1 with the first transaction ID
Replace PREVOUT_1 with prevout_n of the first transaction ID

Replace INPUT_TRX_ID_2 with the second transaction ID
Replace VOUT_2 with prevout_n of the second transaction ID
And so on



Another thing that change, this time in these 2 commands:
Code: [Select]
signrawtransaction "RAW_TRANSACTION_HASH" '[{"txid": "INPUT_TRX_ID", "vout": PREVOUT, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD"}]' '["FIRST_PRIVATE_KEY_FOR_SIGNING"]'
Code: [Select]
signrawtransaction "REALLYLONG _RAW_TRANSACTION_HASH" '[{"txid": "INPUT_TRX_ID", "vout": PREVOUT, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY", "redeemScript": " REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD"}]' '["SECOND_PRIVATE_KEY_FOR_SIGNING"]'


Replace:
Code: [Select]
{"txid": "INPUT_TRX_ID", "vout": PREVOUT, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD"}
With:
Code: [Select]
{"txid": "INPUT_TRX_ID_1", "vout": PREVOUT_1, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY_1", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD_1"}, {"txid": "INPUT_TRX_ID_2", "vout": PREVOUT_2, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY_2", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD_2"}

Add as many
Code: [Select]
, {"txid": "INPUT_TRX_ID_X", "vout": PREVOUT_X, "scriptPubKey": "INPUT_SCRIPT_PUB_KEY_X", "redeemScript": "REDEEM_SCRIPT", "amount": "INPUT_VALUE_FIELD_X"}
And so on, just add a comma, a space and copy paste the rest if you have more than 2 transactions ID.

In this final command you have to:
Replace INPUT_TRX_ID_1 with the first transaction ID
Replace PREVOUT_1 with prevout_n of the first transaction ID
Replace INPUT_SCRIPT_PUB_KEY_1 with the scriptPubKey of the first transaction ID
Replace REDEEM_SCRIPT with the Redeem Script (always the same)
Replace INPUT_VALUE_FIELD_1 with the value of the first transaction ID

Replace INPUT_TRX_ID_2 with the second transaction ID
Replace PREVOUT_2 with prevout_n of the second transaction ID
Replace INPUT_SCRIPT_PUB_KEY_2 with the scriptPubKey of the second transaction ID
Replace REDEEM_SCRIPT with the Redeem Script (always the same)
Replace INPUT_VALUE_FIELD_2 with the value of the second transaction ID






Things to note before doing this

    For extra security, you have to move your BTC to a new Electrum wallet, do this to protect them in case your seed/private keys get leaked as a result of this process, you should also ensure that all BitcoinCash has been claimed from these private keys aswell, it's strongly recommended! Don't skip this step.
    You need Bitcoin Gold Core installed and the full blockchain (it will take a while to download but worth it, there is no rush)
    It’s easy, it seems difficult but it’s only messy and it takes time, if you follow the tutorial precisely step by step you won’t have problems, in case of problems ask here in the thread, there are people willing to help you, including me. You can also ask me in PM and I’ll try to help you, I can give you my Skype, no problem at all, just know that it’s easy, you just need concentration, don't pay anyone to do this, never give your private key of one single address to anyone, neither the seeds, they can steal you coins from other forks even if you empty your wallet and of course BTG/BCH
    As I already stated in the tutorial in bold, use the tools always offline or save a offline page of them. This is very important too.
« Last Edit: December 18, 2017, 10:25:02 am by CryptoInterest »
Logged