Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Build Ethereum Dapp

Rating
-
Sold
-
Pages
3
Uploaded on
03-05-2023
Written in
2022/2023

Learn how to create your first decentralized application on the Ethereum network with Gregory from DAP University. We will create an election where network accounts can vote and track the vote count in real-time on a local Ethereum blockchain.

Show more Read less
Institution
Course

Content preview

How to Build Ethereum Dapp (Decentralized
Application Development Tutorial)
Learn how to create your first decentralized application on the Ethereum network with
Gregory from DAP University. We will create an election where network accounts can
vote and track the vote count in real-time on a local Ethereum blockchain.

A blockchain is both a database and a network, where all nodes communicate with each
other. Unlike traditional web models, a blockchain is a network and database in one,
helping to ensure that all data recorded on the public ledger remains secure and
unchanged.

In a voting application, this is especially important as it ensures that the rules of the
election cannot be changed. Our decentralized application, Adapt, is truly decentralized,
as the network is peer-to-peer, and data is decentralized. We will write our smart
contract code for the decentralized application to allow accounts on the network to use
the app and vote in the election.

The Truffle framework provides packages of boilerplate code called boxes that can be
easily added to our project for faster setup. To interact with our smart contract, we can
connect to our local Ethereum network using personal accounts and MetaMask.
Additionally, we must install Google Chrome to utilize the Ethereum blockchain. Our
first step is to create a smoke test to verify proper setup, ensuring that our contract is set
up correctly, can be deployed, and responds as expected. To achieve this, we need a
constructor to be executed during deployment.

Truffle will use an initial migration file as a reference point to create our migration file,
which deploys our smart contract to the blockchain.

Truffle allows for easy interaction with our contract. This can be done through the
console during testing or through a frontend application. In the example below, we use
the directive to deploy our contract.

The migrations contract is referenced in three places. It is read from the project
directory, assigned to a variable called "migrations", and then referenced later.

In this example, Truffle is using Solidity version 0.4.11. Let's change this to 0.4.2,
which is the version that comes with this version of Truffle.

It's important to note that while Truffle can read from the blockchain, writing to the
blockchain incurs a cost in gas. We will discuss the concept of gas more in-depth later.

To model a candidate in our smart contract, we need a way to create a new type. In
Solidity, we can use the "struct" keyword followed by the name of our new type, which
in this case is "candidate".

Once we have defined our new type, we need a place to store instances of it. This can be
done by instantiating the structure type.

Written for

Course

Document information

Uploaded on
May 3, 2023
Number of pages
3
Written in
2022/2023
Type
Class notes
Professor(s)
Blockchain developer
Contains
All classes

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
codewithvishalchopde

Get to know the seller

Seller avatar
codewithvishalchopde India
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions