This repository contains a sample project that you can use as the starting point for your Ethereum project. It's also a great fit for learning the basics of smart contract development.
This project is intended to be used with the
Hardhat Beginners Tutorial, but you should be
able to follow it by yourself by reading the README and exploring its
contracts
, tests
, scripts
and frontend
directories.
- The smart contract is reusable; multiple projects can be registered and accept ETH concurrently.
✅ The goal is a preset amount of ETH.
✅- This cannot be changed after a project gets created.
- Regarding contributing:
✅- The contribute amount must be at least 0.01 ETH.
✅- There is no upper limit.
✅- Anyone can contribute to the project, including the creator.
✅- One address can contribute as many times as they like.
- Regarding tiers:
- There are three tiers.
- Bronze tier is granted to anyone contribution.
- Silver tier is granted to a total contribution of at least 0.25 ETH.
- Gold tier is granted to a total contribution of at least 1 ETH.
- Tiers should be granted immediately so other apps can read them.
✅- "Total contribution" is scoped per-project (like kickstarter).
- If the project is not fully funded within 30 days:
- The project goal is considered to have failed.
- No one can contribute anymore.
- Supporters get their money back.
- Tier grants are revoked.
- Once a project becomes fully funded:
✅- No one else can contribute (however, the last contribution can go over the goal).
- The creator can withdraw any percentage of contributed funds.
✅- The creator can choose to cancel their project before the 30 days are over, which has the same effect as a project failing.
The first things you need to do are cloning this repository and installing its dependencies:
git clone https://github.com/nomiclabs/hardhat-hackathon-boilerplate.git
cd hardhat-hackathon-boilerplate
npm install
Once installed, let's run Hardhat's testing network:
npx hardhat node
Then, on a new terminal, go to the repository's root folder and run this to deploy your contract:
npx hardhat run scripts/deploy.js --network localhost
Finally, we can run the frontend with:
cd frontend
npm install
npm start
Note: There's an issue in
ganache-core
that can make thenpm install
step fail.If you see
npm ERR! code ENOLOCAL
, try runningnpm ci
instead ofnpm install
.
Open http://localhost:3000/ to see your Dapp. You will
need to have Metamask installed and listening to
localhost 8545
.
You can find detailed instructions on using this repository and many tips in its documentation.
- Project description (Token.sol)
- Setting up the environment
- Testing with Hardhat, Mocha and Waffle
- Setting up Metamask
- Hardhat's full documentation
For a complete introduction to Hardhat, refer to this guide.
Your environment will have everything you need to build a Dapp powered by Hardhat and React.
- Hardhat: An Ethereum development task runner and testing network.
- Mocha: A JavaScript test runner.
- Chai: A JavaScript assertion library.
- ethers.js: A JavaScript library for interacting with Ethereum.
- Waffle: To have Ethereum-specific Chai assertions/mathers.
- A sample frontend/Dapp: A Dapp which uses Create React App.
Invalid nonce
errors: if you are seeing this error on thenpx hardhat node
console, try resetting your Metamask account. This will reset the account's transaction history and also the nonce. Open Metamask, click on your account followed bySettings > Advanced > Reset Account
.
We'd love to have your feedback on this tutorial. Feel free to reach us through this repository or our Discord server.
Also you can follow us on Twitter.
Happy buidling!