Bitcoin Forum
June 24, 2024, 06:49:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: GUIDE: Retrieving your BTG from Segwit address  (Read 130 times)
Amatysten (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
December 10, 2017, 02:48:12 AM
 #1

DISCLAIMER: I’m not in any way responsible for possible loss of funds or any other problems that you can get into by following this guide. However, the same very method worked for me.
The following describes full algorithm to release your bitcoin gold from Segwit address, generated by addwitnessaddress on Bitcoin Core full node. With some modifications it would also work for other software, where you control your private keys (like Electrum wallet) and for multisig addresses.

Notation:
   BTC_CONSOLE – commands console of BTC Core, could be found in Debug window → Console;
   BTC_SEGWIT_ADDRESS – the only thing you know in the beginning;
   BTC_ORIGINAL_ADDRESS – address, used to generate SEGWIT_ADDRESS;
   BTC_ACCOUNT_NAME – name of some account in your BTC Core;
   BTC_ADDRESS – some BTC address;
   BTC_PASSPHRASE – passphrase, used to encrypt your BTC Core wallet;
   BTC_PRIVATE_KEY – private key of the ORIGINAL_ADDRESS and SEGWIT_ADDRESS;
   OLD_TRANSACTION_ID – old transaction, used to fund your BTG_SEGWIT_ADDRESS;
   BTG_CONSOLE – commands console of BTG Core, could be found in Debug window → Console;
   BTG_SEGWIT_ADDRESS – address that holds your BTG funds;
   AMOUNT_TO_GET – funds you will get from BTG_SEGWIT_ADDRESS after subtracting BTG_FEE;
   BTG_FEE – fee you want to pay on BTG network (0.00001 works fine);
   BTG_NEW_ADDRESS – new address to hold your BTG funds (could be exchange or mobile wallet);
   BTG_RAW_TRANSACTION – raw transaction with your funds for BTG network;
   BTG_RAW_TRANSACTION_SIGNED – signed BTG transaction.
      

1. Verify which BTC_SEGWIT_ADDRESS (must start with 3) contains BTG (use https://btgexplorer.com or any other explorer you like). The explorer will also show your BTG_SEGWIT_ADDRESS that now contains your funds. Save both of them to Notepad.

2. Send all of your BTC from BTC_SEGWIT_ADDRESS to another safe address (hardware wallet, smartphone wallet, another pc). ATTENTION: you may lose your BTC otherwise!

3. Be ready to reinstall OS after the process, as you'll have to install BTG core, as, seemingly, even their devs don’t know what malware it contains.

4. You need to find which BTC_ORIGINAL_ADDRESS was used to generate your BTC_SEGWIT_ADDRESS. Go to BTC_CONSOLE and type

   listaccounts
   getaccount BTC_SEGWIT_ADDRESS


Most likely your BTC_ORIGINAL_ADDRESS is in the same BTC_ACCOUNT_NAME as your BTC_SEGWIT_ADDRESS. But you may have to check all accounts in a row.

5. Type in BTC_CONSOLE

   getaddressesbyaccount “BTC_ACCOUNT_NAME”

Then try

   addwitnessaddress “BTC_ADDRESS”

for every BTC_ADDRESS in the list until you see your BTC_SEGWIT_ADDRESS as the result. You found BTC_ORIGINAL_ADDRESS (must start with 1).

6. Now type in BTC_CONSOLE

   walletpassphrase “BTC_PASSPHRASE” 600
   dumpprivkey BTC_ORIGINAL_ADDRESS


Save your BTC_PRIVATE_KEY to Notepad.

7. Type in BTC_CONSOLE

   validateaddress BTC_SEGWIT_ADDRESS

There will be lines

   "scriptPubKey": "SCRIPT_PUB_KEY",
   …
     "script": "witness_v0_keyhash",
     "hex": "REDEEM_SCRIPT",


Save SCRIPT_PUB_KEY and REDEEM_SCRIPT to Notepad.

7. Go to BTG explorer again and type in your BTG_SEGWIT_ADDRESS. Save OLD_TRANSACTION_ID of every funding transaction. Also take note of the amount transferred to your address.

8. Type in BTC_CONSOLE

   gettransaction OLD_TRANSACTION_ID

9. Find lines

   "amount": OLD_TRANSACTION_AMOUNT,
   …
   "vout": OLD_TRANSACTION_VOUT


Save those two to Notepad. Do it for every OLD_TRANSACTION_ID.
Calculate AMOUNT_TO_GET by adding all OLD_TRANSACTION_AMOUNT and subtracting BTG_FEE.

10. Download and sync BTG Core from https://bitcoingold.org (takes days).

11. Generate a BTG_NEW_ADDRESS (you can use another wallet for that as well).

11. Open BTG_CONSOLE and type

   createrawtransaction '''[{"txid": "OLD_TRANSACTION_ID1", "vout": OLD_TRANSACTION_VOUT1}, {"txid": " OLD_TRANSACTION_ID2", "vout": OLD_TRANSACTION_VOUT2}, …]''' '{" BTG_NEW_ADDRESS ": AMOUNT_TO_GET}'
to generate BTG_RAW_TRANSACTION. Substitute … with the necessary amount of inputs (the number of OLD_TRANSACTION_IDs, could be just one) that funded your BTG_SEGWIT_ADDRESS.


12. Type in BTG_CONSOLE

   signrawtransaction " BTG_RAW_TRANSACTION " '''[{"txid": "OLD_TRANSACTION_ID1", "vout": OLD_TRANSACTION_VOUT1, "scriptPubKey": "SCRIPT_PUB_KEY", "redeemScript": "REDEEM_SCRIPT", "amount": "OLD_TRANSACTION_AMOUNT1"}, {"txid": "OLD_TRANSACTION_ID2", "vout": OLD_TRANSACTION_VOUT2, "scriptPubKey": "SCRIPT_PUB_KEY", "redeemScript": "REDEEM_SCRIPT", "amount": "OLD_TRANSACTION_AMOUNT2"}, …]''' '["BTC_PRIVATE_KEY", " BTC_PRIVATE_KEY", …]'

Again, substitute … the necessary amount of inputs. SCRIPT_PUB_KEY, REDEEM_SCRIPT and BTC_PRIVATE_KEY are the same (unless you try to combine different addresses in one transaction, which I will not cover here). Should give you BTG_RAW_TRANSACTION_SIGNED and say

   "complete" : true

13. Type in BTG_CONSOLE

   sendrawtransaction BTG_RAW_TRANSACTION_SIGNED

14. Wait for confirmations.

Feel free to ask for help in this thread. ATTENTION: never post or give anyone (including me) your BTC_PRIVATE_KEY. It may result in loss of BTG and, if they are still in that address, BTC.

P.S.: This may help you in case of multisig:
   https://bitcointalk.org/index.php?topic=2424484.0
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!