1

For eg. if Ta and Tb are a double spend of the same transaction with different outputs. These two transactions can flow through different path in the network, and assume flow in exactly opposite path. So Ta reaches miner Ma who creates a block and Tb reaches another miner Mb. Now, Ma may solve the block with Ta and Mb with Tb. Both start broadcasting the respective blocks with Ta and Tb to be a part of block chain (fork created here).

After fork is created and before it is resolved, what is actual balance appearing on the account? Is it double down and gets credited later on?

1

In your example, only one of the blocks will become part of the longest valid chain, and the transaction included in that block will become a part of the blockchain history. The other block would be discarded, this is what is often called an 'orphan block'.

Wallet software will show you an 'account balance', but understand this is not how the book keeping works at the protocol level. The blockchain keeps track of 'unspent outputs', which are bitcoin addresses with some as-of-yet unspent balance stored in them. A double spend is an attempt to spend a certain unspent output more than once, but ultimately the network will only accept one of those two (or more) transactions into the blockchain.

Once one of the transactions is included in the blockchain, those bitcoins now reside at a new address, and the other transaction (and any block it is included in) is dropped from the network. There is no 'double debit' from an account, so to speak. Bitcoins exist at one address, and then once a valid transaction is confirmed in the blockchain, those bitcoins exist at a new address.

I suppose some wallet software could be written to debit all unconfirmed transactions from a wallet's balance (thus allowing a 'double debit, as in your example), but this would be a naïve implementation that is not representative of what is actually happening at the protocol level.

  • The OP is asking about what happens before one of the blocks is orphaned. I.e. they are both on separate chains of equal length. – Adam Millerchip Jan 30 '18 at 3:10
  • @AdamMillerchip At that point, each node on the network will have chosen one chain or the other, and will update their UTXO appropriately (to include Ta or Tb, depending on which block they've accepted). Until the network converges back to a single chain, txs spending either Ta's/Tb's output will be accepted by the portion of the network that sees each of those txs as confirmed. Any one node will not accept more than one chain as valid at the same time. If they accept the 'wrong' one, and the other is extended first by miners, then their client will simply update to the new longest valid chain – chytrik Jan 30 '18 at 5:19
  • Before the orphaning, from OPs perspective, the wallet OP is using will end up on either one half of the network, or the other. Their wallet should simply show a single debit from their balance, and the corresponding tx (either Ta or Tb). – chytrik Jan 30 '18 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.