{"id":39525725,"url":"https://github.com/machinefi/google-fit-demo","last_synced_at":"2026-01-18T06:23:31.768Z","repository":{"id":190078240,"uuid":"653731664","full_name":"machinefi/google-fit-demo","owner":"machinefi","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-22T04:03:08.000Z","size":7708,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-08-23T06:04:58.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/machinefi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-14T16:00:22.000Z","updated_at":"2023-08-23T06:05:00.106Z","dependencies_parsed_at":"2023-08-23T06:15:05.743Z","dependency_job_id":null,"html_url":"https://github.com/machinefi/google-fit-demo","commit_stats":null,"previous_names":["machinefi/google-fit-demo"],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/machinefi/google-fit-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinefi%2Fgoogle-fit-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinefi%2Fgoogle-fit-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinefi%2Fgoogle-fit-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinefi%2Fgoogle-fit-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/machinefi","download_url":"https://codeload.github.com/machinefi/google-fit-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinefi%2Fgoogle-fit-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28531995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-18T06:23:31.109Z","updated_at":"2026-01-18T06:23:31.759Z","avatar_url":"https://github.com/machinefi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Fit integration with W3bstream\n\n_An example of tokenizing training session proofs via [W3bstream protocol](https://w3bstream.com) and [Google Fit](https://www.google.com/fit/)_\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n  - [NFT URI](#nft-uri)\n- [Project Setup and Execution Instructions](#project-setup-and-execution-instructions)\n  - [Step 1: Repository Cloning and Dependency Installation](#step-1-repository-cloning-and-dependency-installation)\n  - [Step 2: Blockchain Environment Preparation](#step-2-blockchain-environment-preparation)\n  - [Step 3: Applet Modification](#step-3-applet-modification)\n  - [Step 4: Blockchain Environment Adjustment](#step-4-blockchain-environment-adjustment)\n  - [Step 5: Adapter Configuration](#step-5-adapter-configuration)\n\n## Prerequisites\n\nBefore you begin, there are several prerequisites that must be met:\n\n### Google OAuth Client\n\nTo get access to the Fitness REST API we will need to create an OAuth Client. Follow [these steps](https://developers.google.com/fit/rest/v1/get-started) to obtain GOOGLE_ID (Client ID) and GOOGLE_SECRET (Client secret)\n\n### NFT URI\n\n\u003e This step is optional, you can use the provided NFTs URIs, but if you want to use your own, please follow the instructions below.\n\n\u003e You will need to upload one image and one metadata JSON file for the ERC721 Device SBT.\n\u003e For the ERC1155 Rewards - one image along with its corresponding metadata JSON file to represent the Rewards for completed training sessions.\n\nUpload your NFT images and the corresponding metadata to a file storage of your choice or use a script in `nft` directory that will upload files to [Arweave](https://www.arweave.org) via [Bundlr](https://bundlr.network):\n\n- Navigate to `nft` directory and run `npm i`\n- In `assets` subdir you can find images for SBT and Rewards NFTs. _You can update images with your own, but don't forget to update config file in `src/config`_\n- Create `.env` file and add your `PRIVATE_KEY` _(The account will be used to pay Bundlr fees with testnet tokens, please make sure to top up the corresponding account with some Matic tokens, [link to faucet](https://mumbaifaucet.com))_\n- Run `npm run upload`\n- You'll find NFT URIs in `nft/uploads.json` (you'll need them at [Step 2](#step-2-blockchain-environment-preparation))\n- _If funding while uploading fails, you can manually run fund script first `npm run fund`_\n\n## Project Setup and Execution Instructions\n\nFollow the steps below to set up and run the project.\n\n### Step 1: Repository Cloning and Dependency Installation\n\n- Begin by clicking \"use this template\" which houses three directories: `adapter`, `applet` and `blockchain`.\n- Install the necessary dependencies by running `npm i`.\n\n### Step 2: Blockchain Environment Preparation\n\n- In the `blockchain` directory, create a `.env` file. Populate this file with the contents of `.env.template`.\n- Provide your `PRIVATE_KEY` that will be responsible for contract deployment and access control tasks.\n- Update the `SBT_URI` and `REWARDS_URI` variables in the `.env` file as per your setup (see [NFT URI](#nft-uri)).\n- _Opitional: update contract names `SBT_CONTRACT_NAME` and `REWARDS_CONTRACT_NAME`_\n- The `OPERATOR_ADDRESS` will be acquired in the subsequent step.\n- Compile the contracts and generate contract types by running `npm run compile`.\n- Ensure everything is working by running `npm run test`.\n- Deploy your contracts by executing `npm run deploy:testnet`.\n\n### Step 3: Applet Modification\n\n- In the `applet/wsproject.json` file, change the project name from \"sleep_and_earn\" to your preferred name.\n- Compile the AssemblyScript code by navigating to the `applet` directory and running `npm run asbuild`.\n- Import the modified project into the W3bstream studio. Use `applet/wsproject.json` as the `Project file` and `applet/build/release.wasm` as the `Wasm file`.\n- Send a test message in Log.\n- Boost the operator address with Testnet IOTX token. The operator address can be found in Settings. An estimated 5 IOTX should suffice.\n\n### Step 4: Blockchain Environment Adjustment\n\n- Return to the `blockchain` directory and update the `OPERATOR_ADDRESS` in your `.env` file.\n- Run `npx hardhat grant-sbt-minter --network testnet` to assign the SBT minter role to the W3bstream operator.\n- Run `npx hardhat grant-rewards-minter --network testnet` to assign the Rewards NFT minter role to the W3bstream operator.\n\n### Step 5: Adapter Configuration\n\n- Create a new file named `.env.local` and populate it with the variables from `.env.template`.\n- Navigate to Account Settings in the studio interface to create an API key with `Publisher and Event` read and write persmisisons and update `API_TOKEN`.\n- `NEXTAUTH_SECRET` can be aquired in [Vercel secret generator](https://generate-secret.vercel.app/32)\n- Find the `HTTP_ROUTE` under Events.\n- In Google Console add new Authorized Redirect Url: `http://localhost:3000/api/auth/callback/google`\n- Start the client by running `npm run dev` and navigate to localhost:3000 in your web browser.\n- Follow the on-screen instructions to register your device and claim your SBT.\n- Sync the Google Fit data and then recheck the studio db and proceed to claim your rewards.\n- Import the NFTs into Metamask.\n\nCongratulations, you have successfully set up and run your project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachinefi%2Fgoogle-fit-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachinefi%2Fgoogle-fit-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachinefi%2Fgoogle-fit-demo/lists"}