Giter Club home page Giter Club logo

crowdfunding-1's Introduction

Crowdfunding dapp example

Run the crowdfunding dApp from scratch

Be in the root of this repo

  1. Install Truffle:
npm install -g truffle
  1. Install dependencies:
npm install
  1. Setup deploy environment:
bash ./scripts/setup.sh
  1. Truffle compile:
truffle compile
  1. Deploy:
bash ./scripts/deploy.sh
  1. Start Local server:
npm run serve
  1. Profit.

Exploration

Curious on how the deployment works? Here is the high level:

  • We use truffle to develop and iterate on our smart contract(s).
  • We set the contract deployment information in a .env file using the ./scripts/setup.sh script.
  • The environment variables are used in config.js and truffle-config.js for deployment of contracts (user facing code will not see or use the environment variable)
  • The contract deployment generates build and deploy files that are needed for the dapp to interface with.
  • On contract deployment, a script is ran (./scripts/deploy_check.js) to conduct a sanity check and start a test project.
  • Once the contracts are deployed, npm run serve will build our dapp with the correct configs to talk to our contracts.

Curious on how a user can interface with a dapp running on harmony? Here is a high level:

  • In this project, we use the Harmony extension found in the JS SDK (mathwallet).
  • Code to fetch an instance of the 2 smart contracts used by this project can be found in ./contracts/project.js & ./contracts/crowdfunding.js.
  • Code to instantiate a harmony extension object (for signing transactions and talking to smart contracts) can be found in ./src/extension.js
  • Functions for loading crowdfunding projects (fetching project info from contract) can be found in ./src/App.vue
  • Functions for creating a project (creating a project contract using the user's wallet) can be found in ./src/components/NewProjectForm.vue
  • Functions for funding a crowdfunding project can be found in ./src/components/ProjectCard.vue

Extra

Some more information on smart contract development can be found here.

crowdfunding-1's People

Contributors

daniel-vdm avatar rhazberries avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.