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.

## Finance and capital markets

### Course: Finance and capital markets>Unit 8

Lesson 8: Bitcoin

# Bitcoin: Transaction block chains

The mechanics of a bitcoin transaction block chain, which is a construct that is generated by bitcoin miners and functions as a global ledger for recording and validating bitcoins. Created by Zulfikar Ramzan.

## Want to join the conversation?

• At , when breaking a tie between 2 proofs of work, the video says that the transaction chain which wins has the "highest aggregated difficulty associated with that underlying proof-of-work protocol in each of the transaction blocks." But how do you estimate this aggregated difficulty in practice? Can we have more details on that? Thanks!
• That's correct. The smaller the prefix of zeros, the lower the difficulty of solving the puzzle. The way that the proof of work is described in the actual bitcoin documentation is that there is a target value and any hash output smaller than the target satisfies the criteria. It might be possible that the output will have an even larger prefix of zeros compared to the target (it would still satisfy the criteria, though).
• Great series! Could you please expand this part with explanation on how do individual transactions get into a block in relation to the assigned fees? As far as I know there is a relationship between a transaction fee and a place of that transaction in a queue for inclusion in the next block. Understanding this process would give answer to why there should be a fee assigned to a transaction or what are the consequences of not assigning a fee.

Thanks

Marian
• Miners choose what transactions to include in a block. If there is no fee, they have no reason to put the the transaction in the block, so they will probably just throw it away.

They higher fee you give, the more a miner will want to put it in a block, so it will likely be confirmed faster.
• This video seems to have a major flaw. If the block chain only stored the hashes then you wouldn't have any accessible information, hashes are irreversible. The block chain needs to maintain the public ledger in a readable format. How is this done.
• The blocks are still readable. It doesn't only store the hashes. The block also says what transactions are incorporated and where in the tree structure each transaction is.
• I am having trouble wrapping my head around the proof of work. What purpose does this serve? Wouldn't the system work better if individual transactions could be added to the block chain instantly? You wouldn't have to wait ten minutes to purchase a hotdog with bit coins.
• The purpose of proof of work is to make imitation of block chain hard to malefactor. If proof of work was done on the instant time, it would be easy to construct the whole block chain and do the double money spending. So, the speed of new block construction is kept on the same level to make building a block chain a hard computational process.
• raises a question on the composition of a transaction block at node level. Say a transaction block is of size 5 and Node1 sees transactions 1,2,3,4,5 and Node2 seems transactions 1,2,3,4,6 (instead of '5'). Which block gets injected into the global transaction block chain? What about the transaction that does NOT exist in the chosen block? Also, when multiple nodes are processing this, is it a "winner takes it all" with the other blocks or partial work thrown away (waste of electricity!)?
• The longest chain wins and one block will be orphaned and the miner will lose the reward. The left over transactions will be remined in future blocks. During the hard fork a couple months ago 25 blocks were orphaned and all those block rewards were lost but apparently there was some deal behind the scenes so the compensation got spread around to those that lost out.
• This is interesting. Lets say it takes 10 minutes to find the correct hash value below the given difficulty value (the zeroes at the start of the hash) and the unconfirmed transactions are hashed via the tree structure into the block header which forms part of the end result hash. Doesn't this introduce a delay in processing new transactions ? Once a node starts searching for the correct hash whilst new transactions continue to arrive isn't there a problem with including these new transactions as they would need to be included into the current tree which will change the root hash meaning the whole result would need to be found again. How do real world miners solve this issue ? Do they select a certain number of transactions for inclusion in the block and then start looking for the hash result whilst ignoring the other new incoming transactions and leaving them for the next block or do I misunderstand something here ?
• From what I've read they choose a number of transactions to create a block and the new transactions will stay unprocessed until the a new block is created.
• So the only point of the (challenge, proof) handshake is to prevent spammers and DOS attacks?
What about the weeding out of malicious or just bad-at-math bitcoin miners? Does that depend on multiple miners working on the same transactions? I think i missed something, but not sure what/where.
• No. The point is to prevent any one person from controlling the rules of what transactions get accepted as valid (and in what order). If you imagine a world of malicious bitcoin miners as well as "good" miners (i.e., those that follow the commonly followed rules of including transactions), then we just need to be assured that the total CPU power of "good" miners exceeds that of the malicious miners. So the more nodes mining, the harder it is for a bad actor to reverse transactions or prevent valid transactions from being added to the block chain.
• Is there a protocol for a situation where two different miners manage to find a proof at the exact same time as well as expending the exact same amount of work?

Can the person who is making the transaction set how much fee he is willing to give the miner responsible for adding the transaction? Or is it preset by the network.

If the answer to the above question is yes, then can the miners choose not to incorporate a transaction if they are being given negligible/no fee?
• The sender sets the transaction fee, not the miner. The sender can decide whatever transaction fee he wants to use, as long as it is greater than a minimum fee of 0.0001 BTC /kB if the transaction volume is less than 0.1 BTC. (If the sender tries to make such a transaction, the nodes simply won't relay it, although it is still a valid transaction) The miners can also decide whichever transactions that they are willing to incorporate into their blocks, including rejecting any transactions that give a low fee.

If two miners find a proof at the same time, then both will broadcast the proof at the same time. Some nodes will receive block A first, while other nodes will receive the block B first. Those miners who receive block A first will start working to build the next block on top of block A. The miners who receive block B first will start working to build the next block on top of block B. If the next block is built on top of block A, block A wins. If the next block is built on top of block B, block B wins.
• This peer to peer aspect is a concern to me. I assume my client tracks my Bitcoins and the minors track all transactions. If there is a discrepancy, I seem to have no one to correct it. Is the transaction complete when both parties see a record of it in a minor's log records or is there some minor response to the parties? I would think there would be a vast amount of communications and latency if each transaction is sent to all nodes. It seems like a PC problem could cause a loss of money. How would I recover my correct Bitcoin balance? Thanks!
• If there was a discrepancy, such as a person giving themselves bitcoins out of thin air, then the other nodes would automatically detect it and throw it out. Discrepancies are not allowed.

All transactions are broadcast to everyone. Some people see this might be a problem because of lag or storage space as more and more people use Bitcoin.

A transaction is complete as soon as it is put into a block. There is no need for the receiver to respond or anything like that.