0% found this document useful (0 votes)
10 views22 pages

Lecture 4

Uploaded by

boooom86608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views22 pages

Lecture 4

Uploaded by

boooom86608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Smart Contracts

Smart Contract

● The concept of the smart contract was there well before the advent of
the Bitcoin.
● Computer scientist Nick Szabo detailed his idea of cryptocurrency Bit
gold as a sort of a precursor for Bitcoin.
● He also outlined the concept of smart contract in his 1996 publication.
● In fact, Szabo coined the term smart contract more than 20 years ago.
● Smart contract is a centerpiece and main thrust of Ethereum
blockchain.
● It is the good, bad and the ugly of the blockchain technology.
● It's a powerful feature.
● Improper design and coding of a smart contract, resulted in significant
failures such as DAO hack and Parity wallet lockup.
What Will going to learn

● Design
● Code
● Deploy
● Execute a smart contract.
Learning Objective

● Elements of Smart Contract


● Syntax and Semantics of Smart Contracts (Structure, Solidity
Language)
● Smart Contract Solutions - Problems that can be solved using smart
contracts.
● Use Remix
● Invoke Smart Contract from simple Web Interface
Smart Contract Advantages

● Transfer Assets other than value or cryptocurrency


● Specification of rules for an operation on the blockchain
● Implementation of policies for transfer of assets in a decentralized
network
● Adds programmability and intelligence to the blockchain
● Represents a business logic layer,with the actual logic coded in a
special high level language
● Embeds function that can be invoked by messages that are like
function calls.These messages and the input parameters for a single message are specified in a transaction.
Bitcoin Transactions Vs Ethereum Transaction
Smart Contact and Immutable

● Since a smart contract is deployed in the blockchain,


● It is an immutable piece of code, and once deployed, it cannot be
changed.
● We will have to redeploy the code as a new smart contract
● Somehow redirect the calls from a old contract to the new one.
Contract in Ethereum Blockchain has

● Pragma directive,
● Name of the contract
● Data or the state variable that define the state of the contract,
● Collection of function to carry out the intent of a smart contract.
● Identifiers representing these elements are restricted to ASCII
character set.
● Make sure you select meaningful identifiers and follow camel case
convention in naming them.
Remix

● Web integrated development environment


● Create
● Deploy
● Execute
● Explore the working of few representative smart contracts
● Available at Remix.ethereum.org.
Let's look at three steps in the development of a smart contract

Example Greeter Contract


Simple Storage Example

Example 2

You might also like