TEP , The Engineering Projects , Author Welcome! Syed Zain Nasir Mechatronics Engineer TEP , The ENgineering Projects , TEP Badge TEP , The Engineering Projects , Ratting Background 7.5 7.5/10
TEP , The Engineering Projects , Rating Percentage Background Reputation Score 55 / 100
what is Smart Contracts, blockchain smart contract, Introduction to smart contracts, Writing Smart Contracts, Smart contracts tools, Deploying Smart Contracts
TEP , The Engineering Projects , Boxes

Smart Contracts: Definition, Working, Writing & Deploying

TEP , THe Engineering Projects , Shares 2.5K Views
TEP , The ENgineering Projects , Reaction 40
TEP , The ENgineering Projects , Reaction 700
TEP , The ENgineering Projects , Reaction 60
TEP , The ENgineering Projects , Reaction 25
TEP , The ENgineering Projects , Reaction 60
TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest
Shares: 691
TEP , The Engineering Projects , PCBWAY

what is Smart Contracts, blockchain smart contract, Introduction to smart contracts, Writing Smart Contracts, Smart contracts tools, Deploying Smart Contracts
Hello friends, Hope you are doing fine and having a good time in your life. The topic that I am going to discuss today is a very interesting and important one in the context of blockchain. I will discuss smart contracts in this article and I am sure you will learn the concept by the end of this tutorial. I have mentioned smart contracts in my previous articles and defined them before.

Before discussing smart contracts, let’s first revise what a contract is, and then we will talk about smart contracts.

Contract

  • When two persons or two parties want to carry out a deal or a transaction such as buying property, they need some proof for future reference.
  • So, a contract between two or more individuals is a legal document that serves as proof for the transaction.
  • All conditions of the transaction are mentioned in the contract and must be fulfilled by the involved parties.
This was the basic idea and revision of the concept of a contract. Now, I will introduce a smart contract in the next section.
what is Smart Contracts, blockchain smart contract, Introduction to smart contracts, Writing Smart Contracts, Smart contracts tools, Deploying Smart Contracts

Smart Contract

what is Smart Contracts, blockchain smart contract, Introduction to smart contracts, Writing Smart Contracts, Smart contracts tools, Deploying Smart Contracts
When reading about blockchain and decentralized applications, you must have encountered the term “Smart Contract”. The name may indicate to you that it could be a contract that executes smartly or that has smart conditions. Well, in actuality, it is a contract whose conditions fulfill when it executes. If the conditions of such a contract are not met, then the execution fails.
  • In the Ethereum blockchain, a smart contract is actually a program that is deployed on Ethereum.
  • The smart contract contains logic and it is written in some high-level language.
  • An example of a high-level language is solidity that we will discuss in the upcoming tutorials.
  • A smart contract is a set of rules that are coded in the form of a program. These rules govern the transactions between the Ethereum accounts. The transaction could be a transfer of assets, transfer of money, or a change of Ethereum state.
  • In Ethereum, the type of account having a smart contract is called “Contract Account”.
  • Smart contracts can have balance and can also store data. They contain several functions that can be called by other accounts.
I have told you earlier that only an externally owned account can initiate a transaction on Ethereum and call a smart contract. Once initiated, the smart contract can call other smart contracts deployed on Ethereum or it can deploy a new contract.

Writing Smart Contracts

what is Smart Contracts, blockchain smart contract, Introduction to smart contracts, Writing Smart Contracts, Smart contracts tools, Deploying Smart Contracts
In this part of the tutorial, we are going to discuss writing smart contracts for Ethereum. Various tools are available for writing smart contracts. First, let’s talk about Remix.

Remix

  • The remix is an Integrated Development Environment for writing smart contracts.
  • It is a browser-based IDE and helps in developing contracts easily.
  • The language used is Solidity.
  • It helps in the following functions:
    • Writing and developing smart contracts
    • Deploying contracts on Ethereum networks
    • Troubleshooting contracts
  • A remix is an open-source tool available freely for everyone. So, if you are not comfortable using the online version, you can simply download it and use its functionality.
  • The downloaded version can be used offline on a local computer system.
  • The general steps for writing a smart contract using the online tool are given below:
    • Open your browser and type https://remix.ethereum.org/ in the address bar.
    • The site will show some default contracts. You can use that, study that or you can simply delete that if not needed.
    • On the left bar, there would be an option to create a new file. Use that to create your smart contract.
    • Write the code for your smart contract in the newly made file.
    • The next steps are to compile the contract using a solidity compiler and deploying it on the network.
    • After deployment, the functions written in the contract code can be executed.
This was a brief introduction to remix. Let’s talk about Solidity now.

Solidity

  • Solidity is a high-level programming language used for writing smart contracts.
  • This language has similarities with C and JavaScript languages.
  • Solidity is case-sensitive.
  • The extension of a solidity file is .solc and this file contains code.
  • You can write and read such a file in any text editor.
  • The solidity compiler is used for the compilation of code and named “solc”. The compiler generates the bytecode of the smart contract.
  • This bytecode is generated for the Ethereum virtual machine as it cannot understand code in the high-level language.
  • You can install solc using npm by typing the following command in the command prompt.

npm install –g solc

Remix and Solidity are the two essential tools for writing smart contracts. In the next part, we will discuss the deployment of contracts.

Deploying Smart Contracts

what is Smart Contracts, blockchain smart contract, Introduction to smart contracts, Writing Smart Contracts, Smart contracts tools, Deploying Smart Contracts
The contracts are deployed after compilation. The solidity compiler performs this task and generates two main outputs that are listed below:
  1. ABI
  2. Bytecode
Now let’s explore these two concepts.

ABI

  • ABI stands for Application Binary Interface.
  • ABI of a smart contract contains a declaration of all public and external functions. It also contains their parameters and returns types.
  • ABI is the definition of a contract. Any account that wants to execute a contract function uses its ABI.
  • After deployment, the contract instance is created using its application binary interface.

Bytecode

  • The bytecode is understandable by Ethereum and helps in deploying the contract on the Ethereum virtual machine.
  • Ethereum virtual machine cannot understand solidity so bytecode is a must.

ABI definition and bytecode both are necessary for deployment. The transaction for deploying a contract on EVM takes place and an address is generated for the smart contract. This address is the identifier of the contract. Any function of the contract can be called and executed using the contract address.

So, guys, this was all about smart contracts. We discussed the main idea and some steps to create a smart contract. The two main tools for creating a contract are also discussed in this tutorial. I hope you have learned these concepts and enjoyed reading them. That’s all for today. Take care and have fun.

TEP , The Engineering Projects , Tags
what is Smart Contracts
blockchain smart contract
Introduction to smart contracts
Writing Smart Contracts
Smart contracts tools
Deploying Smart Contracts
TEP , The Engineering Projects , Comments

Write a Comment

TEP , The Engineering Projects , WordPress TEP , The Engineering Projects , Google TEP , The Engineering Projects , Twitter TEP , The Engineering Projects , Facebook TEP , The Engineering Projects , User
TEP , The Engineering Projects , Robot
TEP , The Engineering Projects , Comments Comments on ‘’ Smart Contracts: Definition, Working, Writing & Deploying ‘’ (0)
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Top PCB Design Service

PCBA
TEP , The Engineering Projects , JLCPCB
PCB
TEP , The Engineering Projects , JLCPCB
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Embedded Tools

ARDINO TEP , The Engineering Projects , JLCPCB
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Subscribe Now !!!

Learn Free Pro Tricks

TEP , The Engineering Projects , Mail Receive Quality Tutorials Straight in your Inbox by Submitting your Email ID Below
TEP , The Engineering Projects , Mail TEP , The Engineering Projects , Mail Shadow
TEP , The Engineering Projects , Mail Robot TEP , The Engineering Projects , Mail Robot Shadow TEP , The Engineering Projects , Mail Robot Shadow
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Engineering Books

TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for arduino $20
TEP , The Engineering Projects , Rating Stars (5.0)
TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for Raspberry Pi $20
TEP , The Engineering Projects , Rating Stars (3.0)
TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for arduino $20
TEP , The Engineering Projects , Rating Stars (4.7)
TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for Raspberry Pi $20
TEP , The Engineering Projects , Rating Stars (5.0)
TEP , The Engineering Projects , TEP Robot TEP , The Engineering Projects , TEP Robot Shadow TEP , The Engineering Projects , TEP Robot Shadow
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Categories

TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K