Inspiration

The inspiration for this project came from my desire to motivate myself to reach certain fitness goals, specifically in reaching the minimum amount of daily calories expended. GoalCrusher was made to help anyone who needs further incentives to reach their fitness goals a day at a time .

What it does

Currently, GoalCrusher has only one goal that is able to be achieved: hitting your caloric goal for weight loss. FitBit automatically calculates the amount of calories you must expend in order to lose weight. It reaches this caloric target with the use of BMR and daily activity. FitBit also reports the number of calories you have burned in real time.

  • Users have the option to fund their contract with collateral at the risk of losing it if the goal is not accomplished by the end of the day
  • If the user met and/or passed their caloric target, they'll be allowed to withdraw their collateral, if it exists, and the number of goals achieved will increase by one.
  • At any time the user can check if they have met their caloric goal.
  • Calories-burned counter resets at midnight local time
  • A specific number of goals must be achieved in order to mint the NFT.

How I built it

  • Remix IDE was used to create all the smart contracts in Solidity.
  • A local chainlink node was started with the use of:
    • QuikBook's ethereum end-point, Go, GCC, PostgreSQL, Python3 and Visual Studio Code running Ubuntu.
  • An external adapter for FitBit's API was built using Javascript and NodeJS and bridged to the local chainlink node.

All contracts and NFTs are designed for testnet only.

Challenges I ran into

Setting up the Chainlink node was difficult because of my inexperience with Ubuntu and Linux systems. There were many issues setting up the PostgreSQL database and navitaging PATH variables.

There were also many challenges in feeding data from the external adapter -> Chainlink node -> smart contract due to inexperience with TOML and Chainlink's Any-API.

Furthermore, many additional functionalities had to be removed due to security issues and general lack of knowledge on how to implement them.

Accomplishments that we're proud of

Although there is a lot to be done yet I am extremely proud of everything in this project, especially the fact that I managed to connect off-chain data on-chain using Chainlink's reliable and verifiable software. The accomplishments I'm most proud of are:

  • Successfully running a chainlink local node
  • Successfully building an external adapter that fetched specific off-chain FitBit API data
  • Configuring Chainlink Node job to deliver multiple responses to the requesting contract on-chain
  • Configuring Chainlink's MultiResponse Consumer to accept specific FitBit data from the chainlink node
  • Submitting the project for Hackathon

What I learned

I learned that having a good idea can be real difficult, but executing it is even harder. I got a lot more experience in planning, tracking and measuring progress of the project. I became better at finding resources and resolving multitudes of errors. I got better at writing clean code.

On the technical side, I learned how to work with NodeJS, servers and APIs more. Additionally, I learned how to spin up a local chainlink node, an external adapter and use Chainlink's any API. I obtained a lot more experience in dealing with back-end code and development.

I gained a lot of confidence in myself and learned how to be a better blockchain developer.

What's next for GoalCrusher

The next steps for GoalCrusher is to increase functionality and security. Currently, the only fitness goal available is hitting a mark above your caloric target. Eventually, more features such as

  • distance
  • heart rate
  • calories consumption
  • water intake
  • active minutes

And more will be added in order to increase the variety of goals able to be worked on.

Built With

Share this project:

Updates