Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: sir_danny on December 22, 2021, 08:50:44 AM



Title: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: sir_danny on December 22, 2021, 08:50:44 AM
So I was starting to read Andreas' Antonopoulos' "Mastering Bitcoin" (http://"https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch02.asciidoc") and I was wondering about this diagram:

https://i.imgur.com/ETdiSwm.png

Quoting from the book

Quote
In summary, transactions move value from transaction inputs to transaction outputs. An input is a reference to a previous transaction’s output, showing where the value is coming from. A transaction usually includes an output that directs a specific value to a new owner’s Bitcoin address and a change output back to the original owner. Outputs from one transaction can be used as inputs in a new transaction, thus creating a chain of ownership as the value is moved from owner to owner

My question is:
 ???

Does "Output 1" mean that there will be a new "Input" for Alice's account?


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: NeuroticFish on December 22, 2021, 09:09:31 AM
So I was starting to read Andreas' Antonopoulos' "Mastering Bitcoin" (http://"https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch02.asciidoc") and I was wondering about this diagram:
~
Quoting from the book

Quote
In summary, transactions move value from transaction inputs to transaction outputs. An input is a reference to a previous transaction’s output, showing where the value is coming from. A transaction usually includes an output that directs a specific value to a new owner’s Bitcoin address and a change output back to the original owner. Outputs from one transaction can be used as inputs in a new transaction, thus creating a chain of ownership as the value is moved from owner to owner

My question is:
 ???

Does "Output 1" mean that there will be a new "Input" for Alice's account?

Umm... from what I understand there, this is your own wallet. You are Alice.
So I see that input 1 as the change from an older transaction of yours. (you'll understand this later).

You send money to Bob, but less than your total, hence you create one output (1) that'll be sent to Bob and one output (2), the change, back to yourself.
So this output 2 is money you have sent to yourself. So the wallet sees as money coming to you, or, as an input.
This input can be seen then as input 2. And you can make from it new transactions, like you've done with input 1. And maybe the starting part is clearer too.

All this is "somewhere in the middle" of the "life" of your coins, since at very start, the first input to your wallet clearly came from elsewhere (let's say from John).

This was a transaction involving change and that's why it may be a bit confusing.
If it's the first transaction from the "chain", then we'll have:

Code:
[John's wallet]---(his output x, Alice's input 1)--->[Alice's wallet]----(send money to Bob, Alice's output 1, Bob's input 1)--->[Bob's wallet]
                                                                     ----(same transaction, the remaining change, Alice's output 2, Alice's input 2)--->[back to Alice's wallet]


Edit:
* If I was not clear, please ask further. I know that sometimes I don't explain best.
* Your link to the is broken, you may want edit the post and fix it = remove the quotes and the extra http:// part.


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: BitMaxz on December 22, 2021, 09:17:30 AM
I think the change output is what are you talking about?

Yes, it will become input again if you create another transaction for now it's output. It's just like you are buying shoes at a price of $59 but you don't have the exact amount of $59 and you only have $100. You pay $100 to the seller and you will get a change amount of $41.

It's the same as what Bitcoin transaction works.

Just adding this sample image below to understand it a bit

https://i.imgur.com/bKRwu9Q.png

This is another image below

https://cryptoarmy.io/wp-content/uploads/2021/12/Instead-Andreas-sends-Alex-all-3-Bitcoins-and-receives-2-Bitcoins-in-balance..png
Source: https://cryptoarmy.io/how-does-instant-bitcoin-transaction-work-worldly/


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: bitmover on December 22, 2021, 10:40:24 AM
I think the change output is what are you talking about?

Yes, it will become input again if you create another transaction for now it's output. It's just like you are buying shoes at a price of $59 but you don't have the exact amount of $59 and you only have $100. You pay $100 to the seller and you will get a change amount of $41.

It's the same as what Bitcoin transaction works.

Just adding to this  answer.
A single address may also have multiple inputs (or UTXO).

For example,  if you receive multiple payments in the same address (such a donation address ) each donativo  will be a new output or a new input (if spent in a transaction)

Take a look at this example:
Wikileaks donation address has multiple outputs
https://blockchair.com/bitcoin/address/36EEHh9ME3kU7AZ3rUxBCyKR5FhR3RbqVo
Quote
Output count
701
Unspent output count
684


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: AGD on December 22, 2021, 10:43:31 AM
There are no inputs, only outputs.  8)


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: tbct_mt2 on December 22, 2021, 12:28:54 PM
Does "Output 1" mean that there will be a new "Input" for Alice's account?
Output can be an old address or a change address. The latter one (change address) is recommended to use. If you create and use multiple addresses in a single wallet, Output 1 can be use as input or part of inputs for your future transactions.

You can use a whole Output 1 or part of it and then you will have another change address as Output 2 from leftover of Output 1.


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: Charles-Tim on December 22, 2021, 03:19:37 PM
Does "Output 1" mean that there will be a new "Input" for Alice's account?
Yes, but it is Alice wallet.

Assuming you are Alice, you were sent 1 BTC. You sent 0.4 BTC to Bob, the 0.4 BTC output you sent to Bob will becoming input for Bob and Bob will be able to spend from it. But not only that, the remaining 0.6 BTC will be sent back to change address generated on your wallet which is what you are referring to. Anytime you want to spend again, you can spend the change address utxo.


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: BitMaxz on December 22, 2021, 11:18:05 PM
Yes, but it is Alice wallet.

Assuming you are Alice, you were sent 1 BTC. You sent 0.4 BTC to Bob, the 0.4 BTC output you sent to Bob will becoming input for Bob and Bob will be able to spend from it. But not only that, the remaining 0.6 BTC will be sent back to change address generated on your wallet which is what you are referring to. Anytime you want to spend again, you can spend the change address utxo.


It won't become input if you receive a change in your wallet it would be still an output or we can call it (Unspent transaction output)UTXO.

It only becomes inputs when you make a transaction just like what you see on the image above as a sample.


Title: Re: A question about inputs and outputs - re: Aantonop's bitcoin book
Post by: Charles-Tim on December 22, 2021, 11:29:16 PM
It won't become input if you receive a change in your wallet it would be still an output or we can call it (Unspent transaction output)UTXO.
Never mind my mistake. I absolutely agree, both the bitcoin sent to 'Bob' and 'Alice change address' are both utxo.