Author

Topic: Basic transaction question (Read 699 times)

HCP
legendary
Activity: 2086
Merit: 4361
May 23, 2017, 02:01:34 AM
#12
I have found that for some people it helps to think of bitcoin as chunks of gold... your wallet is like a little mini vault, where you store all the chunks that you get.

So say you receive 1 btc, 0.1 btc and 0.01 btc... you now have 3 chunks of gold in your vault worth 1.11 in total.

Now you want to send 0.05 btc to someone. You hand your 0.1 btc chunk to the miners and tell them they can keep 0.0001 btc for their services (miners fee), they break your chunk up, making  a 0.05 chunk that they deliver to the other person, a 0.0001 chunk that they keep for themselves as the fee and then give the remaining chunk of 0.0499 btc back to you as change.

Now, your vault contains 3 chunks, 1 btc, 0.0499 btc and 0.01 btc... worth 1.0599 btc.

It is also possible to take a number of smaller chunks, give them to a miner... and they can "melt it down" producing one bigger chunk (minus their fee of course)...

Hopefully that helps a little... Wink

legendary
Activity: 4466
Merit: 3391
May 22, 2017, 01:46:53 PM
#11
Thanks everyone for your responses.

Is change like this produced on every transaction? Or, more clearly, what's the trigger or criteria that will produce the change? Knowing this helps the rest us know when we need to be aware of the change and where it's being sent after a transaction.

You must send the full amounts of the inputs. If you don't actually want send all of it, the remainder must be sent somewhere. Your wallet creates a new ("change") address and sends the leftover amount to that.
hero member
Activity: 1106
Merit: 638
May 22, 2017, 11:56:32 AM
#10
Thanks everyone for your responses.

Is change like this produced on every transaction? Or, more clearly, what's the trigger or criteria that will produce the change? Knowing this helps the rest us know when we need to be aware of the change and where it's being sent after a transaction.
legendary
Activity: 4466
Merit: 3391
May 22, 2017, 12:51:21 AM
#9
Here is a long example:

Let's say that somebody sends you 0.5 BTC twice, for a total of 1 BTC, and you want to send 0.75 BTC to somebody. Your wallet will construct this transaction:

Inputs: 0.5 BTC, 0.5 BTC
Outputs: 0.75 BTC, 0.2499 BTC
(fee paid is 0.0001 BTC)

After that transaction, your wallet has 0.2499 BTC (the "change" from the previous transaction).

I suppose this starting to make sense. What time frame exists for your inputs and outputs example above? When does a transaction settle to just leave me with a balance that maybe a month from now I draw on again with a new transaction? I would normally assume that a new transaction would stay clean, e.g., my 0.5 BTC out for a payment, no change needed.

There is no "settling" and no balance. The balances your wallet shows you are computed by the wallet for your convenience. The balance for an address is simply the sum of the outputs using that address that have not yet been used as inputs.

Time is not relevant. Your 0.75 BTC transaction will be the same whether it is made immediately after the two 0.5 BTC transactions or 100 years later (assuming there are no others in between).
legendary
Activity: 3472
Merit: 10611
May 21, 2017, 11:32:26 PM
#8
~
Would your answer differ if I said this transaction was sent from a Coinbase wallet?
~

it doesn't matter, even if a web wallet like Coinbase is used. they are having some transaction outputs (the 100 dollar bill) in their pocket and pay it on your behalf. the principle is still the same as long as the transaction is on chain.
legendary
Activity: 1162
Merit: 1000
May 21, 2017, 03:21:09 PM
#7
By default, what is not sent for an address is sent as transaction fee.
So if you want to send less than the entire balance, you should send back the amount you want to your address, or some other in the same wallet, as an additional input.
That should explain what you've seen
hero member
Activity: 1106
Merit: 638
May 21, 2017, 02:45:05 PM
#6
Here is a long example:

Let's say that somebody sends you 0.5 BTC twice, for a total of 1 BTC, and you want to send 0.75 BTC to somebody. Your wallet will construct this transaction:

Inputs: 0.5 BTC, 0.5 BTC
Outputs: 0.75 BTC, 0.2499 BTC
(fee paid is 0.0001 BTC)

After that transaction, your wallet has 0.2499 BTC (the "change" from the previous transaction).

