This verification process is performed by Bitcoin nodes. The following is described in the Bitcoin developer guide:
- Check the syntax and ensure that the syntax and data structure of the transaction conforms to the rules provided by the protocol.
- Verify that no transaction inputs and outputs are empty.
- Check whether the size in bytes is less than the maximum block size.
- The output value must be in the allowed money range (0 to 21 million BTC).
- All inputs must have a specified previous output, except for coinbase transactions, which should not be relayed.
- Verify that nLockTime must not exceed 31-bits. (nLockTime specifies the time before which transaction will not be included in the block.)
- For a transaction to be valid, it should not be less than 100 bytes.
- The number of signature operations in a standard transaction should be less than or not more than two.
- Reject nonstandard transactions; for example, ScriptSig is allowed to only push numbers on the stack. ScriptPubkey not passing the isStandard() checks. The isStandard() checks specify that only standard transactions are allowed.
- A transaction is rejected if there is already a matching transaction in the pool or in a block in the main branch.
- The transaction will be rejected if the referenced output for each input exists in any other transaction in the pool.
- For each input, there must exist a referenced output unspent transaction.
- For each input, if the referenced output transaction is the coinbase, it must have at least 100 confirmations; otherwise, the transaction will be rejected.
- For each input, if the referenced output does not exist or has been spent already, the transaction will be rejected.
- Using the referenced output transactions to get input values, verify that each input value, as well as the sum, is in the allowed range of 0-21 million BTC. Reject the transaction if the sum of input values is less than the sum of output values.
- Reject the transaction if the transaction fee would be too low to get into an empty block.
- Each input unlocking script must have corresponding valid output scripts.