Bitcoin Forum
May 05, 2024, 03:51:25 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Let me clarify one more thing with transactions  (Read 453 times)
AliceWonder (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100



View Profile
July 06, 2013, 07:00:10 AM
 #1

Assume bitcoin-qt client but I don't think it matters. And assume no miner fees. And assume everyone starts with 0 BTC.

Bob has seven people each send him 1 BTC. Let's say they went to seven different addresses in his wallet.

Bob sends 7 BTC to Mary. The transaction will involve all seven of Bob's keys (signed by private and include public) to prove he has right to spend those 7 BTC.
But the transaction will be a single transaction even though it comes from 7 different addresses.

Mary sends 4 BTC to Freddie.

What will happen is two outgoing transactions, both signed by Mary's public key.
One worth 4 BTC that goes to Freddie and one worth 3 BTC that goes to a fresh address in Mary's wallet.

So Mary will still have 3 BTC in her wallet but the address she received the 7 at will show 0 BTC.

Is this correct?

QuarkCoin - what I believe bitcoin was intended to be. On reddit: http://www.reddit.com/r/QuarkCoin/
1714924285
Hero Member
*
Offline Offline

Posts: 1714924285

View Profile Personal Message (Offline)

Ignore
1714924285
Reply with quote  #2

1714924285
Report to moderator
Unlike traditional banking where clients have only a few account numbers, with Bitcoin people can create an unlimited number of accounts (addresses). This can be used to easily track payments, and it improves anonymity.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714924285
Hero Member
*
Offline Offline

Posts: 1714924285

View Profile Personal Message (Offline)

Ignore
1714924285
Reply with quote  #2

1714924285
Report to moderator
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 06, 2013, 07:15:04 AM
 #2

No.  This portion is incorrect.

Quote
Mary sends 4 BTC to Freddie.

What will happen is two outgoing transactions, both signed by Mary's public key.
One worth 4 BTC that goes to Freddie and one worth 3 BTC that goes to a fresh address in Mary's wallet.

The transaction from Mary will be a single transaction

Input0: 7 BTC sent from Bob.
Output0: 4 BTC to Freddie
Output1: 3 BTC "change" back to Mary.

It is best to always think about transactions as simply inputs and outputs.  In Bob's case if he received 7x 1 BTC inputs it doesn't matter if they were sent to 7 addresses or all 7 to one address regardless they are 7 discrete inputs.  So Bob's tx would look like this

Input0: 1 BTC
Input1: 1 BTC
Input2: 1 BTC
Input3: 1 BTC
Input4: 1 BTC
Input5: 1 BTC
Input6: 1 BTC
Output: 7 BTC (to mary)

A couple of general rules
1) Transactions consists of one or more inputs and outputs.
2) The sum of the inputs of a tx must be equal to or greater than the sum of the outputs
3) If the sum of inputs is greater than the sum of the outputs the difference is the fee paid to miners.
4) All tx (except coinbase txs) have as their inputs, the unspent outputs of prior transactions.
5) Outputs can only be unspent or spent.  You can't spend part of an output.







DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
July 06, 2013, 01:26:38 PM
 #3

Assume bitcoin-qt client but I don't think it matters.

It does matter.  Each wallet has its own way of handling the "change" in the transaction.  Bitcoin-Qt uses a new completely random address for the change.  blockchain.info sends the change back to the main address displayd for your wallet when you log in.  I can't remember which one, but I think either MultiBit or Electrum send the change to the second address in your address list (if you have more than one address, otherwise it sends to the only address in the list).
 3 BTC that goes to a fresh address in Mary's wallet.

So Mary will still have 3 BTC in her wallet but the address she received the 7 at will show 0 BTC.

Is this correct?

This is where the wallet matters. DeathAndTaxes already took care of correcting the rest of your confusion, but you may want to be aware that the protocol says nothing about where you have to send the "change", only that any value from the sum of the inputs that is greater than the sum of the outputs becomes fees to the miner.  If you don't want that excess value to be paid to the miner, then you have to send it "somewhere". The protocol doesn't really care where you send it.  As such, each wallet designer has chosen their own way of deciding where to send that excess value.
AliceWonder (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100



View Profile
July 06, 2013, 05:34:40 PM
 #4

OK thank you, I think I got it now.

QuarkCoin - what I believe bitcoin was intended to be. On reddit: http://www.reddit.com/r/QuarkCoin/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!