<blockquote>
<p>Other nodes check if the transaction is valid, and if it is, they relay the transaction to other nodes. Mining pools have also (at least one) nodes, they verify it too, and if it's valid and the fee is enough, they put it in the block they're working on.</p>
<p>Do miners check it before including it in a block?</p>
</blockquote>
<p>Yep. If they include an invalid transaction, the other nodes will not accept that block, and that miner won't earn the block reward for that block. (currently 125k dollars!)</p>
<blockquote>
<p>Do other nodes check it and where there is a certain consensuous miners include it into a block</p>
</blockquote>
<p>Yes.</p>
<blockquote>
<p>Who composes the blocks then?</p>
</blockquote>
<p>Miners.</p>
<blockquote>
<p>Are all miners trying to solve the same block at the same time or different blocks?</p>
</blockquote>
<p>They are trying to find a block with the same height, but with different transactions, different nonces (a random number - related to block hash and difficulty) and different block reward addresses.</p>

CC BY-SA 3.0
2017-12-01T12:44:57.153Z
So the process is the following:

1. Alice does a transaction 
2. Sends it to other nodes of the network that verify that transaction
3. When a miner sees there is a transaction being verified by a large number of nodes (is there a number or %?) checks it before introducing it into a new block
4. Once verified, create the block, solves the hash and sends it to all nodes. Now it is confirmed
5. Nodes include the block into the blockchain
Nacho
CC BY-SA 3.0
2017-12-01T13:04:23.820Z
@Nacho 2 should be "sends to other nodes, because a few nodes are miners, and the miners are the ones who make the transactions 'confirmed'" 3 should be "the other nodes verified it, and because it wasn't invalid, they relayed to other nodes. The miner was one of the nodes." The others are correct
MCCCS
CC BY-SA 3.0
2017-12-01T14:16:34.023Z
@Nacho Your step 3 is completely wrong. The miner knows the transaction is valid. Why would he care what other nodes think? 99% of the other nodes might be controlled by the same person. He has no reason to trust other nodes. He doesn't care what their opinion of the transaction is. He'll probably include it in a block if that makes him more money (because of how big a transaction fee it pays and how much space in the block it occupies) and won't if it doesn't. He's in this to make money, not to make nice with people.
David Schwartz
CC BY-SA 3.0
2017-12-02T15:56:27.157Z
@DavidSchwartz then the miners don't go over all transactions in the block to validate them before start hashing the block? How do they know the transaction is valid then? I assume that is he happened to include a transaction that is not valid in a block other nodes won't accept it and he would not get his reward, right?
Nacho
CC BY-SA 3.0
2017-12-03T08:10:52.383Z
Miners know that transactions are valid by running a node that validates them.
Pieter Wuille
CC BY-SA 3.0
2017-12-04T08:43:23.667Z
@PieterWuille, what do you mean "by running a node that validates them"? What is the purpose of the nodes (not miners) in the network then? Thanks
Nacho
CC BY-SA 3.0
2017-12-04T09:19:59.997Z
@Nacho Different people who run nodes have different reasons. Miners who run them do so because otherwise, they would have no way to know what block to mine and what transactions to put in it to maximize their return. People who transact with bitcoins run them so that they'll know when they received bitcoins and to relay their own transactions.
David Schwartz
CC BY-SA 3.0
2017-12-05T09:25:15.700Z
@DavidSchwartz but not everyone who transacts with bitcoin (have a wallet) run a node, right?
Nacho
CC BY-SA 3.0
2017-12-05T09:46:21.760Z
@Nacho No. Many people use someone else's node. But ultimately there has to be a node somewhere that they're using.
David Schwartz
CC BY-SA 3.0
2017-12-01T12:22:52.640Z
2017-12-01T12:22:52.640Z
2020-06-16T11:10:03.350Z
MCCCS
<blockquote>
  <p>Do miners check it before including it in a block?</p>
</blockquote>

<p>Yes. If they include an invalid transaction in a block, that block will be invalid.</p>

<blockquote>
  <p>Do other nodes check it and where there is a certain consensuous miners include it into a block?</p>
</blockquote>

<p>Miners include it in a block if they wish to and if it's valid. They don't have to care about what anyone else thinks. They can put whatever valid transactions in their blocks that they wish to. Typically, they'll pick transactions that maximize the fees they make.</p>

<blockquote>
  <p>Who composes the blocks then?</p>
</blockquote>

<p>Every miner composes blocks and attempts to mine the blocks the compose.</p>

<blockquote>
  <p>Are all miners trying to solve the same block at the same time or different blocks?</p>
</blockquote>

<p>That's a matter of definition. Each miner is trying to produce a valid next block for the longest chain of valid blocks that they know about. But each miner is trying to mine a block that includes a transaction that pays them the block reward. So in that sense, they're trying to mine different blocks.</p>

CC BY-SA 3.0
2017-12-04T08:44:40.903Z
What is the purpose of other noder (not miners) in the network if miners have to validate the transactions they recieve?
Nacho
CC BY-SA 3.0
2017-12-04T09:18:11.507Z
They allow people who want to use the network to know what transactions are valid. They also relay valid transactions to other servers to ensure that miners can find them. They relay the blocks that miners find.
David Schwartz
CC BY-SA 3.0
2017-12-01T12:22:30.520Z
2017-12-01T12:22:30.520Z
David Schwartz
<p>I have been reading a lot about the validation of transactions. I understand the actual method in which a transaction is composed (inputs and outputs). However, I don't know what happens with that transaction once its "ready":</p>

