0

I was just looking through some of the blocks and I saw a transaction which had 408.1011 BTC split into 3 output address. 18.5468, 230.6512 and 158.9030731.

I then saw the 230.6512 use the transaction id and send it to 2 address. I know it was the 230.6512 only because the output was 9.2293 & 221.420555.

My question is, how can I find out that the address associated with 230.6512 is spent but the other 2 are not?

The reason I'm asking is because if you don't know which private key signed this transaction, then how can you find out how much balance a private key has left to spend?

Edit: Just found vout Looks like this is what I was looking for. Seems that it points to the index of the output used.

1 Answer 1

3

Your question is based on a misconception. The Bitcoin protocol does not operate on addresses, or balances.

Transactions have outputs and inputs. Each outputs creates a "coin", of a certain value, and with a certain condition under which it can be spent. Every input spends a coin - in its entirety - by referencing that coin explicitly, and proving it is allowed to spend it.

Those spending conditions are often represented for human consumption as addresses, but "address balance" is simply the sum of the values of all coins with a spending condition matching that address, which have not yet been spent.

So how do wallets, and the protocol, determine whether a transaction is valid? Not by looking at its balance, but by checking that the coin referenced in the input hasn't been spent yet, that the transaction contains valid signature(s) for it, and that the sum of the values of the inputs is at least as much as the value of the outputs being created.

What block explorer websites show you is deceiving. They try to represent transactions as reducing the balance of some addresses, and incrementing the balance of others. This isn't what's actually happens. In reality, transactions just melt down and reforge coins.

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.