Professional Documents
Culture Documents
CONTRACTS
Curs 4
WHAT IS A SMART
CONTRACT?
• Smart contracts are digital contracts stored
on a blockchain that are automatically
executed when predetermined terms and
conditions are met.
WHAT IS A
Smart contracts are simply programs stored on a
SMART blockchain that run when predetermined
CONTRACT conditions are met.
• Smart contracts work by following “if/when…then…” statements that are written into code
on a blockchain.
• A network of computers executes the actions when predetermined conditions have been
met and verified. These actions could include releasing funds to the appropriate parties,
registering a vehicle, sending notifications, or issuing a ticket.
• The blockchain is then updated when the transaction is completed. That means the
transaction cannot be changed, and only parties who have been granted permission can
see the results.
HOW SMART CONTRACTS WORK
• Within a smart contract, there can be as many stipulations as needed to satisfy the
participants that the task will be completed satisfactorily.
• To establish the terms, participants must determine how transactions and their data are
represented on the blockchain, agree on the “if/when...then…” rules that govern those
transactions, explore all possible exceptions, and define a framework for resolving
disputes.
HOW SMART CONTRACTS WORK
• Solidity is the main smart contract programming language that is used to build smart
contracts on the Ethereum blockchain.
• It is a high-level programming language that looks similar to Python, C++, and JavaScript.
• It is a contract-oriented programming language meaning that smart contracts are vested
with the responsibility of storing all the programming logic that transacts with the
blockchain.
• The Solidity programming language runs on the Ethereum Virtual Machine (EVM) that is
hosted on Ethereum nodes connected to the blockchain.
SOLIDITY
EXAMPLE
Tutorial
• https://www.tutorialspoint.com/solidity
pragma solidity 0.8.7;
contract VendingMachine {
VENDING // Declare state variables of the contract
• The smart contract must be compiled down to Ethereum virtual machine (EVM) bytecode and
deployed to the Ethereum blockchain for execution
• Solidity Compiler: https://docs.soliditylang.org/en/v0.8.9/installing-solidity.html
SOLIDITY IDES
• https://www.ibm.com/topics/smart-contracts
• https://ethereum.org/en/developers/docs/smart-contracts/
• https://docs.soliditylang.org/en/latest/solidity-by-example.html