3

Here is an example of multiple transactions in the same block, all spending from the same output. I created these using the Electrum wallet, telling Electrum to spend a little bit of the BTC from the same 1AD9xV6aeQMPMzfv5Nzk8yNDgtyV3LaUkB address each time

See: https://blockchain.info/address/1AD9xV6aeQMPMzfv5Nzk8yNDgtyV3LaUkB

Kinda looks like a double spend

When I try doing a similar thing myself with Python and the Pycoin library, the second transaction gets flagged as a "double spend" when I submit it to blockchain.info/pushtx. The response I get is:

An outpoint is already spent in [DBBitcoinTx [txIndex=101360418, getEstimatedBTCSent()=0, isGeneratedBlockReward()=false, getTotalBTCSent()=0, getHash()=1766bb1b732db7b3eef1bea27a572651ee343d79ca6c5b9e866e2f97e8df85aa, getVersion()=1, getSize()=258, toString()=BitcoinTx{hash=1766bb1b732db7b3eef1bea27a572651ee343d79ca6c5b9e866e2f97e8df85aa, version=1, lockTime=0, in=[], out=[]}, getClass()=class piuk.blockchain_db.DBBitcoinTx]] [(101355273, 1)]

Like in the first example, the total spent by all the transactions never exceeds the total available at that address, so I'm curious why this is considered a "double spend".

How should you structure a series of transactions spending from the same address so that a double spend is not triggered?

  • The three transactions you show spend different outputs. – Nick ODell Sep 9 '15 at 9:20
  • Blockchain.info is an authority on nothing, their rules are not Bitcoins rules. – Anonymous Sep 9 '15 at 9:21
  • 2
    same address doesn't mean same output. It's only a doublespend if it spends the same outputs. Addresses can have more than one output. – Murch Sep 9 '15 at 9:43
2

Adding my own answer after doing some research: An address and an output are different things. A transaction may have many inputs and many outputs. Here is a good visualization from bitcoin.org:

enter image description here

A double spend occurs when the same BTC is used to pay two different people. This will never happen on the blockchain because the Bitcoin network guarantees a consistent ledger. But, what about the unconfirmed transactions that live in the miners' mempools?

Some inconsistencies in the mempool may not manifest until they are added or not-added to the blockchain, others we can flag as invalid right away e.g. amount exceeds available funds etc; If unconfirmed transactions were not checked for validity, an attacker could flood the mempool with bogus transactions and cripple the network.

A submitted transaction that has the exact same inputs and outputs as another unconfirmed transaction in the mempool is rejected by the Bitcoin network (even if it was a valid financial transaction). For example, I could send 1 BTC from A to B, and while the transaction is unconfirmed, send another 2 BTC from A to B. As long as A has 3 BTC to cover the transfers, these transactions are consistent, but conservatively rejected by miners.

You can see this yourself with the Electrum wallet using the "Send From" option. Normally, Electrum picks valid inputs for you, but you can override this. Create a transaction specifying the from and to addresses. Then, create another transaction with same from and to (but the amount can differ). If the first transaction is still pending, you'll get the following error:

enter image description here

1

Since the amounts are different ($23.75, $23.89, and $24.03), they can't possibly be the same output.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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