General definition of a Smart Contract

Smart contracts are programs that are stored on a blockchain and run when predetermined conditions are met. Smart contracts are typically used for the automation of the execution of the agreement or condition. This ensures that all participants can be immediately certain of the outcome, without an intermediary’s involvement or time loss. They can also automate a workflow, triggering the next action when conditions are met.

Tezos Smart Contract

Tezos smart contracts are stored on the Tezos blockchain. They contain a set of rules and instructions which can be triggered by users or another piece of code. It is deployed using an “operation” onto the blockchain, where it stays immutable and publicly verifiable to everyone.

Since the smart contract is immutable so is the instructions and the rules inside it, the key difference being with a transfer of coins is a user can trigger the execution of the code without modifying it.

Operations for Smart Contract

Different from Bitcoin, which uses UTXO model to record the transaction receipt, Tezos uses a stateful account model to record the balance of an account [1].

Tezos accounts fall in either of these 2 categories:

  1. Classic accounts with a primary address, to store tez (ꜩ)
  2. Smart contract accounts with an address, storing code and tez (ꜩ)

"Contracts" usually refers to both types in general.

If a contract has the "spendable" property, the manager is the entity allowed to spend funds from it.

The functions of a smart contract can trigger different kinds of operations. Take for example of a vending machine dispensing multiple items:

Nothing can be retrieved from the vending machine unless the right conditions are met (sufficient amount inputted) and triggered by the user (selecting his/her choice).