Skip to main content
edited tags
Link
Murch
  • 77.8k
  • 35
  • 190
  • 641
Tweeted twitter.com/StackBitcoin/status/1022225101306179584
added 4 characters in body
Source Link
Raghav Sood
  • 17.3k
  • 3
  • 23
  • 43

I was wondering how a block encodes its set of transactions. I know a Merkle Tree is generated, and that it encodes a Hashed version of the transactions. But is the Merkle Tree included in the Block that gets sent to the other nodes for validation? Is there a list of transactions that it also sent?

In my understanding, when a Node wishes to 'Mine', they will:

  1. Generate a new block
  2. Create a coinbase transaction
  3. Gather a subset of the other incomplete transactions (those that have not yet been put into a block) from its copy of the blockchain.
  4. Generate a Merkle Tree using the transactions from steps 2 & 3
  5. Increment a Nonce repeatedly until the Hash of the {Previous Hash, Nonce, Transactions from 4}<Previous Hash, Nonce, Transactions from 4> begin with a certain number of 0s.

It seems that to validate each individual transaction (to ensure money is not double-spent), it would be good to include a list of transactions. But to check that the proof-of-work has actually been completed, the other nodes need the merkle tree to quickly hash.

It is very possible that there is also a way to obtain the list of transactions from a merkle tree, but I just don't understand what that process looks like.

P.S. I am building my own Python demo implementation of a blockchain currency, hence the more-theoretical/less-practical questions.

Thanks.

I was wondering how a block encodes its set of transactions. I know a Merkle Tree is generated, and that it encodes a Hashed version of the transactions. But is the Merkle Tree included in the Block that gets sent to the other nodes for validation? Is there a list of transactions that it also sent?

In my understanding, when a Node wishes to 'Mine', they will:

  1. Generate a new block
  2. Create a coinbase transaction
  3. Gather a subset of the other incomplete transactions (those that have not yet been put into a block) from its copy of the blockchain.
  4. Generate a Merkle Tree using the transactions from steps 2 & 3
  5. Increment a Nonce repeatedly until the Hash of the {Previous Hash, Nonce, Transactions from 4} begin with a certain number of 0s.

It seems that to validate each individual transaction (to ensure money is not double-spent), it would be good to include a list of transactions. But to check that the proof-of-work has actually been completed, the other nodes need the merkle tree to quickly hash.

It is very possible that there is also a way to obtain the list of transactions from a merkle tree, but I just don't understand what that process looks like.

P.S. I am building my own Python demo implementation of a blockchain currency, hence the more-theoretical/less-practical questions.

Thanks.

I was wondering how a block encodes its set of transactions. I know a Merkle Tree is generated, and that it encodes a Hashed version of the transactions. But is the Merkle Tree included in the Block that gets sent to the other nodes for validation? Is there a list of transactions that it also sent?

In my understanding, when a Node wishes to 'Mine', they will:

  1. Generate a new block
  2. Create a coinbase transaction
  3. Gather a subset of the other incomplete transactions (those that have not yet been put into a block) from its copy of the blockchain.
  4. Generate a Merkle Tree using the transactions from steps 2 & 3
  5. Increment a Nonce repeatedly until the Hash of the <Previous Hash, Nonce, Transactions from 4> begin with a certain number of 0s.

It seems that to validate each individual transaction (to ensure money is not double-spent), it would be good to include a list of transactions. But to check that the proof-of-work has actually been completed, the other nodes need the merkle tree to quickly hash.

It is very possible that there is also a way to obtain the list of transactions from a merkle tree, but I just don't understand what that process looks like.

P.S. I am building my own Python demo implementation of a blockchain currency, hence the more-theoretical/less-practical questions.

Thanks.

Source Link
3mrsh
  • 65
  • 5

Does a Block contain the list of transactions? Or only the Merkle Tree?

I was wondering how a block encodes its set of transactions. I know a Merkle Tree is generated, and that it encodes a Hashed version of the transactions. But is the Merkle Tree included in the Block that gets sent to the other nodes for validation? Is there a list of transactions that it also sent?

In my understanding, when a Node wishes to 'Mine', they will:

  1. Generate a new block
  2. Create a coinbase transaction
  3. Gather a subset of the other incomplete transactions (those that have not yet been put into a block) from its copy of the blockchain.
  4. Generate a Merkle Tree using the transactions from steps 2 & 3
  5. Increment a Nonce repeatedly until the Hash of the {Previous Hash, Nonce, Transactions from 4} begin with a certain number of 0s.

It seems that to validate each individual transaction (to ensure money is not double-spent), it would be good to include a list of transactions. But to check that the proof-of-work has actually been completed, the other nodes need the merkle tree to quickly hash.

It is very possible that there is also a way to obtain the list of transactions from a merkle tree, but I just don't understand what that process looks like.

P.S. I am building my own Python demo implementation of a blockchain currency, hence the more-theoretical/less-practical questions.

Thanks.