A decentralized social media platform built with Ethereum smart contracts, React, and Scaffold-ETH-2. This platform allows users to register, create posts, like posts, and add comments, all while leveraging the power of blockchain technology for security and transparency.
- Introduction
- Features
- Tech Stack
- Prerequisites
- Getting Started
- Usage
- Smart Contracts
- Contributing
- License
This project is a simple decentralized social media application built on sepolia testnet where users can register, create posts, like posts, and comment on posts. All actions are recorded on the blockchain, ensuring transparency and security.
- User Registration
- Create Posts
- Like Posts
- Add Comments
- View All Posts
- Frontend: React, Tailwind CSS
- Blockchain: Ethereum, Hardhat, Ethers.js
- Other Libraries: SweetAlert2, Wagmi
Clone the repository:
git clone https://github.com/fourWayz/sub-scaff.git
cd sub-scaffRun a local network in the first terminal:
yarn chain
This command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in hardhat.config.ts.
On a second terminal, deploy the test contract:
yarn deploy
This command deploys a test smart contract to the local network. The contract is located in packages/hardhat/contracts and can be modified to suit your needs. The yarn deploy command uses the deploy script located in packages/hardhat/deploy to deploy the contract to the network. You can also customize the deploy script.
On a third terminal, start your NextJS app:
yarn start
Visit your app on: http://localhost:3000. You can interact with your smart contract using the Debug Contracts page. You can tweak the app config in packages/nextjs/scaffold.config.ts.
-
Register a User:
Enter a username and click "Register". Your account will be registered on the blockchain.
-
Create a Post:
Once registered, you can create a post by entering the content and clicking "Create Post".
-
Like a Post:
Click the "Like" button on any post to like it.
-
Add a Comment:
Enter a comment in the input field below a post and click "Comment".
The smart contracts are located in the contracts directory. The main contract is Social.sol, which includes functions for registering users, creating posts, liking posts, and adding comments.
The deployment script is located in the scripts directory. Use Hardhat to compile and deploy the contracts to a local blockchain or any Ethereum network.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or new features.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.