CatoffGaming / catoff-reclaim-integration-proposal

Welcome to the Catoff-Reclaim Integration Open Source Project!
https://game.catoff.xyz
15 stars 51 forks source link

feat(service) Add fitbit service for getting the number of steps #61

Open 0xksure opened 1 month ago

0xksure commented 1 month ago

Fitbit Steps Integration for Reclaim Protocol/Catoff

Overview

This Pull Request introduces a new integration for the Reclaim Protocol/Catoff project, focusing on Fitbit step count data. This integration enables the creation of zero-knowledge proofs for users' walking activities, opening up innovative possibilities for fitness-based challenges and wagers on the Catoff platform.

Features

Potential for Generating 100-500 Proofs

This Fitbit integration has strong potential to generate between 100-500 proofs, meeting the bounty requirements:

  1. Large User Base: Fitbit has millions of active users worldwide. Even a small percentage of Catoff users connecting their Fitbit accounts could easily surpass the 100-proof threshold.

  2. Daily Activity: Step counting is a core feature of Fitbit devices, used daily by most users. This frequent activity provides numerous opportunities for proof generation.

  3. Engaging Use Cases: The proposed challenges (Daily Step Challenge and Weekly Fitness Competition) are designed to encourage regular participation, potentially generating multiple proofs per user per week.

  4. Scalability: The integration can handle multiple proof generations per day per user (e.g., morning and evening step counts), further increasing the proof count.

  5. Social Factor: Fitness challenges often have a social component, which could lead to viral adoption within friend groups or communities using Catoff.

  6. Health Trend: With increasing focus on health and wellness, a Fitbit integration taps into a growing market, likely attracting more users over time.

  7. Versatility: While initially focused on step counts, the integration can be easily expanded to include other Fitbit metrics, potentially increasing user engagement and proof generation.

  8. Automated Proof Generation: The integration can be set up to automatically generate proofs at set intervals or when certain milestones are reached, ensuring consistent proof creation without requiring constant user interaction.

Given these factors, we expect this integration to not only meet the minimum 100-proof requirement but also have the potential to scale well beyond that, possibly reaching the upper limit of 500 proofs as adoption grows.

Fitbit Steps Integration for Reclaim Protocol/Catoff

Use Cases

  1. Daily Step Challenge: Users can create or participate in challenges to reach a certain number of steps per day, with wagers based on achieving the goal.
  2. Weekly Fitness Competition: Groups can compete for the highest total step count over a week, with automated payouts to the winners.

Implementation Details

Code Highlights

fitbitStepsService.js


const axios = require('axios')
const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse')

exports.processFitbitStepsData = async (proof, providerName) => {
  const fitbitUserId = JSON.parse(proof[0].claimData.context).extractedParameters.userId
  const lastUpdateTimeStamp = proof[0].claimData.timestampS
  const stepCount = await getUserSteps(fitbitUserId)

  return new ReclaimServiceResponse(
    providerName,
    lastUpdateTimeStamp,
    fitbitUserId,
    stepCount,
    proof[0]
  )
}

const getUserSteps = async (userId) => {
  // ... (implementation details)
}