Skip to content

marcuspang/reco

Repository files navigation

🏗 Reco

Link to setup Discord bot here.

Video Demo

https://clipchamp.com/watch/QygpejY8qVm

Definitions

Social Objects - refers to any social event / activity, e.g. likes, shares, comments, etc.

Problem

  • content curation systems are centralized
  • social objects are not owned by the user
  • security of data is unknown

Solution

  • decentralized curation system with decentralized AI models, allowing for summaries, sentiment analysis, etc.
  • social objects are owned by the user and encrypted on IPFS
  • plug-and-play bots for social platforms, i.e. Discord and Telegram
  • users can monetize their social objects through token-gated oracles

How it works

Onboarding

  • after adding Reco bot to a social media channel (e.g. Discord), the server admin creates a linked role that comes with the bot
  • this linked role requires Rarimo's Proof of Humanity verification, which redirects the user to our frontend
    • here the user needs to login with discord, login with a wallet so that we can check whether they have done the PoH verification
    • PoH verification is done separately on Rarimo's frontend
  • once the user has done the PoH verification, they gain access to the linked role and can begin interacting with Reco bot
  • further verification is done through API3's ChainAPI, where an oracle is set up for on-chain verification
    • for demo purposes, it is only targetting Discord users in a specific channel

Social Objects

  • Reco bot tracks social objects on social media channels (e.g. messages, likes, shares, etc. on Discord) and uploads them to IPFS (encrypted with Lighthouse)
  • Reco bot then sends the IPFS hash to the smart contract deployed on Flare, which emits an event that the envio's indexer stores in the database
  • This social object is tied to the user, and can be used for social curation, e.g. likes, shares, comments, etc.

Content Curation

  • When requested by the user (or some regular interval), Reco bot generates customised content for the channel / user, based on their past social activity
  • The past social data is passed into FLock's AI model, which does some form of sentiment analysis (like ChatGPT) and generates a response
  • This response is then sent to the user / channel

Plug and Play bots

  • Reco bot can be used on any social media channel, as long as the channel allows some form of 3rd party verification
  • The protocol is meant to be bot-agnostic as well, in the sense that the prompting and training of the AI model can be done by any bot
    • Because of federated learning, the model is trained in isolated containers, meaning that the user's social data is private from uploading to IPFS -> training the model -> response generation

Dashboard of Social Objects

  • Users can view their social objects on Reco's frontend, which is a dashboard of all their social objects generated by them and by Reco itself (think itineraries and recommendations).
  • Users can also view other bots available for usage, and can add them to their server as they wish

Requirements

Before you begin, you need to install the following tools:

Quickstart

To get started with Reco, follow the steps below:

  1. Clone this repo & install dependencies
git clone https://github.com/recommendoor/reco.git
cd reco
pnpm install
  1. Run a local network in the first terminal:
pnpm 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.

  1. On a second terminal, deploy the test contract:
pnpm hardhat: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 pnpm hardhat: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.

  1. Ensure docker is running and then on a third terminal, start-up indexer:
pnpm envio:codegen

and then:

pnpm envio:dev

This will run a codegen for your configured envio indexer, it will install all required packages, handle db-migrations and graphql server, and begin indexing your smart contract events.

Visit the hasura console on: http://localhost:8080. You can see the realtime indexing of data in the "data" tab and use the graphql explorer to build queries.

For more info on writing/updating an indexer visit docs.envio.dev/docs.

  1. On a fourth terminal, start your NextJS app:
pnpm start

Visit your app on: http://localhost:3000. You can interact with your smart contract using the contract component or the example ui in the frontend. You can tweak the app config in packages/nextjs/scaffold.config.ts.

Run smart contract test with pnpm hardhat:test

  • Edit your smart contract YourContract.sol in packages/hardhat/contracts
  • Edit your frontend in packages/nextjs/pages
  • Edit your deployment scripts in packages/hardhat/deploy
  • Edit your envio indexer config.yaml, schema.graphql and EventHandlers.ts in packages/envio-indexer
  1. On a fifth terminal, start the Discord bot
# feel free to use pnpm / yarn here as well
npm run dev

You have to create a Discord app to set up your own bot. You can find the instructions here.

Acknowledgements

Built with love from Scaffold-ETH 2.

Visit the docs to learn how to start building with Scaffold-ETH 2.