In short, smart contracts are simply a type of contract between parties that uses Blockchain technology. The parties to the contract know that once they both fulfill the conditions in the contract, an asset transfer will occur. The contract is void if either of the parties does not comply with their contractual obligations. Both parties get protection from breaches in the contract without the need for judicial mediations. This is because other users in the network act as judges to determine if the parties breached or complied with the contract. Furthermore, intermediary fees are avoided since there is no need for middlemen.
Smart contracts have rather diverse applications. For example, the blockchain can hold a payment until there is confirmation that the paying party received a packet. Think of this as when you use a vending machine (an ideal one that does not fail). Here, you put coins in the system, the machine holds them until you make a selection and get the product. Once the machine gives you the product, the machine lets the coins fall into the collection box.
Another example would be the use of smart contracts in real estate rentals. You could lease a property and the system would hold your payment until the renter sends you an entry code. Once the rental period is over, the system locks back the access and releases the funds to the renter. Often, parties put an escrow amount in the contract and this motivates them to perform their contractual obligations. If both parties comply, the deposits go back to their accounts and the contractual payment goes through. If the fulfillment of the contract fails, the deposit of the breaching party forfeits to the network intermediary as a fee.
The credibility of a contract
Both of the previous examples do not fully meet the definition of a smart contract. Smart contracts require perfectly verifiable terms and obligations. Both examples also lack the availability of the source “code” to both parties. In smart contracts, everyone involved is able to verify the rules in the program that will determine the outcome.
In the example of the vending machine, there is no way to know the programming of the system before starting a transaction. One of the parties does not have the source code of the program and the computing platform available to them, so the user is forced to rely on the claims of the machine manufacturer. This does not necessarily matter in the case of a vending machine, where the value of the transaction is small, but that would represent a huge problem if the machine you are about to use is going to store a large amount of your assets.
Asymmetric cryptography and blockchain technology are two of the tools that can overcome this drawback. These can create a trusted platform that mathematically ensures that the code governing a contract is both accurate and fair.
Learn more about smart contracts here: https://en.wikipedia.org/wiki/Smart_contract