Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

0xksure
Copy link

@0xksure 0xksure commented Aug 6, 2024

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

  • Integrates Fitbit step count data with Reclaim Protocol
  • Securely retrieves step count using Fitbit's API
  • Generates between 100 to 500 proofs, meeting the bounty requirements
  • Fully open-source implementation

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

  • Created fitbitStepsService.js to handle Fitbit data processing
  • Updated reclaimService.js to include the new Fitbit integration
  • Modified constants.js to add Fitbit-specific constants
  • Implemented secure token management using environment variables

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant