Smart contracts are contracts written in code, which the creator(s) upload to the blockchain. Any time one of those contracts is executed, every node on the network runs it, uploaded to the blockchain; thus, it is stored in the public ledger, theoretically tamper-proof.
Smart contracts are essentially structured as ‘If-then’ statements. When certain conditions are met, the program carries out the terms of the contract.
read my blogs follow me and up vote me
offcourse @rahulkoshti