<blockquote>
  <ul>
  <li>I send 10BTC to Batman.</li>
  <li>Because I have send BTC, a transaction is created in system.</li>
  <li>This transaction is send to all nodes from network (all users)</li>
  </ul>
</blockquote>

<p>That is correct so far</p>

<blockquote>
  <ul>
  <li>After transaction arrives to all users, the transaction is added in a queue where the miners take take their transactions.</li>
  </ul>
</blockquote>

<p>Yep, although its not really a queue because miners don't necessarily have to take the first transactions first. Its called the mempool, and its just a bit collection of them, with no enforced order.</p>

<blockquote>
  <ul>
  <li>A miner take transaction, process it (proof of work) and creates a block with more transactions.</li>
  </ul>
</blockquote>

<p>I'd just like to make it clearer that the proof of work is the name given to the hashing of the entire block, proof of work is <em>not</em> the verification of the transaction. Verifying the transaction doesn't take much work, only creating the block does.</p>

<blockquote>
  <ul>
  <li>After all the transactions are validated by miner, the new block is send in the network for check.</li>
  </ul>
</blockquote>

<p>After all the transactions are validated by the miner <em>and the miner has found a valid proof of work block</em>, that new block is sent to the rest of the network. Just valid transactions alone does not make a valid block. You are missing the idea of "Computes cryptographic hashes over and over until if finds one 'good enough to count'" that you mentioned. That is the proof of work.</p>

<blockquote>
  <p>How does each user check this blockchain (divide the blockchain and check each transaction if the transaction from the blockchain is the same with the one that he has (because first transactions are send to all the users from p2p network and after that are send in the queue to be process by the miner. This is how user is able to compare the transactions))?</p>
</blockquote>

<p>Users can just compare the transaction <em>hash</em> with the ones in the blockchain, because the hash is a deterministic "summary" or digest of the transaction. The same transaction will always have the same hash, but two different transactions will have different hashes. Full nodes always validate all the transactions in the new block when they receive it anyway, they don't just trust the miners.</p>

CC BY-SA 3.0
2018-02-15T06:16:35.343Z
As a node (user, when i receive a new block) how can i say that transaction inside that block are valid and not tamper by the miner if is the first time when i see that transaction? I can understand this if before a transaction is send in mempool also to be send to each node from p2p network and to store this transaction. When a new block arrives i can compare my local transactions with those from block. If a local transaction match with one from block is declare as valid else i not valid. This is how i see the things but i don't thing is write.
Mike
CC BY-SA 3.0
2018-02-15T06:32:18.983Z
@Adrian a transaction has to be signed by the sender, if the transaction was modified the signature would not be valid. So as long as the signature is valid, you know the transaction is not tampered with
meshcollider
CC BY-SA 3.0
2018-02-15T06:37:25.763Z
One more question. How can i know that signature was not tampered? I guess this signature is a hash on date or something like this.
How can I know(me as a node) that the transaction I am looking at has a valid signature and was not tempered? Thanks
Mike
CC BY-SA 3.0
2018-02-15T08:20:51.750Z
If the signature was tampered with, it would be invalid
meshcollider
CC BY-SA 3.0
2018-02-15T08:56:56.333Z
I think i understand. Is something like..each transaction has a flag when i create the transaction this is set to true (sig is ok) if someone will change in any way this signature this flag will be false.(this is a way to see things, there maybe is more complicated way to validate transactions). What i am trying to say is that each transaction has a mechanism that will reveal if a transaction has been tempered or not. I am right @MeshCollider? :)
Mike
CC BY-SA 3.0
2018-02-15T10:05:03.820Z
@Adrian yes, you can always tell if its been tampered with :)
meshcollider
CC BY-SA 3.0
2018-02-15T05:20:52.370Z
2018-02-15T05:20:52.370Z
meshcollider
<p>I have read all kind of the articles and I understand almost all the concept from cryptocurrency. What I still don't understand is, what are the steps from transactions to a valid block.
On a post on this SE I found this:    </p>

<ul>
<li>Collects transactions from the network</li>
<li>Validates them, and doesn't allow conflicting ones</li>
<li>Puts them into large bundles called blocks</li>
<li>Computes cryptographic hashes over and over until if finds one "good enough to count"</li>
<li>Then submits the block to the network, adding it to the blockchain and earning a reward in return.</li>
</ul>

<p>Let's take a practical example and please correct me if I make some wrong steps:</p>

<ul>
<li>I send 10BTC to Batman.</li>
<li>Because I have send BTC, a transaction is created in system.</li>
<li>This transaction is send to all nodes from network (all users)</li>
<li>After transaction arrives to all users, the transaction is added in a queue where the miners take take their transactions.</li>
<li>A miner take transaction, process it (proof of work) and creates a block with more transactions.</li>
<li>After all the transactions are validated by miner, the new block is send in the network for check.</li>
</ul>

<p>Now, questions:</p>

<ul>
<li>How does each user check this blockchain (divide the blockchain and check each transaction if the transaction from the blockchain is the same with the one that he has (because first transactions are send to all the users from p2p network and after that are send in the queue to be process by the miner. This is how user is able to compare the transactions))?</li>
</ul>

<bitcoin-core>
What are the exact steps for creating a transaction and having a valid block?
Mike
# What are the exact steps for creating a transaction and having a valid block?

(Asked by: username_0 on 2018-02-14)

I have read all kind of the articles and I understand almost all the concept from cryptocurrency. What I still don't understand is, what are the steps from transactions to a valid block.
On a post on this SE I found this:

* Collects transactions from the network
* Validates them, and doesn't allow conflicting ones
* Puts them into large bundles called blocks
* Computes cryptographic hashes over and over until if finds one "good enough to count"
* Then submits the block to the network, adding it to the blockchain and earning a reward in return.

Let's take a practical example and please correct me if I make some wrong steps:

* I send 10BTC to Batman.
* Because I have send BTC, a transaction is created in system.
* This transaction is send to all nodes from network (all users)
* After transaction arrives to all users, the transaction is added in a queue where the miners take take their transactions.
* A miner take transaction, process it (proof of work) and creates a block with more transactions.
* After all the transactions are validated by miner, the new block is send in the network for check.

Now, questions:

* How does each user check this blockchain (divide the blockchain and check each transaction if the transaction from the blockchain is the same with the one that he has (because first transactions are send to all the users from p2p network and after that are send in the queue to be process by the miner. This is how user is able to compare the transactions))?

**Tags:** bitcoin-core


---

## 1 answers

### Answer by username_1 on 2018-02-15. Score: 0 | Accepted answer

> * I send 10BTC to Batman.
> * Because I have send BTC, a transaction is created in system.
> * This transaction is send to all nodes from network (all users)

That is correct so far

> * After transaction arrives to all users, the transaction is added in a queue where the miners take take their transactions.

Yep, although its not really a queue because miners don't necessarily have to take the first transactions first. Its called the mempool, and its just a bit collection of them, with no enforced order.

> * A miner take transaction, process it (proof of work) and creates a block with more transactions.

I'd just like to make it clearer that the proof of work is the name given to the hashing of the entire block, proof of work is *not* the verification of the transaction. Verifying the transaction doesn't take much work, only creating the block does.

> * After all the transactions are validated by miner, the new block is send in the network for check.

After all the transactions are validated by the miner *and the miner has found a valid proof of work block*, that new block is sent to the rest of the network. Just valid transactions alone does not make a valid block. You are missing the idea of "Computes cryptographic hashes over and over until if finds one 'good enough to count'" that you mentioned. That is the proof of work.

> How does each user check this blockchain (divide the blockchain and check each transaction if the transaction from the blockchain is the same with the one that he has (because first transactions are send to all the users from p2p network and after that are send in the queue to be process by the miner. This is how user is able to compare the transactions))?

Users can just compare the transaction *hash* with the ones in the blockchain, because the hash is a deterministic "summary" or digest of the transaction. The same transaction will always have the same hash, but two different transactions will have different hashes. Full nodes always validate all the transactions in the new block when they receive it anyway, they don't just trust the miners.

> **Comments:**
> **username_0**: As a node (user, when i receive a new block) how can i say that transaction inside that block are valid and not tamper by the miner if is the first time when i see that transaction? I can understand this if before a transaction is send in mempool also to be send to each node from p2p network and to store this transaction. When a new block arrives i can compare my local transactions with those from block. If a local transaction match with one from block is declare as valid else i not valid. This is how i see the things but i don't thing is write.  
> **username_1**: @Adrian a transaction has to be signed by the sender, if the transaction was modified the signature would not be valid. So as long as the signature is valid, you know the transaction is not tampered with  
> **username_0**: One more question. How can i know that signature was not tampered? I guess this signature is a hash on date or something like this. How can I know(me as a node) that the transaction I am looking at has a valid signature and was not tempered? Thanks  
> **username_1**: If the signature was tampered with, it would be invalid  
> **username_0**: I think i understand. Is something like..each transaction has a flag when i create the transaction this is set to true (sig is ok) if someone will change in any way this signature this flag will be false.(this is a way to see things, there maybe is more complicated way to validate transactions). What i am trying to say is that each transaction has a mechanism that will reveal if a transaction has been tempered or not. I am right @MeshCollider? :)  
> **username_1**: @Adrian yes, you can always tell if its been tampered with :)  

---

