How does a node decide whether a transaction is valid and whether to propagate it to other nodes?
Could you please mention some of the basic rules that nodes follow for such a purpose?
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
There are consensus rules and policy rules for a transaction to follow. If a transaction doesn't follow all these rules then a node won't allow that transaction to enter into its mempool and won't propagate it to its peers. Policy rules include checking the transaction pays a non-zero transaction fee (above the dust level) and isn't spending from an undefined (soft fork) SegWit version.
Transactions that don't follow policy rules can still make it into a mined block however as a miner may have different policy rules to a node(s) on the network. But a transaction that doesn't follow consensus rules can't be included in a block as other miners and other nodes on the network would reject a block with that consensus invalid transaction in it. Consensus rules check things like the transaction isn't creating new Bitcoin out of thin air (unless a coinbase transaction), that it includes the required signature(s) and isn't encumbered by an unexpired timelock.