<ol>
<li>Do miners check it before including it in a block?</li>
<li>Do other nodes check it and where there is a certain consensuous miners include it into a block? Who composes the blocks then? Are all miners trying to solve the same block at the same time or different blocks?</li>
</ol>

<p>Thanks in advance</p>

<nodes><validation><block>
Sender, nodes or miners? Who validates transactions?
Nacho
# Sender, nodes or miners? Who validates transactions?

(Asked by: username_0 on 2017-12-01)

I have been reading a lot about the validation of transactions. I understand the actual method in which a transaction is composed (inputs and outputs). However, I don't know what happens with that transaction once its "ready":

1. Do miners check it before including it in a block?
2. Do other nodes check it and where there is a certain consensuous miners include it into a block? Who composes the blocks then? Are all miners trying to solve the same block at the same time or different blocks?

Thanks in advance

**Tags:** nodes, validation, block


---

## 2 answers

### Answer by username_1 on 2017-12-01. Score: 2

> Other nodes check if the transaction is valid, and if it is, they relay the transaction to other nodes. Mining pools have also (at least one) nodes, they verify it too, and if it's valid and the fee is enough, they put it in the block they're working on.
>
> Do miners check it before including it in a block?

Yep. If they include an invalid transaction, the other nodes will not accept that block, and that miner won't earn the block reward for that block. (currently 125k dollars!)

> Do other nodes check it and where there is a certain consensuous miners include it into a block

Yes.

> Who composes the blocks then?

Miners.

> Are all miners trying to solve the same block at the same time or different blocks?

They are trying to find a block with the same height, but with different transactions, different nonces (a random number - related to block hash and difficulty) and different block reward addresses.

> **Comments:**
> **username_0**: So the process is the following:  1. Alice does a transaction  2. Sends it to other nodes of the network that verify that transaction 3. When a miner sees there is a transaction being verified by a large number of nodes (is there a number or %?) checks it before introducing it into a new block 4. Once verified, create the block, solves the hash and sends it to all nodes. Now it is confirmed 5. Nodes include the block into the blockchain  
> **username_1**: @username_0 2 should be "sends to other nodes, because a few nodes are miners, and the miners are the ones who make the transactions 'confirmed'" 3 should be "the other nodes verified it, and because it wasn't invalid, they relayed to other nodes. The miner was one of the nodes." The others are correct  
> **username_2**: @username_0 Your step 3 is completely wrong. The miner knows the transaction is valid. Why would he care what other nodes think? 99% of the other nodes might be controlled by the same person. He has no reason to trust other nodes. He doesn't care what their opinion of the transaction is. He'll probably include it in a block if that makes him more money (because of how big a transaction fee it pays and how much space in the block it occupies) and won't if it doesn't. He's in this to make money, not to make nice with people.  
> **username_0**: @username_2 then the miners don't go over all transactions in the block to validate them before start hashing the block? How do they know the transaction is valid then? I assume that is he happened to include a transaction that is not valid in a block other nodes won't accept it and he would not get his reward, right?  
> **username_3**: Miners know that transactions are valid by running a node that validates them.  
> **username_0**: @username_3, what do you mean "by running a node that validates them"? What is the purpose of the nodes (not miners) in the network then? Thanks  
> **username_2**: @username_0 Different people who run nodes have different reasons. Miners who run them do so because otherwise, they would have no way to know what block to mine and what transactions to put in it to maximize their return. People who transact with bitcoins run them so that they'll know when they received bitcoins and to relay their own transactions.  
> **username_0**: @username_2 but not everyone who transacts with bitcoin (have a wallet) run a node, right?  
> **username_2**: @username_0 No. Many people use someone else's node. But ultimately there has to be a node somewhere that they're using.  

---

### Answer by username_2 on 2017-12-01. Score: 1

> Do miners check it before including it in a block?

Yes. If they include an invalid transaction in a block, that block will be invalid.

> Do other nodes check it and where there is a certain consensuous miners include it into a block?

Miners include it in a block if they wish to and if it's valid. They don't have to care about what anyone else thinks. They can put whatever valid transactions in their blocks that they wish to. Typically, they'll pick transactions that maximize the fees they make.

> Who composes the blocks then?

Every miner composes blocks and attempts to mine the blocks the compose.

> Are all miners trying to solve the same block at the same time or different blocks?

That's a matter of definition. Each miner is trying to produce a valid next block for the longest chain of valid blocks that they know about. But each miner is trying to mine a block that includes a transaction that pays them the block reward. So in that sense, they're trying to mine different blocks.

> **Comments:**
> **username_0**: What is the purpose of other noder (not miners) in the network if miners have to validate the transactions they recieve?  
> **username_2**: They allow people who want to use the network to know what transactions are valid. They also relay valid transactions to other servers to ensure that miners can find them. They relay the blocks that miners find.  

---

