What's up with having to scan the blockchain for hours just to see the accurate balance after I add an old descriptor/key? But then when I send a transaction, it gets confirmed super fast. A lot of times, I see that first confirmation in just a few minutes. Usually, I'm in the next block or the one after that.
So how does the network manage to check for double spending so quickly?
I know this might seem like a silly question, but I'm really confused right now.
How does the network efficiently prevent double spending?
3 replies 135 views
SwiftMinerSenior Member
Posts: 259 · Reputation: 1036
#2Dec 24, 2019, 10:07 AM
When you add an old descriptor/key to your Bitcoin wallet it actually initiates a blockchain rescan to update its internal UTXO set and reflect the correct balance. The process may actually ttake hours because your wallet is re-processing the entire blockchain, checking for any transactions related to the newly added key, and updating its wallet database accordingly also maybe because you network connection is a little slow.
In contrast when you broadcast a Bitcoin transaction the network checks the mempool for duplicate transactions, verifying the transaction's TXID and hash, checking the blockchain headers for proof-of-work validation, and using SPV to verify the transaction's inclusion in the blockchain. These actually enable the network to efficiently prevent double-spending.
Op also note that the speed of your confirmation depends on the depth location of your transactions in the MEMPOOL. To place it at a lower depth in the MEMPOOL means you need to broadcast with a higher fee in that way it gets confirmed faster.
Actually it doesn't need to take hours if you specify "timestamp" on the imported descriptor.
Short answer, full node use UTXO index/database.
Blockchain rescan doesn't require network connection.
Please double check what you write. Transaction which just arrived on mempool is unconfirmed, so checking blockchain or block header isn't relevant. Using SPV approach doesn't make sense to full node either.
To be exact, higher fee rate.
Oh, that makes sense. Many thanks for the tip. I found a good explanation here:
https://www.reddit.com/r/Bitcoin/comments/wywsre/comment/im0g45w
Related topics
- What derivation path does mm-gen wallet use? 3
- bitcoin-qt sync issues and slow speeds 6
- Recovering a Bitcoin wallet and address 8
- Creating a list of non-zero wallets and their balances using Python 4
- CipherSeed: A Comprehensive Guide to Super-Secure Crypto Wallet Backups 5
- Curious about recovering BTC from 2010/2011 7