Skip to content

This repository contains the project SMART CONTRACT AND FRONTEND , which I developed as part of my coursework at Metacrafters

Notifications You must be signed in to change notification settings

Paraass/smart-contract-frontend

Repository files navigation

Smart Contract Management and Frontend

Overview

This project includes a Solidity smart contract and a frontend interface for interacting with it.
The contract allows users to manage a message string, increment a counter, and transfer ownership securely.
The frontend provides a seamless UI for interacting with the deployed contract on the blockchain.

Features

  • Set and Update Message: Users can modify the stored message.
  • Counter Increment: Allows users to increase a counter value.
  • Ownership Transfer: Restricts administrative actions to the owner and allows ownership transfer.
  • Event Logging: Emits events for message updates, counter increments, and ownership changes.

Contract Details

Imports

  • None: This contract does not rely on external libraries.

State Variables

  • message: A string storing a message that can be updated.
  • counter: A numeric counter that can be incremented.
  • owner: The address of the contract owner with special privileges.

Constructor

  • Initial Message: The contract is deployed with an initial message.
  • Counter: Initializes at 0.
  • Ownership: The deployer of the contract is set as the owner.

Functions

  • incrementCounter()

    • Increments the counter by 1.
    • Emits a CounterIncremented event.
  • transferOwnership(address newOwner)

    • Allows the current owner to transfer ownership to another address.
    • Ensures the new owner is not the zero address.
    • Emits an OwnershipTransferred event.
  • appendToMessage(string memory additionalMessage)

    • Updates the stored message with new content.
    • Emits a MessageSet event.

Frontend Integration

Technologies Used

  • React.js / Next.js: Frontend development.
  • Ethers.js / Web3.js: Blockchain interaction.
  • Tailwind CSS: Styling and responsiveness.

Features

  • Connects to the deployed contract using Web3.
  • Provides an interactive UI for updating messages, incrementing counters, and transferring ownership.
  • Real-time display of contract state changes.

Author

Paras Aggarwal
parasaggarwal7172@gmail.com

About

This repository contains the project SMART CONTRACT AND FRONTEND , which I developed as part of my coursework at Metacrafters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published