- First install truffle globally
npm install truffle -g
- Use
truffle init
to intiate truffle. - Now make changes in migration folder
const demo = artifacts.require("demo"); module.exports = function(deployer){ deployer.deploy(demo); }
- Add changes in
truffle-config.js
file.- Uncomment the development network and change port to
7545
- Then add the line given below in the
module.exports =
sectioncontracts_build_directory: "./frontend/public/contracts"
- Uncomment the development network and change port to
- ๐ Add the
Demo.sol
file in contract folder. Here is the code ๐ (--You can skip this step--)// SPDX-License-Identifier: UNLICENCED pragma solidity ^0.8.7; contract demo{ uint tomato; receive() external payable{} uint public numoffunder; mapping (uint => address) private funders; function transfer_tocontract() external payable{ funders[numoffunder] = msg.sender; } function withdraw(uint withdrawAmount) external payable{ require( withdrawAmount <= 2000000000000000000, "Cannot withdraw more than 2 ether" ); payable(msg.sender).transfer(withdrawAmount); } //setting and getting value of tomato function setvalue(uint value) public { tomato = value; } function getvalue() view public returns(uint){ return tomato; } }
- Add the Frontend folder in this repo in the root directory of project.
- Use
npm install
accordingly to install dependencies in frontend folder. - Now migrate the contract using
truffle migrate --reset
in frontend folder. - Finally Use
npm start
to see the working โโ
first-dapp-project's Introduction
first-dapp-project's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.