A Blockchain Primer › Module 3 › Lesson 3.2
Lesson 3.2: Why Should a New Transaction Be Accepted? — Validation Rules and Peer Control
- #1. The Core Question
- #2. An Everyday Analogy
- #3. Core Concepts Explained
- #4. Diagrams
- #5. Key Takeaways
- #6. Quiz
The last lesson explained how nodes receive transactions and blocks. But receiving something isn't the same as accepting it. This lesson looks at what gives nodes the grounds to reject junk, forgeries, and invalid data, and what makes nodes willing to check each other's work carefully.
1. The Core Question
The system is open to everyone. Anyone can submit transactions, run a node, or even cause trouble on purpose. With no central administrator reviewing every item, how do you make sure only legitimate transactions and legitimate blocks make it into the ledger?
This lesson answers one question: How do nodes validate transactions and blocks? And how do rewards, penalties, competition, and peer control give nodes a reason to do the work properly?
The short version: Validate by the rules first, then steer behavior with rewards and penalties, and let every node keep an eye on every other node. The whole thing depends on an honest majority.
2. An Everyday Analogy
An Outsourced Test-Grading Company
A company grades multiple-choice tests for schools. Its employees get paid per item, under these rules:
- Everyone can see every answer sheet and every grading result.
- The first person to grade an item correctly gets the reward.
- If someone else catches a grading mistake of yours, your reward goes to whoever caught it.
These rules have several effects:
- Everyone has a reason to race for speed.
- Racing for speed can hurt quality, so you still need quality checks.
- Everyone has a reason to check other people's results, because catching a mistake wins the reward back.
But the story has a dark side. If all the graders secretly team up, agreeing not to check each other, grading carelessly, and going only for speed, the rules get bypassed by the whole group. That shows rewards, penalties, competition, and peer pressure can manage a group of people who act independently, but only as long as they aren't conspiring to break the rules.
Blockchain algorithms use a similar carrot and stick: reward whoever does the work correctly, penalize whoever breaks integrity, and let nodes compete with and watch over each other.
3. Core Concepts Explained
3.1 Two Sets of Validation Rules
To be accepted, a block has to pass two sets of rules at the same time.
Validation rules for transaction data. These include:
- Formal correctness: every field is present and in the right format.
- Semantic correctness: business rules such as balance, quantity, and no double-spending hold up.
- Correct authorization: the transaction carries a valid signature from the legitimate owner.
Validation rules for the block header. These include:
- Formal correctness: every block header field is present and in the right format.
- Semantic correctness: a valid parent block reference, a valid root hash, the correct difficulty, and a timestamp later than the previous block's.
- Valid proof of work: the block header hash really does meet the difficulty requirement.
Transaction rules depend on the specific business. Block header rules care more about how information gets added to the chain, regardless of what the transactions say. Blocks that fail proof of work get thrown out immediately.
3.2 Rewards: Compensating Computational Cost
Creating a legitimate block costs energy, time, and money, because nodes have to solve hash puzzles. Without a reward, nobody would take on that cost willingly.
Blockchain algorithms set a rule: a node that submits a legitimate block gets a reward. You can think of the reward as compensation for the cost of keeping the system's integrity intact.
Rewards also explain why nodes are happy to broadcast their new blocks. The reward only really lands once other nodes have checked the block and accepted it.
3.3 Penalties: Making Integrity-Breaking Unprofitable
Rewards alone aren't enough. You also need penalties.
Common penalties include:
- If a block was accepted but later ruled invalid, its reward gets taken back.
- Duplicate, outdated, or invalid blocks earn no reward.
- A node that burns computing power and gets no reward can't cover its costs, and that by itself is a penalty.
The point of penalties isn't catching bad guys. It's making sure that breaking integrity pays less than it costs.
3.4 Competition: A Combination of Speed and Quality
Blockchain puts the reward at the end of two back-to-back competitions.
The first is the speed competition. Nodes race to solve the new block's hash puzzle. The first node to submit a valid solution wins the speed competition and moves on as a candidate in the quality competition.
The second is the quality competition. After the new block is broadcast, other nodes check whether it's legitimate. The nodes that lost the speed competition become referees. They have a reason to hunt hard for mistakes, because if the block turns out to be invalid, the speed competition starts over and they get another shot at winning.
This design puts the losers to work as referees. The winner takes the reward, and the losers are in charge of scrutinizing the winner.
3.5 Peer Control: Everyone Is Both Worker and Referee
A pure distributed system has no central supervisor, so blockchain has every node supervise every other node.
A node is a worker, validating transactions and creating blocks, and it's also a supervisor, receiving, checking, and validating blocks that others created. Every node's work affects two things:
- Whether legitimate blocks can be added.
- Whether invalid transactions or blocks get caught, rejected, or marked invalid.
That's peer control: there's no central referee, and every node takes part in refereeing.
3.6 The Two-Phase Work Rhythm
A node's work switches back and forth between two states:
- Evaluating new blocks that others created.
- Working to become the next node to create a new block.
No central clock drives this rhythm. Incoming messages drive it. When a node receives a new block, it moves into the evaluation phase. When it's done evaluating, it goes back to validating transactions and creating blocks.
When every node keeps the same rhythm, it helps them all reach the same understanding of the transaction history.
3.7 The Node's Processing Flow for Transactions and Blocks
You can boil the rules down into one processing chain:
- Receive new transactions and new blocks through gossip.
- New transactions go into the inbox and wait to be processed.
- New blocks get top priority and are processed right away.
- Validate each transaction's authorization, formal correctness, and semantic correctness.
- Put only legitimate transactions into the transaction data structure, start creating a new block, and solve the hash puzzle.
- Once the puzzle is solved, broadcast the new block to other nodes.
- Other nodes validate the block's proof of work and every transaction inside it.
- Legitimate blocks get added to the local copy of the ledger.
- Invalid blocks get thrown out, and the node goes back to processing transactions or working on its own puzzle.
- Transactions in the legitimate block are removed from the inbox so they don't get processed twice.
- If a block that was already added is later ruled invalid or useless, that block and every block after it are marked invalid, and their transactions go back into the inbox.
- When a block is accepted, whoever submitted it gets the transaction fees inside the block as the reward.
- When a block is removed, the reward is taken back from whoever originally submitted it.
Steps 3 and 6 make up the two-phase rhythm: when a new block comes in, evaluate it first, and once that's done, go back to competing for the next block.
3.8 Dishonest Behavior and the Honest Majority
Common dishonest behavior in an open system includes:
- Posing as someone else to submit transactions.
- Accepting invalid transactions or invalid blocks.
- Flooding a node with huge numbers of transactions to crash it.
- Refusing to process certain transactions.
- Refusing to forward information.
The mechanisms above each cover part of this:
- Cryptography, identity, and digital signatures limit who can access an account.
- Gossip lets information eventually reach the whole network.
- The distributed architecture keeps the system running when some nodes crash.
- Validation rules, rewards, penalties, competition, and peer control take care of whether transactions and blocks are valid.
But the most critical assumption is this: honest nodes are the majority. If most nodes team up to accept invalid blocks, refuse to forward messages, and cover for each other, this whole mechanism gets bypassed. Blockchain isn't secure no matter what. It depends on an honest majority and the reward mechanism working together.
3.9 Conflicting Histories Are Still Unresolved
This lesson covered how nodes validate and accept transactions and blocks. But different nodes may still be keeping different versions of history for a while.
The next lesson takes that on: when several chains exist at once, how do nodes decide which one tells the truth?
4. Diagrams
Figure 3-2-1: Validation, Rewards, Penalties, and Supervision
Figure 3-2-2: Speed Competition and Quality Competition
5. Key Takeaways
- Transactions and blocks have to pass validation rules before they get into the ledger.
- Transaction validation covers formal correctness, semantic correctness, and authorization. Block header validation also includes proof of work.
- Rewards compensate for computational cost, which makes nodes willing to create and broadcast legitimate blocks.
- Penalties include taking rewards back and withholding them, so breaking integrity costs more than it pays.
- The speed competition decides who submits a block first. The quality competition gets other nodes to scrutinize it.
- Losers become referees. They have a reason to find mistakes, and they get to compete again if the block is invalid.
- Every node is both a worker and a supervisor. There's no central referee.
- The two-phase rhythm: evaluate new blocks, or work to create the next one.
- The whole mechanism depends on an honest majority. It gets bypassed when most nodes collude.
6. Quiz
Part 1: Single Choice (1–4)
Question 1
Which of these is usually NOT part of validating transaction data?
A. Formal correctness
B. Semantic correctness
C. Correct authorization
D. The block's proof of work
Show answer
Answer: D
Explanation: Proof of work is part of block header validation, not transaction data validation. Formal correctness, semantic correctness, and authorization are all part of validating transactions.
Question 2
What's the main role of rewards in blockchain algorithms?
A. Making transaction contents unreadable
B. Compensating nodes for the cost of solving hash puzzles, so they have a reason to create and broadcast legitimate blocks
C. Replacing all validation rules
D. Making private keys public
Show answer
Answer: B
Explanation: Rewards compensate for the cost of hash puzzles and give nodes a reason to create, broadcast, and validate legitimate blocks. They can't replace validation, and they don't make private keys public.
Question 3
After the speed competition ends, what do the nodes that lost usually do?
A. Leave the system automatically
B. Become referees in the quality competition and check the block the winner submitted
C. Get the reward directly
D. Change the winner's private key
Show answer
Answer: B
Explanation: The losers become referees in the quality competition and check the winner's block. If they find it's invalid, the competition starts over.
Question 4
What does the "two-phase work rhythm" refer to?
A. Evaluating new blocks, or working to create the next block
B. Generating private keys, or deleting public keys
C. Reading files, or formatting hard drives
D. Encrypting transactions, or publishing private keys
Show answer
Answer: A
Explanation: Nodes switch between evaluating new blocks and working to create the next one, and incoming messages drive that rhythm.
Part 2: Multiple Choice (5–7)
Question 5
What does block header validation usually include?
A. Whether the parent block's hash reference is valid
B. Whether the root hash of the transaction data structure is valid
C. Whether the timestamp is later than the previous block's
D. Whether the proof of work meets the difficulty
Show answer
Answer: A, B, C, D
Explanation: The parent reference, root hash, timestamp, and proof of work are all core parts of block header validation.
Question 6
What forms can penalties take?
A. Taking back rewards that were already paid out
B. Withholding rewards for duplicate, outdated, or invalid blocks
C. Leaving nodes unable to cover their costs even though they burned computing power
D. Automatically turning invalid blocks into legitimate ones
Show answer
Answer: A, B, C
Explanation: Penalties include taking rewards back, withholding rewards, and leaving costs uncovered. Invalid blocks never automatically become legitimate.
Question 7
Which statements about peer control are correct?
A. Every node is both a worker and a supervisor
B. Nodes check blocks that others created
C. There's no central referee, and every node takes part in refereeing
D. Only the central server has the right to validate transactions
Show answer
Answer: A, B, C
Explanation: Every node validates and supervises together. D contradicts what a pure distributed system is.
Part 3: True or False (8–9)
Question 8
True or false: whenever a node receives a transaction, it should add it to the ledger, no questions asked.
Show answer
Answer: False
Explanation: After receiving a transaction, nodes still have to check formal correctness, semantic correctness, and authorization. Only legitimate transactions make it into the ledger.
Question 9
True or false: blockchain's rewards and penalties rely on the assumption that honest nodes are the majority.
Show answer
Answer: True
Explanation: Rewards, penalties, and peer control depend on an honest majority. If most nodes collude, they can bypass the mechanism.
Part 4: Scenario Analysis (10)
Question 10
On a chain, node A solves the hash puzzle first and broadcasts a new block. Node B lost the speed competition and starts checking A's block.
Answer the following:
- Why does B have a reason to check carefully?
- If A's block is invalid, what happens next?
- If most nodes team up to accept invalid blocks, what happens?
Show answer
Answer:
- B has already lost the speed competition, but if it can prove A's block is invalid, the speed competition starts over, and B gets another chance to submit its own block and earn the reward.
- A's block gets thrown out, the speed competition starts over, and the transactions that were interrupted go back into the processing flow.
- When most nodes collude, they may accept invalid blocks and refuse to fix mistakes. The rewards and penalties get bypassed, and the system's integrity can no longer be guaranteed.