15

Can a Bitcoin transaction have the same address for input and output, i.e. spend some of the coins that are linked to an address and send the rest back to that same address? Is there some reason why it is imprudent to do so?

0

4 Answers 4

17

At the protocol level, there is no such thing as "balance of an address". There are individual unspent outputs (like coins in a wallet), which must be individually spent. You can't partially spend an output, but you can split/combine it.

So for example, you have a 70 BTC output assigned to an address, and a 80 BTC output assigned to the same address. Some software will show this as 150 BTC balance of that address, but you still need to know the individual outputs to spend them. If you want to send 100 BTC to someone, you would consume those two outputs in a transaction, and create two new outputs using it, a 100 BTC one (to the recipient) and a 50 BTC one (back to yourself).

Whether you use a new address for that 50 BTC "change" output doesn't matter to the protocol. You can reuse the old one, but will make it obvious to everyone in the world which who was the sender and who was the recipient in the transaction. Using a fresh address improves privacy.

Seen otherwise: reusing the same address may look convenient, as it allows you (and software you use) to more easily distinguish what your balance is, but it does this at the cost of making it obvious to everyone in the world. This hurts Bitcoin's privacy - not just yours, but that of everyone in the system.

10

Yes it can. See this transaction below.

https://blockchair.com/bitcoin/transaction/b345c51064074f5d6c0e11187326567765eb4fa3236ca1be440ccb5745775238

2

Yes, and you might want to read up on handling change as that's one good reason to do so.

1

You can even have a transaction with only 1 input and 1 output, both being the same address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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