If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Bitcoin: Transaction records

The basic mechanics of a bitcoin transaction between two parties and what is included within a given bitcoin transaction record. Created by Zulfikar Ramzan.

Want to join the conversation?

• At , why must alice spend all of her coins and ask for some back? Why can't she just send the correct amount (50, in this case)?
• She only has 3 inputs: 25, 20 and 20. They must all be spent or else there would be less than 50 which she wants to send. Each input can only be spent once, so she spends all of them, and gives 50 to Bob and 14 back to herself. The 1 BTC left over is given to the miner as a fee. If she didn't give the 14 BTC back to herself, then all 15 BTC would be give to the miner.
• what if no Bitcoins are assigned to the miner for the transaction. Could it happen that the transaction isn't processed by any of the miners? If so, what happens to the Bitcoins assigned to the attempted transaction? .. will they be in limbo forever? Can the transaction be cancelled if it isn't being processed by the miners?
• Yes. I've tried it once before. Most wallets will stop broadcasting such transaction after some time and return it to the sender.
If the transaction's OUTPUT is <0.01BTC, and no transaction fee is added, the transactions will probably never verify.
• How do the digests of the previous transactions (D_C, D_D and D_T) guarantee that those transactions really took place? What if Alice just makes up a transaction that never happened (such as 10000 <-> VK_E) and includes it?
• Bitcoin miners have the entire record of all transactions, so when they receive a new transaction they check that the inputs to the new transaction are valid outputs of previous transactions and that the inputs have not been spent already. Miners will ignore transactions that don't meet the requirements.

If there was a bad miner that decided to include a bad transaction in a block, then the other miners would detect the invalid transaction in the block and ignore the block.
• Maybe getting ahead of the series here, but it's not ACTUALLY typical that a transaction sends bitcoins to a verification key directly. It is sent to a (RIPEMD) HASH of a verification key (confusingly). It's not until Bob actually spends the output, that he reveals his verification key. Perhaps a future video could explain this as well as the virtual machine that executes to verify transactions and allow for more complex types of transactions than simple A->B transfers.

Another nit - I believe Alice's signature appears once per input in a transaction - not one for the whole transaction block.
• Thank you for point this out. Tou are absolutely correct. I was loose in terms of what an actual bitcoin identifier is (i.e., hash of a public key vs. public key). I glossed over this detail to keep things simple since in terms of the higher level architecture/mechanics, how the identities are passed isn't so material (as long as there is a way to figure out who the transaction is meant for). I also left out the index field in the input and the FORTH-like Script since it's hard enough to understand the most basic bitcoin use case, let alone some of the other more complex cases. Once someone gets a handle on the core part of bitcoin, my thinking is that it is easier to see how these enhancements can be folded in.
• If a miner must review the entire blockchain to validate that Alice has the bitcoins she represents, then how can this be done in a timely way as the blockchain gets bigger and bigger ... Ultimately won't there be a scaling problem as the number of transactions and length of the blockchain becomes extremely large?
• Each node keeps an index of unspent transaction outputs. When a new transaction or block comes in that index is referenced to find the appropriate transaction referenced by the transaction inputs. When a new transaction is accepted the transaction outputs that it spends can be removed from the index. Accordingly it only has to track the unspent set not every transaction in the block chain. That said as it is today the whole block chain must be downloaded. But there is work under way to fix this. https://bitcointalk.org/index.php?topic=204283.0
• The transaction block chain has to be stored somewhere. Will it not become insanely large over time? Where do miners store the chain? How is it searched?
• Miners would tell every node on the network about their new blocks, and each node will then store the blockchain on their own hard drive. The bitcoin blockchain right now is about 80 GB, which is insanely large indeed, but not all nodes need to store the whole chain, but only the last few blocks.
• If I buy a single Bitcoin in 2013 and decide to save it for 100 years, will it expire? Will the 2113 transaction force miners to retain that transaction record from 2013? It seems my coin is dependent on my client software allowing me to spend it and miners accepting the transaction. Is there a way to backup my coin?
Thanks
• There is no expiration date.

Yes, your transaction entry is always a part of the "chain."

Coins are associated with bitcoin wallets, so the way to back it up is to keep a copy of your wallet ID number.
• Are miners people or automated software on a computer?

What if we have a transaction fee of 1 Bitcoin can 2 miners verify the transaction? Does each minor get half of the Bitcoin transaction fee?
• Miners are people who are using tools to mine bitcoins. Those tools are automated software and miners basically just sit and watch their bitcoins increase (sitting and watching is not mandatory).

The process of how two miners verifying the transaction at the same time is resolved is talked about in the Bitcoin: Transaction block chains video.

In short the miner that provides the most resource consuming (least statistically likely) proof will prevail and get all transaction fees. In reality the miners tend to create groups called pools and share all of their income in the group based on the amount of work done by their computers. This is done to get steady bitcoin income, working alone to get any success might take a year or longer.
• Does it have to be a transaction fee for the miner? Wouldn't it work without it? And who decides how high is the transaction fee or how is it calculated?
(1 vote)
• Bitcoin miners act like auditors in the bitcoin system by adding transaction (blocks) to the transaction block chain (thereby legitimizing the chain). They currently have two incentives for engaging in the effort required to add transactions to transaction block chains: (1) They are rewarded a number of bitcoins if they succeed in getting transaction blocks added to the transaction block chain (25 bitcoins at the present time -- May 2013 -- and going down by half approximately every four years); (2) They are paid a transaction fee. Eventually the bitcoin reward will be zero (or at least close enough to 0 where it will not be a sufficient incentive). In this case, the miners need some incentive to carry on with the mining effort. The hope is that transaction fees will be enough incentive. The transaction fee is actually set by the party in the transaction that currently owns the bitcoin. In the running example given in the videos, this party would be Alice. Alice lists what fee she is willing to pay. This fee is specified implicitly; in the implementation, Alice has to specify the incoming transactions (i.e., the inputs) and the outgoing transactions (i.e., how much she'd like to give to Bob and other parties and how much change she wants for herself). Whatever remains unaccounted for becomes the transaction fee. Alice needs to set the fee appropriately so that bitcoin mining nodes have an incentive to proceed. If the fee is set to 0, then bitcoin miners may simply choose to ignore the transaction. On the other hand, Alice may not need to set the fee too high since bitcoin miners will get paid the sum of all the transaction fees in the block of transactions that they added to the chain. And the marginal computational cost of having extra transactions in the block is relatively small (the heavy lifting is in finding the proof of work). If Alice sets the fee really high, then nodes in the bitcoin network that have a lot of dedicated computational power might clamor to add the transaction. If the fee is set really low, then these nodes might not be as interested -- but then perhaps some of the less computationally powerful nodes will step up. It's not clear what will happen in this scenario and how it will play out -- but it will definitely be interesting to see how it evolves.
• How would you acquire your very first bitcoin?
• Buy it on an exchange, sell goods and services for bitcoin, or go to a bitcoin faucet.