2. What Is a Smart Contract?
Fundamentally, a “smart contract” is a set of coded computer
functions.
◦ May incorporate the elements of a binding contract (e.g., offer, acceptance,
and consideration), or may simply execute certain terms of a contract.
◦ Allows self-executing computer code to take actions at specified times and/or
based on reference to the occurrence or non-occurrence of an action or event
(e.g., delivery of an asset, weather conditions, or exchange of goods).
Smart contacts can be used for any type of transaction — it doesn’t
have to be financial.
3. Characters of Smart Contracts
A “smart contract” is not necessarily “smart.”
◦ The operation is only as smart as the information feed it receives
and the machine code that directs it.
A “smart contract” may not be a legally binding contract.
◦ It may be a gift or some other non-contractual transfer.
◦ It may be only part of a broader contract.
◦ To the extent a smart contract violates the law, it would not be
binding or enforceable.
4. Benefits of smart contract
• No intermediaries are needed, as the smart contract is executed
automatically
• The smart contract is executed quickly and independently of any
traditional financial n institution
• The contract can't be tampered with because it's immutable
• The transaction fee is low, costing almost nothing compared to
traditional payment systems
5. What are Smart Contracts Currently Being
Used For?
• Insurance Companies
• Health Systems
Health systems will use smart contracts to record and safely transfer data.
• Governments
smart contracts running on the blockchain can make voting systems completely
trustless and much more secure
• Business Management
Businesses can benefit massively from smart contracts. Instead of paying staff to run
payrolls, they can use smart contracts.
• ICOs ((Initial Coin Offering)
An ICO is a crowdfunding system for new applications that use blockchain technology.
One create a smart contract and a token for that smart contract.
6. How are Smart Contracts Created?
Smart contracts can be built on multiple blockchain platforms, including Ethereum
and NEO.
Ethereum is the most popular choice for developers
◦ Smart contracts are developed using Ethereum’s original coding language, called Solidity.
Neo smart contract can be used directly by almost any high-level programming language.
◦ Supported languages are C#, VB.Net, F#, Java, Kotlin, Python, GO, JavaScript
7. How the Ethereum platform executes
smart contracts
Before diving into building an Ethereum smart contract, you should have a clear
understanding of what’s under the hood of the Ethereum blockchain platform and
how exactly it executes smart contracts.
◦ Ethereum Virtual Machine (EVM)
a special virtual machine that’s an interpreter for the assembly language.
◦ Solidity
Solidity is the smart contract language on Ethereum. It’s a general-purpose programming
language developed on top of the EVM.
◦ Gas
Reward given to miners for processing the smart contract and adding it to blockchain
9. Requirements
◦ Node.js − A JavaScript runtime environment for server-side programming.
◦ Truffle − A popular Ethereum development framework that allows you to write and test
smart contracts.
◦ Ganache CLI − An Ethereum remote procedure call (RPC) client within the Truffle
framework;
◦ Web3.js − An Ethereum JavaScript API that communicates with the Ethereum network
through RPC calls.
◦ Parity − A fast and secure Ethereum client for managing accounts, tokens, and so on.
◦ Visual Studio Code − A functional code editor; in fact, you’re welcome to use any other
editor.
10. Step #1 : Introducing two parties to an Ethereum
smart contract
Any smart contract is concluded by two sides.
◦ The client, who needs to get some home service done.
◦ The tasker, who completes a task and gets paid for it.
A client pays a tasker for fulfilling a task, so you should add a payment amount to
the smart contract as well; we called it payAmount.
11. Step #2: Enabling a client to transfer money to a
smart contract
A smart contract acts like a separate account that can either send
money to a tasker or send it back to a client. But first, a client must be
able to send money to the smart contract.
NOTE : nobody but a client can transfer money to a smart contract
and that it’s impossible for anyone to increase the payAmount:
12. Step #3: Allowing a smart contract to transfer
money to a tasker
Smart contract must be able to automatically send money to a tasker
as soon as a client confirms that the task has been completed.
◦ we need to introduce a new role in the smart contract – a deployer,
which is a web application on blockchain marketplace
◦ specify that only a deployer can initiate a transfer of money to a
tasker.
13. Step #4: Deploying your smart contract
The smart contract in Solidity is ready so there’s one final step −
compile and then deploy it.
◦ Create Ethereum wallets
◦ Get Ether on the Ropsten testnet( to check if wallet is working or
not)
◦ Compile the smart contract with Truffle
We’ve already built a smart contract written in Solidity, but it should be turned into a .json
file for deployment. Use Truffle to compile your smart contract; it will create a .json file
◦ Run a deployment script
◦ Execute your smart contract
Once your smart contract is deployed, you can execute it. To do this, you need to specify
the wallets for the client, tasker, and deployer and the reward for the tasker.
14. How Smart Contracts Will Change
the World
Smart contracts have huge potential. Not only do they streamline
transactions, they can revolutionize whole industries such as real estate,
banking, ecommerce, and healthcare.
If smart contracts fulfill their purpose, perhaps we’ll one day live in a world
that is free of middlemen.
◦ The best thing about having no middlemen is the fact that we save
a lot of money. Not only that, but we would no longer need to trust
anyone, either.
It can reduce fraud, delays and the overall cost of many things.