Echofly is a decentralized application (dApp) developed as a social media app for users to make posts, follow and interact with other users.
- Solidity: Smart contract language for Ethereum.
- Hardhat: Development environment for Ethereum.
- IPFS: For decentralized storage of uploaded files.
- Next: Library for managing the entire application.
- Node.js
- npm or yarn
- Hardhat
- A Web3 wallet (e.g., MetaMask)
-
Clone the repository:
git clone https://github.com/chidubemokeke/Social-App_The-Graph_NextJS.git cd Social-App_The-Graph_NextJS
-
Install dependencies for contract and frontend:
cd contract
npm install
cd ../my-dapp
npm install
-
Navigate to
contract
directory to run the local nodecd contract npx hardhat node
-
Copy the Private Key generated on the first account
Account #0
, and then import it into your MetaMask wallet app/browser extension. -
While keeping the original terminal running at all times, open a different terminal deploy the smart contract on local machine(GO):
npx hardhat run scripts/deploy.js --network localhost
-
Copy the Contract Address generated on the terminal, then navigate to the
constants.js
file in themy-dapp
folder: Scroll toCONTRACT_ADDRESS
and change it from0x0E7E70...
to the address generated. -
Update the abi of your contract
- Navigate to
/contract
- then
/artifacts
- then
/contracts
folder to copy the abi file (usually in .json) - Navigate to the
/context
folder in your/my-dapp
directory - Delete the existing abi, and paste the copied abi
- With every update contract code(in .sol), make sure to update your abi after deployment.
- Navigate to
- For your IPFS, generate your
PINATA_API_KEY
andPINATA_SECRET_KEY
- Go to https://pinata.cloud
- Register or login into your account
- Navigate to
API Keys
- Click on
Create New
- Leave the default settings, then click on `Generate API Key.
- Copy your
API KEY
andAPI SECRET
-
Navigate to the
constants.js
file in themy-dapp
directory. -
Scroll to
PINATA KEYS
section of the code and then replace thePINATA_API_KEY
andPINATA_SECRET_KEY
with yours gotten from https://pinata.cloud -
Scroll to
handleNetworkSwitch
and change thenetworkName
fromoptimism-sepolia
tolocalhost
, to use your local machine's network or any othernetwork
of your choice, when using a testnet or mainnet. -
Start the application
frontend
folder and start the React application:cd my-dapp npm run dev
Open http://localhost:3000 with your browser to see the result.
Approve the switch to your localhost network, then connect wallet.
Make sure to reload a minimum of two times after connecting wallet and entering name.
- Copy your smart contract code.
- Navigate to
/contract
then/contracts
to copy thecontract
code. - Head to https://remix.ethereum.org
- Create a new contract and paste your
contract
code. - Click on the
Solidity Compiler
button and enable optimization to999
- Compile your code.
- Click on the
Deploy & run transactions
. - Connect your ethereum address on the network you want to deploy to.
- Select your wallet address on
remix
's deployment page(top left on page). - Select contract you want to deploy, then click on
Deploy
button. - Authorize the deployment transaction fees on MetaMask.
-
Copy the generated Contract Address on your
remix
console(bottom left). -
Open your IDE, then navigate to the
constants.js
file in themy-dapp
folder: Scroll toCONTRACT_ADDRESS
and change it from0x...
to the Contract Address generated. -
Scroll to
handleNetworkSwitch
and change thenetworkName
fromlocalhost
tooptimism_sepolia
, or any othernetwork
of your choice. -
Restart the application
frontend
folder and start the React application:cd my-dapp npm run dev
Open http://localhost:3000 with your browser to see the result.
Approve the switch to network, then connect wallet.
Make sure to reload a minimum of two times after connecting wallet and entering name.