How do nodes verify Bitcoin Transactions? I am trying to understand the role played by various nodes in the Bitcoin Network in verifying the transactions that are taking place in real time. I think that I understand the process of Transaction (using Input and Output Scripts) and how the Transaction is formed. However I am trying to correlate it with how a Transaction is Broadcasted to other nodes and then verified?

Consider an example:

if A wants to send some BTC to B, then 2 things will occur:

(a) A will form the input script of the new transaction. It will reference the output script of a previous transaction where A received some BTC (in the past). It will prove the ownership of those BTC by using its Public Key and verifying the Signature.

(b) The output script for the new transaction will be formed by A's client. It will store the hash of the BTC Address of B and enable it to spend these BTC in future.

Now, my questions are:


All these actions are performed by the Bitcoin Client of A and it does not require any interaction with the Peer to Peer Network. It has its own local copy of the Block Chain which it can use to perform the step a. So, isn't the transaction verified by the bitcoin client of A?
I am guessing that this new transaction that was created (input and output scripts formed as described above) will be broadcasted to the entire Bitcoin Network. Now, what type of verification is being performed by other nodes on this transaction?


On what basis is a Transaction accepted by the Bitcoin Network and integrated into the Block which is a part of the Block Chain?

Thanks.
Yes, but that doesn't mean that the network has accepted it.
There are rules for accepting a transaction.  Miners only include blocks that don't break the rules.  The rules include checking that the inputs are valid, that a coin isn't double-spent, that the output isn't more than the input, etc.


A miner can choose to include a transaction or not.  A miner could even choose to include a transaction that breaks the rules!  But if he does that, other miners that are following the rules won't accept his block and he won't get his mining reward.  So he has incentive to follow the rules.