Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

EliasAfara/Solidity-Dapp-Twitter-Clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solidity Dapp Twitter Clone

Github repo size follow on Github follow on Twitter

Decentralised light-twitter clone. Check Demo

Development Steps

  • Development of a CRUD API in Solidity
  • Deployment to Rinkeby
  • Development of a front-end to interact with the smart contracts

Learning Objectives and Outcomes

To learn how to lead an Ethereum project, end-to-end:

  • Solidity development
  • Unit tests
  • Deployment

Specs

  • Any user should be able to read all the tweets
    • All the tweets should be ordered in a chronological order (either of 2 ways)
  • Any user should be able to write tweets
  • A user should be able to update a tweet he wrote
  • A user should be able to delete a tweet he wrote
    • Deleting a tweet should NOT affect the access to the other tweets
    • Deleting a tweet should NOT affect the order of the other tweets
  • Smart contract(s) should be deployed to Ropsten
  • Smart contract(s) should be tested with at least 80% line coverage

Project Requirment/Setup

  1. You need to create a virtual wallet Metamask account and select "Rinkeby Test Network", I recommend reading this article.
  2. To get testnet Ether (ETH) in order to test and troubleshoot our decentralized application, I recommend checking Chainlink and Rinkeby Faucet.
  3. You have to create an account on Alchemy and generate an API key by creating an app. This will allow us to make requests to the Rinkeby Test Network. If you’re not familiar with testnets, check out this guide. I also recommend going over this Alchemy documentation as it explains every step throughly.
  4. After cloning the repo and creating your accounts and generating the API key, now you have to create a .env same as .env.example and fill in your keys.

🐑 Clone locally

Make sure you have installed Git, Node.js (Please install 16.14.0, I recommend using nvm).

Then clone the repo, install dependencies and start the server by running all these commands:

git clone https://github.com/EliasAfara/Solidity-Dapp-Twitter-Clone.git
cd Solidity-Dapp-Twitter-Clone/server
npm i
cd ../client
npm i

Test the Smart Contract

cd server
npx hardhat test

Results in all 4 tests passing:

  Twitter App Contract
    Create Tweet
      ✔ should emit NewTweet event
    Get All Tweets
      ✔ should return the correct number of total tweets (65ms)
    Update Tweet
      ✔ should emit UpdateTweet event
    Delete Tweet
      ✔ should emit delete tweet event


  4 passing (3s)

Deployment

cd server
npx hardhat run scripts/deploy.js --network rinkeby

copy the genereated contract address and paste it in the config

NOTE: You can also run the scripts inside package.json inside the server dir.

Making Your First Transaction

After deploying your smart contract, you can copy the generated contract address and check it out on Rinkeby Etherscan.

- License

MIT License

Copyright (c) 2022 Elias Afara

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.```