Author

Topic: How do nodes confirm transactions and determine if a block is valid or not (Read 311 times)

hero member
Activity: 1484
Merit: 535
I've been trying to understand the concept of bitcoin for a while now, especially its technical aspects, so I've been doing some personal research on my own, but I still find it difficult to comprehend some parts of it.
I learned during my research that a node is a computer on the blockchain network that sends and receives transactions with other nodes while also validating and storing those transactions and I also read that transactions on the blockchain are kept and encrypted within blocks and that a  block's transactions needs to be verified in order for a new block to formed.

I need more explanation because I still don't understand how a node confirms a transaction and determines whether a block is valid, it seems too complicated.



Consensus is the mechanism by which nodes validate blocks and confirm transactions. Consensus procedures in a blockchain network guarantee that all nodes concur on the ledger's current state, including which transactions are legitimate and which blocks ought to be added to the chain.

When a transaction is broadcast across the network, it propagates to all nodes. Each node checks the transaction to ensure that it fits particular conditions, such as having a valid digital signature, spending no more than the sender's balance, and so on.

legendary
Activity: 3472
Merit: 4801
You misunderstood me,
Or, perhaps, you misunderstand how bitcoin works?

I believe we are saying the same thing
I read your words. I read his words. You are not saying the same thing. He is correct. You are not.

Yes it's true that transactions are confirmed by miners, now what or who are miners?
That word, miner, has taken on multiple meanings when talking about Bitcoin. This leads to confusion. It's good to clarify and avoid confusion.
There are:
  • Mining pools - They assemble the validated transactions into blocks and present the block headers to their participants for hashing.
  • Mining pool participants - They run ASICs, hashing the block headers that they receive from the mining pool in an attempt to find a block solution
  • Solo miners - They do both pieces, assembling blocks from valid transactions, and then hashing the header looking for a solution

Miners are nodes that work to add new blocks to the blockchain and are rewarded with bitcoin for doing so.
Mining pools, and Solo miners run nodes to validate transactions, and then run separate software to build blocks from the valid transactions.
Mining pool participants and Solo miners compute hashes of the block headers looking for a block solution.
Mining pools and Solo miners assign the block subsidy and transaction fees wherever they want to when they build the block, before it is hashed.
Mining pools and Solo miners broadcast their solved blocks to the peers they are connected to.

So when I say "they check for things like the digital signature of the transaction" I'm simply talking about the miners.
And you are at least partially incorrect and/or partially incomplete.

All nodes, including the ones that are NOT mining, "check for things like the digital signature". Well written wallet software ALSO "checks for things like the digital signature".

Mining pool participants do NOT "check for things like the digital signature".  They simply use their ASICs to hash the block headers they are assigned by the pool. Mining pools check the digital signatures, but I wouldn't consider that part of the "mining" process. They just do that to make sure that they don't accidentally include a transaction in their block that will be rejected by ALL nodes (resulting in an invalid block). The mining software uses the list of already verified transactions, and builds the block from those.

It's important to note that people often talk about Miners and Nodes together as they're same as one, which is wrong, in as much as Miners could be considered to be nodes that work to add new blocks to the blockchain by solving some complex mathematical problems ( Proof of Work), Nodes, on the other hand, are any computers that are connected to the network and are helping to verify and relay transactions. So, we could say that all miners are nodes, but not all nodes are miners.

This is reasonably close to accurate. Probably good enough for typical conversation about such matters.  In my opinion it's more accurate to say that miners run nodes  to be able to receive and validate the transactions from the network before they start using them in the mining process, rather than saying that they are "considered to be nodes", but being that pedantic about it is probably not helpful in most cases.

Note that the "mathematical problem" really isn't all that complex.  While it is tedious, I believe it can be done with paper and pencil by anyone that understands binary and boolean logic. I'd bet it can be taught pretty easily to the average middle-schooler if they wanted to learn it. At the currrent difficulty targe though, it does need to be calculated MANY MANY MANY times repeatedly. It would take centuries (maybe more) for the average human to perform the calculation enough times to have even a minuscule probability of finding usable result.  Like I said, it's tedious (very tedious), but not complex.

