Skip to content

PawanMohit16/DeploySmartContract

Repository files navigation

🛡️ CertVault – Smart Certificate System using Hardhat & Ganache

A simple yet powerful Ethereum smart contract project for issuing and verifying certificates, built with Hardhat, Solidity, and Ganache.


📁 Project Structure

CertVault/
├── contracts/
│   └── CertVault.sol            # Solidity contract for certificate issuance and validation
├── scripts/
│   └── deploy.js                # Script to deploy the smart contract
├── .env.example                 # Sample environment variables file
├── .gitignore
├── hardhat.config.js            # Hardhat config (network, compiler version, etc.)
├── package.json
└── README.md

🚀 Features

  • 🧾 Smart Contract Logic — Issue, store, and validate certificates via the blockchain
  • 🔒 Secure Deployment — Uses private keys from .env and Hardhat network
  • ⚙️ Easy Setup — Clear instructions for both beginners and experienced devs
  • 🧪 Test & Interaction Ready — Use Hardhat console/scripts or front-end integrations

✅ Prerequisites

Make sure you have the following installed:


⚡ Getting Started

1. Clone the Repository

git clone https://github.com/PawanMohit16/DeploySmartContract.git
cd DeploySmartContract

2. Install Dependencies

npm install

3. Configure Environment Variables

Copy the example environment file:

cp .env.example .env

Then open .env and paste your Ganache account private key:

PRIVATE_KEY=your_ganache_private_key_here

4. Start Ganache

You can either:

  • Launch Ganache GUI, or
  • Run CLI in a separate terminal:
ganache-cli

5. Compile the Smart Contract

npx hardhat compile

6. Deploy the Contract

npx hardhat run scripts/deploy.js --network ganache

After deployment, you'll see the contract address printed in the console.


🧪 How to Use

You can interact with the contract using the Hardhat console, scripts, or your own front-end.

  • Issue Certificate
issueCertificate(string memory recipientName, string memory courseName, string memory ipfsHash)
  • Validate Certificate
validateCertificate(string memory ipfsHash) → returns bool
  • Get Certificate Details
getCertificate(string memory ipfsHash) → returns (string memory recipientName, string memory courseName)

🛡️ Security Notes

  • ❌ Never commit your actual .env file or private keys
  • ✅ Only commit .env.example with placeholder values

📜 License

This project is licensed under the MIT License. See LICENSE for more information.


🙌 Contributions & Questions

Pull requests, issues, and stars are always welcome!

Want to format your own README.md like a pro?
Check out GitHub's Markdown Guide.


💡 For Developers

  • 🧾 Contract Logic — See contracts/CertVault.sol
  • ⚙️ Deployment Logic — See scripts/deploy.js
  • 🌐 Network Config — See hardhat.config.js

Happy building! 🎉

About

Deploying a smart contract for your location blockchain using hardhat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors