![]() |
VOOZH | about |
A development environment is an environment in which all the resources and tools are available which are used to develop a program or software product. Here, an attempt to create a development environment that is a collection of the processes and tools that are used to develop smart contracts.
There are mainly two choices available to set up the environment for developing smart contracts:
This article focuses on discussing how to set up the local development environment for executing smart contracts.
A Smart Contract is a business contract built in the form of a program, which is deployed on the blockchain network, and the computation required for the execution of a program is provided by the blockchain network. The objectives of smart contracts are the reduction of the need in trusted intermediates, arbitrations, and enforcement costs, fraud losses, as well as the reduction of malicious and accidental exceptions.
Tools required for local environment setup:
The following tools are required to set up the local environment for the smart contract:
Install NodeJS:
Node.js is a free, open-source server environment that runs on various platforms(Windows, Linux, Mac OS, etc) and uses javascript on the server. As an asynchronous event-driven javascript runtime, Node.js is designed to build scalable network applications.
When Node.js is installed on the system npm(Node package manager) is also installed which is used to install various packages using command prompt. We can
Install Truffle Suite:
Truffle Suite is a world-class development environment, testing framework, and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier.
To install TRUFLLE SUITE we use npm command in the command prompt-
npm install truffle -g
Install Ganache (Single node local Ethereum network):
Install Visual Studio Code:
Visual Studio Code has been one of the best IDE provided by Microsoft for solidity smart contract development.
Install Solidity:
Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs that govern the behavior of accounts within the Ethereum state. Solidity is statically typed, supports inheritance, libraries, and complex user-defined types among other features. With Solidity, you can create contracts for uses such as voting, crowdfunding, blind auctions, and multi-signature wallets. When deploying contracts, you should use the latest released version of Solidity.
Building first smart contract:
Step 1: Open command prompt terminal in VS code and type command-
mkdir hello-world
cd hello-world
Step 2: Generates the template of the smart contract by executing the command-
truffle init
Step 3: Now, Create HelloWorld.sol file by executing the command-
truffle create contract HelloWorld
👁 truffle create contract command
Step 4: Now copy or type the below code to your code editor.
Step 5: After typing the above code execute the command-
truffle compile
This command will compile your solidity program and a new folder is created named "build" and the following output will be displayed-
Step 6: After compiling the Smart Contract execute the below command to deploy the Smart Contract.
truffle migrate
This command used to deploy the Smart Contract and return the deployed Smart Contract address.