And when I say "The transaction is added to the blockchain and deemed "confirmed" if it successfully completes all validation checks." what I mean is that the transactions are added to the blockchain AFTER they have been confirmed and has completed all validation checks.

What you "meant" was MUCH more correct than what you "said", and yet still is missing some important nuance.

Transactions are definitely NOT deemed "confirmed" simply by successfully completing validation checks.
Saying that they are only creates confusion and misunderstanding.

Transactions ARE added to the blockchain AFTER they have been confirmed has completed all validation checks
However, your statement could easily be misunderstood to imply that being confirmed and completing validation checks are happening simultaneously before "being added to the blockchain".

More specifically, transactions are:
  • First verified by node software
  • Then included in an unsolved block by mining pool or solo mining software
  • Then the block is solved by people running ASICs (either pool participants or solo miners)
  • Then the solved block is broadcast to peers
  • Then the solved block is verified by those peers, and they broadcast it to their peers, and so on
  • Then, any node or wallet that receives the block and has determined it to be a valid block considers the transactions in that block to be "confirmed" BECAUSE it has seen them in a valid solved block
  • Finally those nodes and wallet software increment the quantity of "confirmations" on those transactions by 1 every time another valid block is received that extends that chain


This is a Technical Discussion sub-forum.  It is important in this sub-forum to be accurate in the information you give, and careful about how you phrase things so that you don't increase confusion and misunderstanding. People that come to this sub-forum and read these threads are looking for good, accurate, specific information about how things work.
member
Activity: 168
Merit: 77
The transaction is added to the blockchain and deemed "confirmed" if it successfully completes all validation checks. I hope this makes it more clear how nodes validate or confirm transactions on the block.
Wrong.
As I said in the first reply, transactions are confirmed by miners.

Transactions must be valid, so that they can be included in the blockchain, but it's not that a transaction is included in the blockchain once it's validated.
For a transaction being confirmed, it's required that a miner (or a mining pool) solves the proof of work problem, mines a block and includes that transaction in the block.

You misunderstood me, I believe we are saying the same thing,
Yes it's true that transactions are confirmed by miners, now what or who are miners?
 Miners are nodes that work to add new blocks to the blockchain and are rewarded with bitcoin for doing so. So when I say "they check for things like the digital signature of the transaction" I'm simply talking about the miners.
It's important to note that people often talk about Miners and Nodes together as they're same as one, which is wrong, in as much as Miners could be considered to be nodes that work to add new blocks to the blockchain by solving some complex mathematical problems ( Proof of Work), Nodes, on the other hand, are any computers that are connected to the network and are helping to verify and relay transactions. So, we could say that all miners are nodes, but not all nodes are miners.

And when I say "The transaction is added to the blockchain and deemed "confirmed" if it successfully completes all validation checks." what I mean is that the transactions are added to the blockchain AFTER they have been confirmed and has completed all validation checks.

 
legendary
Activity: 2380
Merit: 5213
The transaction is added to the blockchain and deemed "confirmed" if it successfully completes all validation checks. I hope this makes it more clear how nodes validate or confirm transactions on the block.
Wrong.
As I said in the first reply, transactions are confirmed by miners.

Transactions must be valid, so that they can be included in the blockchain, but it's not that a transaction is included in the blockchain once it's validated.
For a transaction being confirmed, it's required that a miner (or a mining pool) solves the proof of work problem, mines a block and includes that transaction in the block.
member
Activity: 168
Merit: 77
I've been trying to understand the concept of bitcoin for a while now, especially its technical aspects, so I've been doing some personal research on my own, but I still find it difficult to comprehend some parts of it.
I learned during my research that a node is a computer on the blockchain network that sends and receives transactions with other nodes while also validating and storing those transactions and I also read that transactions on the blockchain are kept and encrypted within blocks and that a  block's transactions needs to be verified in order for a new block to formed.

I need more explanation because I still don't understand how a node confirms a transaction and determines whether a block is valid, it seems too complicated.



I'll try to put it in simpler terms. The nodes in the Bitcoin network have been charged with verifying the validity of each new transaction before accepting it. To accomplish this, they check for things like the digital signature of the transaction and if any coins have previously been spent using highly complex mathematical calculations and encryption. We refer to this procedure as validation. The transaction is added to the blockchain and deemed "confirmed" if it successfully completes all validation checks. I hope this makes it more clear how nodes validate or confirm transactions on the block.
member
Activity: 121
Merit: 39
Nodes validate all transactions they receive. If a transaction is valid, the node sends it to other nodes.
Validation means checking if the transaction follows consensus rules. For example, one of consensus rules is that the total value of outputs must not be greater than the total value of inputs.

Nodes also check if the transaction follows their own rules. For example, almost all nodes reject any transaction with the fee rate of less than 1 sat/vbyte.
Note that a transaction with the fee rate of less than 1 sat/vbyte can be valid, but nodes usually reject such transaction.


and I also read that transactions on the blockchain are kept and encrypted within blocks and that a  block's transactions needs to be verified in order for a new block to formed.
Transactions are not encrypted.
Miners include transactions in the blockchain exactly as they receive them.


I need more explanation because I still don't understand how a node confirms a transaction and determines whether a block is valid, it seems too complicated.
Transactions are not confirmed by nodes. Transactions are confirmed by miners.
Take note that confirmation means being included in the blockchain and that's different from being validated.

A miner (or a mining pool) that manage to find a block, sends the block to the network. Nodes receive the block and validate it.
Validation of a block means checking if the block and the transactions included in that are valid.


Thank you for shedding more light, I now understand more about nodes and how transactions are validated before I was thinking that nodes and miners they are like doing similar work on the network.
Thank you for this and I will not be hesitate to ask more questions when I come across any difficulties along the line.
hero member
Activity: 994
Merit: 1089
When these transactions are then group together it is called block and this block pass through the process called mining and mining is just a mathematical problem that is being solved so when that mathematical problem has been solved correctly, by a node, that first node gets the ability to be able to move the block into a blockchain which then serves as the security of the blockchain.
This is just partly true. Nodes validate tx's and store them in their memory pool and not in blocks. Miners then pick this tx's and use them to make up their candidate block, which can also be called a temporary block, and then try to mine that block and add it to the blockchain and earn the rewards.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
Afterwards, every node then go ahead to independently verify if the sender of the transaction has the funds he's sending across the network and whether it meets their consensus agreement in the network.
Addresses don't have balance. The balance that you see on blockexplorers are collated and summed by the blockexplorers. In fact, nodes can only see the UTXO and not the address. When a transaction is being spent, it spends the UTXO and is essentially the removal of the input UTXOs and the creation of output UTXO.

When these transactions are then group together it is called block and this block pass through the process called mining and mining is just a mathematical problem that is being solved so when that mathematical problem has been solved correctly, by a node, that first node gets the ability to be able to move the block into a blockchain which then serves as the security of the blockchain.
Solving is would be greatly simplifying what mining does. There is no such thing as moving blocks into blockchain either. If a block is propagated across the network, other than the usual validity checks, every node also checks if it meets the target requirement for a certain difficulty period. Essentially, every block includes the coinbase which sends the block reward to the miners but only the first that meets the target requirement can be added to the blockchain by individual nodes.

sr. member
Activity: 574
Merit: 290
Bitcoin in Niger State💯
hosseinimr93's explanation was excellent. If you have questions regarding the network in general, I suggest you visit learnmeabitcoin.com and bitcoin.it.

