Git Product home page Git Product logo

reputation-service's Introduction

Interep reputation service

Interep back-end and front-end.

GitHub Workflow Status Coveralls DeepScan grade Linter eslint Code style prettier Repository top language

Please, visit our web app or our documentation website for more details.


Code overview

This repository contains the frontend and backend code of the Interep application.

The backend code consists mainly of APIs, controllers and core functions. Next.js maps the application's page and api routes to files in the src/pages directory. Each API is associated with a handler/controller in the src/controllers directory, which checks that the request parameters are correct. If these checks are passed and the request needs more complex logic, the core functions are used, otherwise the db methods are called directly.

The frontend consists of the pages defined in the src/pages directory. These pages are React components that in turn use the shared components in the components directory. The style of the Web application is defined in the src/styles directory, while src/context and src/hooks contain React contexts and hooks respectively.

The services in the src/services folder usually contain external services APIs, while the src/tasks folder contains tasks that run externally to Next.js. Finally, the src/config.ts file contains the environment variables and data about the Ethereum network and contracts.

The code is usually organized in modules (e.g. src/core/groups), where each function corresponds to a file with the same name, and an index.ts file exports all the functions of the module. Each module also contains an index.test.ts file where Jest tests are defined for each function in the module. Test files follow a standard structure for each module.

Install

Clone this repository and install the dependencies:

git clone https://github.com/interep-project/reputation-service.git
cd reputation-service
yarn

Usage

Copy the .env.example file and rename it .env.

All environment variables need to be provided. The format for the MongoDB URI is described here.

Running tests

yarn test

Seeding

To seed the db you can run:

yarn db:seed-zero-hashes # required

If you want to reset the db you can run:

yarn db:reset # it will insert the zero hashes

Running Interep (development)

yarn dev

The pages auto-update as you edit files.

To test all the features, you will need to deploy the Interep contracts in a local network.

Running Interep (production)

NODE_ENV === 'production'

Build

yarn build

Start the server

yarn start

reputation-service's People

Contributors

cedoor avatar glamperd avatar neilhacker avatar njofce avatar ra-phael avatar sripwoud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

reputation-service's Issues

Groups for POAP token holders

  • Create groups for specific POAP tokens, e.g. ETH2 stakers, or Devcon IV attendees.
  • UI should connect to web3 provider, confirm POAP is held for the account, then allow the account to join.

Goal 5: EOD Mon, Feb 28

Primary

  • R1
  • Revise POAP flow
  • Revise Social Network flow
  • Tag Cedoor on R1 (Revision 1)
  • Review Cedoor's feedback
  • R2
  • Revise POAP flow
  • Revise Social Network flow
  • Tag Cedoor on R2 (Revision 2)

Secondary
These task may be put on hold in order to meet the March 18th deadline. We could "release them as additional features" if we need to give ourselves that option

  • Complete Phone flow
  • Complete email flow
  • Tag Cedoor on phone/email flows

Ongoing

  • Text updates
  • Value Prop convo in Notion.

Add ID source: curated on-chain groups

  • The group will be maintained on-chain in a smart contract
  • Additions/modifications to group membership would be conditionally permitted by, for example, a DAO multisig.
  • Group membership queries should be accessible via the APIs to client apps. It should be transparent to the client app that the data is on-chain.

Taking user addresses

To associate with accounts or other data

Ask to connect to wallet

Get a signature from their wallet to ensure they control the address

Create Merkle tree structure

  • Define a data structure for storage in mongodb.
  • Code to initialise above
  • Code to Insert nodes
  • Code to retrieve paths
  • API to get groups
  • API to retrieve paths
  • Save root hashes in the contract

Feature: support goerli test network

Goerli will be the only surviving test network after the merge, with kovan and rinkeby slated to see EOL by EOY.

What would it take to get a deployment on Goerli?

Thanks!

Github integration

  • Create more user-friendly reputation levels
  • Draw up Github reputation criteria
  • Update next-auth configuration
  • Create new Github db entities
  • Create Github service to get reputation parameters
  • Create Github Reputation Badge contract
  • Make InterRep functions provider-agnostic
  • Add Github auth on frontend
  • Final tests

Deployment: Secure server

Legitimacy of these badge relies on the security of the server, so we should make sure the deployed version is properly secured. firewalls, monitoring, etc.

contract management keys offline

Filter users before reaching botometer API

Start to build our own db, starting with users who are

  • obviously a bot: has no profile picture, no followers, no or few posts
  • obviously not a bot: curated list of people we know from crypto, and who they follow (1 degree out)

Only send the rest to botometer. Use botometer as one info source.

Want to give our own score, to which botometer is an input, not the only source of data.
API - what do we return for both? A score, a boolean? ("Verified: true")

Goal 7: EOD Mon, March 14th

Primary

  • Landing page
  • Review outline
  • Chunk content by "big idea"
  • refine layout
  • source illustrations
  • refine copy
  • App
  • Requested updates

Figure out deployment

MongoDB is running on: Atlas
Have to whitelist IPs

Vercel - nextJS

Research: What do we need to anchor on chain?

  • Manage a smart contract
  • Sidechain like Matic/Polygon, or L2, Optimism?
  • Or our own merkle tree served from our server?

Might be better to run our own VPS to run these services on same box.

Goal 1: Update documentation

  • Update documentation structure
  • Add guide: Using onchain groups
  • Update subgraph section
  • Add guide: Creating Semaphore proofs
  • Add section: Quick setup (Reputation NFTs)
  • Highlight differences between groups

- Estimated time (days): 3
- Actual time(days):

Goal 6: EOD Mon, March 7th

Primary

  • R3 (if necessary)
  • Revise POAP flow
  • Revise Social Network flow
  • Tag Cedoor on R3 (Revision 3)
  • Review Cedoor's feedback
  • Brand
  • Ask for list of requested lockups
  • Create icon
  • Organize logo assets for export
  • Create logo asset that incudes value prop
  • Source or create illustrations
  • Copy
  • Refine text when flows are complete
  • Add any remaining tooltips, error messages, etc

Secondary
These task may be put on hold in order to meet the March 18th deadline. We could "release them as additional features" if we need to give ourselves that option

  • Complete Phone flow
  • Complete email flow
  • Tag Cedoor on phone/email flows

Ongoing

  • Text updates
  • Value Prop convo in Notion.

Allow users to leave groups

InterRep should allow users to leave groups and then to remove their id commitment.

  • Telegram groups
  • POAP groups
  • OAuth groups

Reddit integration

  • Draw up Reddit reputation criteria
  • Update next-auth configuration
  • Wrap Reddit APIs in a function to get reputation parameters
  • Create Reddit Reputation Badge contract
  • Add Reddit auth on frontend
  • Final tests

Name change to interep

Change the project name from interrep to interep as part of redesign and logo adoption

  • Switch web site to interep.link
  • Change github repo name(s)
  • Change telegram group name
  • Change subgraph name & links
  • Change occurrences in code and documentation

Replace `bnc-onboard` with `web3-react`

Web3-react is a minimized React framework for building modern Ethereum DApps. It can be used for managing wallets. UI will be custom and in line with InterRep design.

Improve UX for minting

  • "mint button" should become disabled after clicking on it
  • There should be some indication that minting is in progress

Goal 3: Enhancements & minor issues

  • #87
  • #90
  • Update Interep subgraph
  • Update docs configuration files
  • Add check for tree depth on contract functions to create/add groups
  • Update Merkle proof parameter names
  • Integrate Interep subgraph in @interep/api package for onchain groups
  • Create new Interep @interep/proof package
  • Update js monorepo configuration files
  • Disable feature for leaving groups
  • Add not_sufficient group for staging & dev envs only
  • New APIs
  • #109
  • #106
  • Define right interval for updating offchain roots on contracts
  • Update reputation criteria
  • Production deploy

- Estimated time (days): 3
- Actual time (days):

Token expiration

Should we be opinionated about token expiration?
If instead of an expiration date we add to a token its issuance date and write that on-chain, we could leave it to the consumer apps (like faucets) to decide if they accept only addresses with tokens issued in the last year, or 6 months, or 3 years...

Integrate Semaphore V2

  • Integrate SemaphoreGroups.sol
  • Integrate SemaphoreCore.sol
  • Remove OpenZeppelin proxies
  • Update tree depth to 20
  • Integrate new zk-kit libs

Ensure Web2 accounts can only be linked to 1 Web3 address at a time

The server is trying to store as little user data as possible, but it must ensure that a Web2 account is only ever linked to one Web3 address at a time, otherwise it defeats the anti-sybil purpose.

Considerations: In case the db is leaked, don't want a record of exactly which Web2 accounts are associated with particular on-chain addresses.

However, when a user links a Web2 account, must have a quick db check to ensure it is not already linked to an address on-chain. Storing a boolean for that account isLinkedToAddress might suffice, but now this data lives in multiple places and would need to be updated to be consistent with on-chain records (expiry periods, revocations, etc.).

Need to think through best way to do this.

Write a spec, roadmap

Spec docs can live on contracts github repo wiki, announcements published in medium post. Need to explain what we did and why, and what's on the roadmap, before publicizing.

  • why we did transferrable tokens, what apps can do if they want non-transferrable
  • how we imagine this might be used
  • what L2 we chose, why, what we can do in future
  • Our human-ness criteria: Why twitter botometer, what we added, what we'll do for Github
  • Future ideas: phone number, email, github
  • Privacy ideas. How we've encrypted on server. How one could use semaphore
  • Why we didn't do keybase style with public attestation on twitter

Create InterRep Telegram bot

  • Create Telegram Bot (@InterRepBot)
  • Create interrep/telegram-bot project
  • Create help command
  • Create join command and 'join flow'
  • Add user hash entry on MongoDB
  • Set up Mongoose
  • Create leave command
  • Refactoring & tests
  • Create README usage section
  • Create @interrep/telegram-bot npm package

#56

Update documentation website

  • Introduction
  • Reputation criteria
  • Tutorials - API integration
  • API
  • Tech overview - Introduction
  • Tech overview - Reputation badges

Goal 2: Update UI & rebranding

  • #98
  • #102
  • Set new header image (Github)
  • Set new icon (Github, Discord, web app)
  • Update documentation theme (colors & font)
  • General review

- Estimated time (days): 10
- Actual time (days):

Name the service

Name brainstorm:

Reputable
NoSybil
Chain auth
Verisky
Verif
RepCheck
RefCheck
CheckSome
InterRep
InterAuth
Inter Verify
Cross Verify

Front-end improvements

  • Create Material UI components
  • Add theme colors
  • Add a link to the project
  • Split big components
  • Create abstraction for calls to API and error handling
  • New Twitter reputation service page
  • Better organize React components
  • Add Etherscan contract links
  • Create new UX
  • Handle web3 React context
  • Add minted token references

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.