Skip to content

3atharvkurdukar/ethereum-dapps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum DApps

This repo holds the code to create Ethereum DApps using Solidity, HTML, CSS, and JavaScript. The Truffle framework is used for development and testing purposes. The frontend web application uses Web3.js API for interacting with the blockchain.

The repo describes the code written while learning from free YouTube tutorial Build 5 Dapps on the Ethereum Blockchain - Beginner Tutorial by freeCodeCamp.org.

The tutorial shows 5 different DApps built on top of Ethereum blockchain. I have created a different branch for holding the code related to each one of them.

The main branch acts as a starting point for each project and any future projects to come. It is a simple project created with truffle init

Project Structure

The project structure is as follows:

/
  contracts
    Migrations.sol
    ...
  migrations
    1_initial_migration.js
    ...
  test
    ...
  Readme.md
  truffle-config.js

The contracts folder holds the smart contracts to be deployed and used. These contracts are written in Solidity, thus having .sol extension

The migrations folder holds the code required for compiling and deploying the contracts. Once compiled, they generate smart contract artifacts, which are JSON objects representing the contract.

The public folder is the one used for frontend app. The website to be displayed to the user is located in this folder and served using serve package.

The test folder is useful for testing the smart contracts. The tests are necessary to find & mitigate potenstial risks before the app is deployed onto the blockchain.

For more information, see Truffle Docs

Installation

  • Install truffle as a global repository

    npm install -g truffle
  • Clone the repository

    git clone https://github.com/3atharvkurdukar/ethereum-dapps.git

Development

To start the development server, enter the following command:

truffle develop

This will create a development environment. A local blockchain will be created, along with 10 private key & public key combinations to test with. The development enviropnment allows us to deploy smart contracts to the local blockchain without signing them.

Once the blockchain has been created, a prompt will appear:

truffle(develop)>

The commands related to the development can be entered in the prompt.

In order to deploy the smart contract, enter:

truffle(develop)> migrate --hard

This will build the smart contract artifacts & deploy them on the blockchain. The --hard flag ensures that the artifacts generated by the previous folder are replaced by new artifacts.

Testing

To test the smart contract, enter:

truffle test

Releases

No releases published

Packages

No packages published