<p>A bit late, but for the audience eventually searching for this response:</p>

<blockquote>
  <p>point toward some technical resource where I could find that
  description ?</p>
</blockquote>

<p><a href="https://en.bitcoin.it/wiki/Transaction#Verification" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Transaction#Verification</a></p>

<p><a href="https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages</a></p>

<p>Short cut&amp;paste (march 2018):</p>

<pre><code>These messages hold a single transaction.
Check syntactic correctness
Make sure neither in or out lists are empty
Size in bytes &lt;= MAX_BLOCK_SIZE
Each output value, as well as the total, must be in legal money range
Make sure none of the inputs have hash=0, n=-1 (coinbase transactions)
Check that nLockTime &lt;= INT_MAX[1], size in bytes &gt;= 100[2], and sig opcount &lt;= 2[3]
Reject "nonstandard" transactions: scriptSig doing anything other than pushing numbers on the stack, or scriptPubkey not matching the two usual forms[4]
Reject if we already have matching tx in the pool, or in a block in the main branch
For each input, if the referenced output exists in any other tx in the pool, reject this transaction.[5]
For each input, look in the main branch and the transaction pool to find the referenced output transaction. If the output transaction is missing for any input, this will be an orphan transaction. Add to the orphan transactions, if a matching transaction is not in there already.
For each input, if the referenced output transaction is coinbase (i.e. only 1 input, with hash=0, n=-1), it must have at least COINBASE_MATURITY (100) confirmations; else reject this transaction
For each input, if the referenced output does not exist (e.g. never existed or has already been spent), reject this transaction[6]
Using the referenced output transactions to get input values, check that each input value, as well as the sum, are in legal money range
Reject if the sum of input values &lt; sum of output values
Reject if transaction fee (defined as sum of input values minus sum of output values) would be too low to get into an empty block
Verify the scriptPubKey accepts for each input; reject if any are bad
Add to transaction pool[7]
"Add to wallet if mine"
Relay transaction to peers
For each orphan transaction that uses this one as one of its inputs, run all these steps (including this one) recursively on that orphan
</code></pre>

CC BY-SA 3.0
2018-03-16T15:30:10.800Z
2018-03-16T15:30:10.800Z
pebwindkraft
<p>I'm having some trouble understanding the process of transaction verification on full nodes. I understand how a transaction is verified via public cryptography (hashes, signature, etc, as it's explained in the original Satoshi paper), but i can't find how this process is done on the real software, involving the UTXO database and any other optimizations that may be done in the actual full node clients.</p>

<p>I've started to dig on the reference implementation code, as a I'm a programmer and i <em>hope</em> to understand the process a little more by looking at the sources but, until then and maybe as a guide, could some expose how that process is done with a little example, even in broad terms it could be helpful, or point toward some technical resource where I could find that description ?</p>

<transactions><bitcoin-core><verification>
Transaction verification process in full nodes
perencia
# Transaction verification process in full nodes

(Asked by: username_0 on 2014-05-13)

I'm having some trouble understanding the process of transaction verification on full nodes. I understand how a transaction is verified via public cryptography (hashes, signature, etc, as it's explained in the original Satoshi paper), but i can't find how this process is done on the real software, involving the UTXO database and any other optimizations that may be done in the actual full node clients.

I've started to dig on the reference implementation code, as a I'm a programmer and i *hope* to understand the process a little more by looking at the sources but, until then and maybe as a guide, could some expose how that process is done with a little example, even in broad terms it could be helpful, or point toward some technical resource where I could find that description ?

**Tags:** transactions, bitcoin-core, verification


---

## 1 answers

### Answer by username_1 on 2018-03-16. Score: 2

A bit late, but for the audience eventually searching for this response:

> point toward some technical resource where I could find that
> description ?

<https://en.bitcoin.it/wiki/Transaction#Verification>

<https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages>

Short cut&paste (march 2018):

```
These messages hold a single transaction.
Check syntactic correctness
Make sure neither in or out lists are empty
Size in bytes <= MAX_BLOCK_SIZE
Each output value, as well as the total, must be in legal money range
Make sure none of the inputs have hash=0, n=-1 (coinbase transactions)
Check that nLockTime <= INT_MAX[1], size in bytes >= 100[2], and sig opcount <= 2[3]
Reject "nonstandard" transactions: scriptSig doing anything other than pushing numbers on the stack, or scriptPubkey not matching the two usual forms[4]
Reject if we already have matching tx in the pool, or in a block in the main branch
For each input, if the referenced output exists in any other tx in the pool, reject this transaction.[5]
For each input, look in the main branch and the transaction pool to find the referenced output transaction. If the output transaction is missing for any input, this will be an orphan transaction. Add to the orphan transactions, if a matching transaction is not in there already.
For each input, if the referenced output transaction is coinbase (i.e. only 1 input, with hash=0, n=-1), it must have at least COINBASE_MATURITY (100) confirmations; else reject this transaction
For each input, if the referenced output does not exist (e.g. never existed or has already been spent), reject this transaction[6]
Using the referenced output transactions to get input values, check that each input value, as well as the sum, are in legal money range
Reject if the sum of input values < sum of output values
Reject if transaction fee (defined as sum of input values minus sum of output values) would be too low to get into an empty block
Verify the scriptPubKey accepts for each input; reject if any are bad
Add to transaction pool[7]
"Add to wallet if mine"
Relay transaction to peers
For each orphan transaction that uses this one as one of its inputs, run all these steps (including this one) recursively on that orphan

```


---

