Inspiration

Daima was born out of the idea of leveraging blockchain's transparency and immutability to reward healthy behaviors. Recognizing that everyday physical activity has tangible value, the project was designed to motivate users by transforming their health metrics into digital assets. This approach not only promotes wellness but also opens new avenues for financial benefits like insurance discounts.

What it does

Daima integrates your health and fitness data with blockchain technology to create a self-sustaining rewards ecosystem. Here’s how it works:

Data Integration: The project streams data from Google Fit, including metrics such as steps taken, calories burned, and heart rate, directly onto the blockchain.

Token Rewards: By using Clarity smart contracts on the Stacks blockchain, users earn SIP-010 tokens as rewards for achieving specific health milestones.

Insurance Incentives: The tokens accumulated can qualify users for insurance discounts, turning everyday activity into real-world financial savings.

Secure and Transparent: Every piece of fitness data and token transaction is recorded immutably on the blockchain, ensuring both transparency and security.

How we built it

The solution is comprised of three main components:

  1. Clarity Smart Contract The backbone of Daima is its Clarity smart contract, which manages both the health data and token rewards.

Google Fit Data Management:

stream-data: Captures and stores fitness metrics (timestamp, steps, calories burned, heart rate) securely.

get-data: Retrieves stored data for verification and historical tracking.

SIP-010 Token Management:

mint: Generates new SIP-010 tokens as rewards based on users’ activity.

transfer: Enables the movement of tokens between accounts.

pay-insurance: Automates token transfers directly to an insurance wallet.

Insurance Eligibility Check:

eligible-for-discount: Verifies if a user’s token balance meets the criteria for insurance discounts.

  1. Python Script for Streaming Data An off-chain agent written in Python reads Google Fit data (in CSV format) and streams it to the Clarity contract every 10 seconds.

CSV Data Reading: Processes fitness data including timestamp, steps, calories burned, and heart rate.

Real-Time Simulation: Introduces a 10-second delay between data rows to mimic real-time streaming.

Data Submission: Connects with the Stacks blockchain API to transmit data as transactions.

  1. React Frontend with TypeScript The user interface is built with React and TypeScript, allowing users to interact seamlessly with the blockchain ecosystem.

Wallet Connection: Uses showConnect from @stacks/connect to securely link users’ wallets.

Data Streaming: Enables users to input and stream their fitness data directly.

Token Minting and Balance Check: Facilitates token conversion from accumulated BTC amounts and displays current token balances.

Insurance Discount Eligibility: Provides functionality to check if users qualify for insurance discounts based on their token holdings.

Challenges we ran into

mplementing Daima wasn’t without its hurdles:

Data Integration: Ensuring smooth and secure data transfer from Google Fit to the blockchain.

Real-Time Streaming: Managing the continuous streaming of data while preserving performance and accuracy.

Blockchain Security: Maintaining robust security and transparency in token transactions and data storage.

User Experience: Crafting an intuitive frontend that simplifies the interaction between complex blockchain operations and everyday fitness tracking.

Accomplishments that we're proud of

Innovative Integration: Successfully combining health data with blockchain technology.

Automated Incentives: Developing a system that directly translates physical activity into tangible financial benefits.

Data Transparency: Implementing a secure, immutable record of fitness data and transactions on the Stacks blockchain.

Scalability: Laying the groundwork for future enhancements, including additional metrics and expanded wearable integrations.

What we learned

Through building Daima, the team gained deep insights into:

Blockchain Applications: The practical integration of blockchain in everyday technology.

Data Security: Best practices for safeguarding user data in a decentralized environment.

Real-Time Data Processing: Techniques for effectively streaming and managing continuous data flows.

User-Centric Design: The importance of a seamless, intuitive user experience in technology adoption.

What's next for dAIma

The journey doesn’t stop here. Future plans for Daima include:

Real-Time API Integration: Transitioning from CSV uploads to live data streams directly from Google Fit.

Smart Reward Algorithms: Implementing dynamic reward systems that adapt based on user goals and challenges.

Expanded Insurance Options: Collaborating with insurance providers to offer more personalized, blockchain-based insurance plans.

Enhanced Metrics: Broadening the scope of data collection to include additional health metrics and compatibility with more wearable devices.

Share this project:

Updates