I suppose this starting to make sense. What time frame exists for your inputs and outputs example above? When does a transaction settle to just leave me with a balance that maybe a month from now I draw on again with a new transaction? I would normally assume that a new transaction would stay clean, e.g., my 0.5 BTC out for a payment, no change needed.
legendary
Activity: 4466
Merit: 3391
May 21, 2017, 02:25:30 AM
#5
Transactions work with inputs and outputs. The output of one transaction becomes an input of another transaction.

Here is a long example:

Let's say that somebody sends you 0.5 BTC twice, for a total of 1 BTC, and you want to send 0.75 BTC to somebody. Your wallet will construct this transaction:

Inputs: 0.5 BTC, 0.5 BTC
Outputs: 0.75 BTC, 0.2499 BTC
(fee paid is 0.0001 BTC)

After that transaction, your wallet has 0.2499 BTC (the "change" from the previous transaction).

Now, you want to send 0.1 BTC. The wallet constructs this transaction:

Inputs: 0.2499 BTC
Outputs: 0.1 BTC, 0.1498 BTC
(fee paid is 0.0001 BTC)

Your wallet now holds 0.1498 BTC. Then someone sends you 0.1 BTC, so you have 0.2498 BTC.

Now, you want to send 0.2 BTC. You wallet constructs this transaction:

Inputs: 0.1498 BTC, 0.1 BTC
Outputs: 0.2 BTC, 0.0497 BTC
(fee paid is 0.0001 BTC)
hero member
Activity: 1106
Merit: 638
May 20, 2017, 11:44:52 PM
#4
This analogy is confusing for me because I'm choosing how much money to use to pay for the transaction. I chose to pay with exact change. (Recognizing it's likely possible I'm just missing key foundational understanding of how transactions work.)

Would your answer differ if I said this transaction was sent from a Coinbase wallet?

Thanks...I appreciate both of your comments.

if you had one 100 dollar bill and you wanted to pay someone 50 dollar, so what do you do? you tear the 100 dollar bill in half and give half of it (50 dollar) to that someone and put the other half (50 dollar) in your pocket Smiley

the same is true about bitcoin.
in bitcoin there is no such thing as "coins" or "bitcoin" there are only transaction outputs and you spend those.
here you had 1 transaction output called c4473ecd47d5cbe10c560579ff2f989c05a33e7a9a8df718da0db7cec4c98577 which was worth 0.05BTC and you wanted to pay someone 0.022BTC.
so what do you do?
you break that amount into two new amounts: 0.022BTC + 0.02708601BTC give the 0.022 to that someone and put the rest in your pocket (the newly generated change address).
and the difference goes to the miners as fee (0.00091399BTC)
legendary
Activity: 3472
Merit: 10611
May 20, 2017, 11:21:50 PM
#3
if you had one 100 dollar bill and you wanted to pay someone 50 dollar, so what do you do? you tear the 100 dollar bill in half and give half of it (50 dollar) to that someone and put the other half (50 dollar) in your pocket Smiley

the same is true about bitcoin.
in bitcoin there is no such thing as "coins" or "bitcoin" there are only transaction outputs and you spend those.
here you had 1 transaction output called c4473ecd47d5cbe10c560579ff2f989c05a33e7a9a8df718da0db7cec4c98577 which was worth 0.05BTC and you wanted to pay someone 0.022BTC.
so what do you do?
you break that amount into two new amounts: 0.022BTC + 0.02708601BTC give the 0.022 to that someone and put the rest in your pocket (the newly generated change address).
and the difference goes to the miners as fee (0.00091399BTC)
legendary
Activity: 2296
Merit: 1014
May 20, 2017, 06:28:15 PM
#2
By me, its that u had 0.049 in your bitcoin addresses. When you send only 0.022 bitcoin by design spend whole 0.049 in this way:
1. One part is amount u send to specific address (0.022)
2. Rest of money is sent as change to your other address in a wallet (could be hidden, that how some wallet works).

hero member
Activity: 1106
Merit: 638
May 20, 2017, 02:50:30 PM
#1
This is a basic transaction question, thanks in advance for the education.

I sent a transaction to someone for BTC0.022, however when I look at the TXID on the blockchain it shows a total output of BTC0.049 (plus some dust).

Here's the TXID: a445eb2606c75627e93dc8f28a2464e01799816ef647a8d219b19be1ff41be35

Can someone explain to me what's happening?

Thank you.
Jump to: