MultiversX Tracker is Live!

BTC synchronization in Bitcore [duplicate]

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 123 Views

I had to do this for a Dogecoin wallet that was very out of sync once. I will outline the steps that worked for me. My example will be for Bitcoin, though, since that's probably what most people will need.

Caution: this is a bit technical, but it works. Expect this to take probably 10-30 minutes. This also assumes you are using a standard Pay-To-Pubkey-Hash address (for bitcoin, this just means an address that starts with a 1).

1.

Obtain the address that you were sent coins to. This is an address that the unsynced Bitcoin-QT wallet previously generated. For this example, I will use

13x1ZipMJJbVawV7voCtW5qSoBUTwx13Nr

as my address that I need to get coins out of.

2.

Go to https://insight.bitpay.com/address/{{ your address }}.

Find the transaction TXID, output index, and amount of the coins you are trying to spend from the block explorer.

  • To get the transaction ID, use the hex code at the top of the transaction box.
  • To get the output index, count the transaction outputs from zero until you find your address. For example, in the transaction shown below, my 13x... address received coins in the first output, which means index zero. If it were in the second output, it would be index 1, etc.
  • To get the amount, make sure you select "BTC" as the website units (in the top right). Then copy the amount from the output where you see your address receiving coins.

So for me, the important information here is:

txid: 83a1007401a6acb656668afc137b9c02ca023ae274e0f12abbc79395a89b6b79
index: 0
amount: 0.00231499

enter image description here

3.

The other piece of information that we need is the scriptPubKey. This is basically just a more low-level encoding of the address.

To get this, click the "+" icon to the left of the TXID (still on the same insight page as before). Under your address, it will say something like:

OP_DUP OP_HASH160 205799b3b8bdba5824b0129eec27450b0cfde7eb OP_EQUALVERIFY OP_CHECKSIG

Now the scriptPubKey that you want is using those middle 40 hex characters, plus a few more. The basic formula is:

scriptPubKey = "76a914" concat {{ hex chars from above }} concat "88ac"

So for my example, we have:

scriptPubKey: 76a914205799b3b8bdba5824b0129eec27450b0cfde7eb88ac

4.

Almost done!

Get the address you want to send the coins too. I will use

1PwFdFxP7uXrun8sToCrWXxVdpeDeX6dfq.

5.

Now we are going to create a transaction and send it out to the network.

Open up the unsynced Bitcoin-QT wallet (or start the bitcoind daemon), and go to the Help menu, and select Debug Console. In the window that opens, replace the appropriate fields, and then type:

createrawtransaction '[{ "txid": "{{ your txid }}", "vout": {{ your index }} }]' '{ "{{ your address from step 4 }}": {{ amount - fee }} }'

Typically, a fee of about 0.0001 applies.

So, for me this looks like:

createrawtransaction '[{ "txid": "83a1007401a6acb656668afc137b9c02ca023ae274e0f12abbc79395a89b6b79", "vout": 0 }]' '{"1PwFdFxP7uXrun8sToCrWXxVdpeDeX6dfq": 0.00221499}'

And the result is

0100000001796b9ba89593c7bb2af1e074e23a02ca029c7b13fc8a6656b6aca6017400a1830000000000ffffffff013b610300000000001976a914fb9570085ff3acfef21eac307223eaa499e1e21188ac00000000

Now we just have to sign it. This has to be done on the same daemon that generated the address, so that you have the private keys. Replace with your appropriate fields and then execute:

signrawtransaction {{ hex from createrawtransaction step above }} '[{ "txid": "{{ your txid }}", "vout": {{ your index }}, "scriptPubKey": "{{ your scriptPubKey }}" }]

So, for me this looks like:

signrawtransaction 0100000001796b9ba89593c7bb2af1e074e23a02ca029c7b13fc8a6656b6aca6017400a1830000000000ffffffff013b610300000000001976a914fb9570085ff3acfef21eac307223eaa499e1e21188ac00000000 '[{ "txid": "83a1007401a6acb656668afc137b9c02ca023ae274e0f12abbc79395a89b6b79", "vout": 0, "scriptPubKey": "76a914205799b3b8bdba5824b0129eec27450b0cfde7eb88ac" }]'

The result looks like:

0100000001796b9ba89593c7bb2af1e074e23a02ca029c7b13fc8a6656b6aca6017400a183000000006a4730440220000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000000012102e25c37498e9e62b2ebcc85780e10949eaacd29826b5ca97a1031ee22e55f0ab5ffffffff013b610300000000001976a914fb9570085ff3acfef21eac307223eaa499e1e21188ac00000000

6.

Using the final result of step 5, go to

https://live.blockcypher.com/btc-testnet/pushtx/

And enter the raw transaction hex. Select the "Bitcoin" network, hit the "Broadcast Transaction" button, and you will have successfully removed your coins from the unsynced wallet!

(I don't have any affiliation with any of the services used here, I just found them useful for this answer.)


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments