A smart contract is a self-enforcing agreement embedded in computer code managed by a blockchain . The code contains a set of rules under which the parties of that smart contract agree to interact with each other. If and when the predefined rules are met, the agreement is automatically enforced.