Trust is the most important thing when it comes to friendships, relationships, etc. But when it comes to business trust alone is not enough. Here comes the role of a contract.
A contract is a legal agreement between two or more parties. It tells about all the terms and conditions to which both parties agree to. This is done so that no one can later neglect the terms which were stated before.
A smart contract is just like any other contract but the terms are written in code and stored on the blockchain network. It is a self-executing contract which means it does not require a 3rd party to do that.
Let us take an example and understand. Suppose there is a guy Anil who is a freelancer. He got a project and he made a contract with the client that he would deliver the project in 6 months and then he would get his final payment of Rs 50,000. Now Anil and his client made a smart contract and the terms were if the project was delivered then the funds would be released. Now when Anil completes the project and the client receives it, the funds are released. The contract is completed.
The idea of a smart contract is similar to Bitcoin. The idea of Bitcoin was sending and receiving money between two parties without a middleman like a bank. Similarly, smart contracts are contracts which are created and executed without a middleman like a lawyer.
Yes of course they are safe because smart contracts are stored in blockchain.
It has 2 properties:
In Blockchain if write something once it is nearly impossible to change which makes it a lot more secure. If a smart contract is written once and the terms and conditions are specified it cannot be changed again. This increases its security and no one can change the terms and conditions in between.
Blockchain is a distributed network which is run by many people all around the world. Suppose someone wants to release the contract without having met the terms and conditions, he/she cannot do that because for it to happen it has to be validated by all the nodes running the network around the world.