11

I don't quite understand the relation between a transaction and a block. I imagine it as a list of blocks, and each block having a list of transactions but I have some doubts.

When I do a transaction...

  • It should go to a specific block?
  • An unconfirmed transaction is a transaction which is not inside a block?
  • Can the miner add the new transaction to an older block? Once a block is solved, new transactions can be added?
14

The initial statement is correct. The blockchain is the list of all solved blocks, essentially the ledger of all transactions completed in the Bitcoin network. Each block contains (among a few other things) a list of transactions.

When you do a transaction, it is not destined for a specific block. You merely publish your transaction to the network and it goes onto the list of unconfirmed transactions. (There is actually no one authoritative list, however, everyone on the network keeps their own list and distributes it to others to whom they are connected.) Miners (who solve the hashing puzzles required to "solve" a block and make it official) will typically include all unconfirmed transactions in the blocks they create. But they may not. They may just not have received your transaction in their part of the network yet. Or, if your transaction didn't have a fee included, they may only be willing to process transactions with fees. Technically, they are under no obligation about which transactions to include in the block. But since miners get fees from many transactions, and miners benefit from the strength of the Bitcoin network, transactions are typically quickly included in a block.

To answer your second bullet, yes, an unconfirmed transaction is one that has not yet been included in a block.

And to answer your final bullet, no, new transactions cannot be added to older blocks. The "solution" to a block is a mathematically hard puzzle to solve, and it is based on the transactions that are included. So, if you added a transaction to an older block it wouldn't be the same block any more. And the "solution" wouldn't work either, so it would essentially have to be re-mined.

And to further complicate adding a transaction to an older block, each block also includes a piece of information from the previous block in the block chain. Meaning that if you added a transaction to an older block (or modified it in any way), you would not only have to re-solve the old block, but you would have to re-solve all blocks between that block and the current block. And since no one would recognize your re-solved blocks unless you were able to create an even longer blockchain than what currently exists, it isn't realistic to be able to do so. You would have an extremely large amount of processing to and you would have to solve it considerably faster than the rest of the world was working on the old block chain. (The exception is if you have more mining computing power than everyone else in the world combined. This is sometimes called the 51% problem.)

This is all by design. The point of the block chain is that the history of transactions is unalterable and mutually agreed upon as the truth. If it were possible to add transactions into the past, you could change that history. And, for example, spend the same bitcoins twice. But because of this chaining of bitcoins that isn't possible. (It is also why most people don't consider a transaction final until it has "6 confirmations". What "6 confirmations" really means is that the block that it is included in is 6 deep in the block chain. At that point the block chain is deep that it is considered completely unalterable.

  • Nice, but do the blockchain has a limitation on the maximum number of blocks? – Hany Sakr Mar 19 '18 at 12:11
  • @HanySakr No, there is no limit on the size of the blockchain, but in practice full nodes need to have enough memory to hold the while blockchain in memory. But this can vary depending on the protocol. – Damian Mar 6 at 1:37
3

Yes, a block is made up of a number of transactions.

There's no requirement that any transaction go to any particular block, but if it is a valid transaction and has sufficient priority, it will be included into one of the next few blocks.

Yes an unconfirmed transaction is one that hasn't yet been included into a block.

No, older blocks are immutable. Roughly, think of the blockchain as an append-only ledger of bitcoin transactions.

For more info, see http://spectrum.ieee.org/img/06Bitcoin-1338412974774.jpg , https://en.bitcoin.it/wiki/How_bitcoin_works , and http://bitcoin.org/bitcoin.pdf

2

You're quite right. The block chain is a list of blocks, and each block contains a list of transactions. Together they form an authorative and global ordering on all transactions.

An unconfirmed transaction is indeed a transaction that is not yet in a block. Miners build new blocks to extend the chain, and use unconfirmed transactions to fill them. Once a block is made, it is immutable, so older blocks are never modified, only new ones are appended.

1

Yes, block is a list of transaction.

  • Your transaction does not go to a specific block. A miner chooses a list of transactions and work on them to "solve" the block and once a block is "solved", it is broadcast to the network, and all the transactions in the block becomes confirmed.

  • 0-confirmed or unconfirmed transaction is one which is not yet included in any block.

  • A miner cannot modify (adding or removing transactions) a block which is "solved",

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.