I would have also ordinarily ask him to visit those websites, especially, learnmeabitcoin where I also got informed about these technicalities, for him to get more information about nodes and validation of transactions.

Permit me to cite an example with the relevance of nodes in a transaction as has being an HTML in a web development for people who understands web and I'm citing this example because it is great to understand how crucial nodes are to validation of transactions. This is how it happens whenever a user sends a transaction it is sent across all the nodes that are available in the network. Afterwards, every node then go ahead to independently verify if the sender of the transaction has the funds he's sending across the network and whether it meets their consensus agreement in the network.

When these transactions are then group together it is called block and this block pass through the process called mining and mining is just a mathematical problem that is being solved so when that mathematical problem has been solved correctly, by a node, that first node gets the ability to be able to move the block into a blockchain which then serves as the security of the blockchain.

So realize that I said that all this block have to pass through a process called mining and it also have to be certified by other nodes that are in the network or the in the transaction chain, so that process of trying to certify it and getting every other node to agree based on the consensus agreement of the block transaction is what makes a secure, valid transaction for every other nodes in the network which brings about trust and the concept of decentralisation in Bitcoin
legendary
Activity: 2352
Merit: 6089
bitcoindata.science
An invalid transaction in a block makes the entire block invalid.

Expanding this answer...

So if a miner decide to include an invalid transaction (like a double spending input) in a block, all other nodes will refuse that block. That miner would be considered dishonest and he would lose all his processing power spent to create that block.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
hosseinimr93's explanation was excellent. If you have questions regarding the network in general, I suggest you visit learnmeabitcoin.com and bitcoin.it.

There is a frequent confusion between confirmation and validation. While they are synonyms in the English language, they have a completely different meaning in Bitcoin.

  • Confirmation of a transaction: the act of including the transaction in a block, and mining on top of it. If the most recent block contains your transaction, it has 1 confirmation. If somebody mined a block on top of that, it now has 2 confirmations.
  • Validation of a transaction: the act of verifying if a transaction complies with the consensus rules.

A transaction can be validated even if not confirmed yet. This happens right before the node accepts it in its memory pool (or mempool for short). However, it cannot be confirmed if it is not validated. An invalid transaction in a block makes the entire block invalid.
legendary
Activity: 2380
Merit: 5213
Nodes validate all transactions they receive. If a transaction is valid, the node sends it to other nodes.
Validation means checking if the transaction follows consensus rules. For example, one of consensus rules is that the total value of outputs must not be greater than the total value of inputs.

Nodes also check if the transaction follows their own rules. For example, almost all nodes reject any transaction with the fee rate of less than 1 sat/vbyte.
Note that a transaction with the fee rate of less than 1 sat/vbyte can be valid, but nodes usually reject such transaction.


and I also read that transactions on the blockchain are kept and encrypted within blocks and that a  block's transactions needs to be verified in order for a new block to formed.
Transactions are not encrypted.
Miners include transactions in the blockchain exactly as they receive them.


I need more explanation because I still don't understand how a node confirms a transaction and determines whether a block is valid, it seems too complicated.
Transactions are not confirmed by nodes. Transactions are confirmed by miners.
Take note that confirmation means being included in the blockchain and that's different from being validated.

A miner (or a mining pool) that manage to find a block, sends the block to the network. Nodes receive the block and validate it.
Validation of a block means checking if the block and the transactions included in that are valid.
member
Activity: 121
Merit: 39
I've been trying to understand the concept of bitcoin for a while now, especially its technical aspects, so I've been doing some personal research on my own, but I still find it difficult to comprehend some parts of it.
I learned during my research that a node is a computer on the blockchain network that sends and receives transactions with other nodes while also validating and storing those transactions and I also read that transactions on the blockchain are kept and encrypted within blocks and that a  block's transactions needs to be verified in order for a new block to formed.

I need more explanation because I still don't understand how a node confirms a transaction and determines whether a block is valid, it seems too complicated.

Jump to: