Welcome to the starter project for the "12 Nights of Code" class! This project will guide you through setting up and running a simple Ethereum development environment using Hardhat, along with other essential tools like Solidity, Waffle, and more.
Before you start, ensure you have the following installed on your machine:
- Node.js (LTS version) Download Node.js
- Yarn (Recommended for package management) Install Yarn
- Git Download Git
- Visual Studio Code (VS Code) Download VS Code
Clone this repository to your local machine using Git:
git clone https://github.com/KibokoDao-Africa/Adamur-Tribe-12-Nights-of-Code.git
cd Adamur-Tribe-12-Nights-of-Code
Install the required dependencies using Yarn (recommended):
yarn install
Alternatively, if you're using npm, you can install the dependencies with:
npm install
Hardhat is a development framework for Ethereum. After installing dependencies, make sure everything is set up correctly.
To verify Hardhat is installed, run:
npx hardhat
You should see the Hardhat console output.
You need to set up your .env file to store sensitive information like your Infura or Alchemy API keys and wallet private key.
-
Create a .env file in the root of your project.
-
Add the following entries, replacing with your own values:
INFURA_API_KEY=your_infura_api_key
PRIVATE_KEY=your_wallet_private_key
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/your_infura_project_id
If you're using other RPC providers, you can replace the URLs accordingly.
To compile your smart contracts, run:
npx hardhat compile
To run tests for your smart contracts, use:
npx hardhat test
To deploy the smart contract to the Sepolia testnet, you can use the following command:
npx hardhat run scripts/deploy.js --network sepolia
This will deploy your smart contract to Sepolia. Make sure you have configured the sepolia network in your hardhat.config.js file.
Once deployed, you can interact with your smart contracts directly through Hardhat's console:
npx hardhat console --network sepolia
If you run into issues with dependencies or node versions, try deleting the node_modules folder and package-lock.json (or yarn.lock if you're using Yarn), then reinstall the dependencies:
rm -rf node_modules package-lock.json yarn.lock
yarn install
If you face authentication issues during deployment, ensure that your wallet's private key and RPC URL are correctly configured in the .env file.
Feel free to fork this repository and make changes to improve the project or share your progress with the community. If you have suggestions or improvements, open an issue or submit a pull request!
This project is licensed under the MIT License - see the LICENSE file for details.