https://github.com/romanian-solana-developer-program-c3/greengait
πGreenGait is a Web3-powered rewards platform that transforms your physical movement into digital value. By wearing a smart shoe device, each step you take is securely recorded and converted into blockchain-based tokens, enabling you to earn as you walk β one step at a time.π
https://github.com/romanian-solana-developer-program-c3/greengait
anchor-framework eco-friendly green-energy green-tech health iot rust smart-contracts smart-shoes solana sustainability wearable-devices web3
Last synced: 13 days ago
JSON representation
πGreenGait is a Web3-powered rewards platform that transforms your physical movement into digital value. By wearing a smart shoe device, each step you take is securely recorded and converted into blockchain-based tokens, enabling you to earn as you walk β one step at a time.π
- Host: GitHub
- URL: https://github.com/romanian-solana-developer-program-c3/greengait
- Owner: Romanian-Solana-Developer-Program-C3
- Created: 2025-04-30T16:26:01.000Z (18 days ago)
- Default Branch: main
- Last Pushed: 2025-05-05T15:25:15.000Z (13 days ago)
- Last Synced: 2025-05-05T16:27:32.813Z (13 days ago)
- Topics: anchor-framework, eco-friendly, green-energy, green-tech, health, iot, rust, smart-contracts, smart-shoes, solana, sustainability, wearable-devices, web3
- Language: C++
- Homepage: https://arena.colosseum.org/hackathon/project
- Size: 65.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π GreenGait π
**GreenGait** is a Web3 rewards platform that transforms physical activity into real digital value using the Solana blockchain. With a secure, Wi-Fi-enabled wearable device (ESP32), every step you take is cryptographically signed and submitted to the blockchain β all in real time.
π + β β π° on-chain.---
## Table of Contents π
1. [**Architecture Overview**](#-architecture-overview)
2. [**Features Implemented**](#-features-implemented)
3. [**Security Architecture**](#-security-architecture)
4. [**Project Structure**](#-project-structure)
5. [**Example Flow**](#-example-flow)
6. [**How to Run Locally**](#-how-to-run-locally)
7. [**What's Next?**](#-whats-next)
8. [**Author**](#-author)---
## π Architecture Overview
πΉ **ESP32-WROOM-32D**
A microcontroller that simulates steps via a button. Sends step data via MQTT over TLS using mutual certificate authentication.π **TLS Mutual Authentication**
Secure communication using custom client certificates and a trusted CA, protecting against unauthorized devices.π§ **Rust Backend Validator**
Receives messages via MQTT, validates authenticity (HMAC + timestamp), then logs valid steps on-chain via a Solana smart contract.βοΈ **Solana Anchor Program**
Deployed on Devnet. Uses Program Derived Addresses (PDAs) to store step data per user per day. Tokens are minted automatically every 3 steps.π‘ **EMQX Broker (Google Cloud VPS)**
A hardened MQTT broker with TLS, ACL rules, and certificate-based access control.π₯οΈ **Frontend Interface**
Visualizes your step history and blockchain rewards in a simple dashboard.---
## β Features Implemented
* β **ESP32 device** with WiFi + MQTT + TLS client auth
* β **TLS mutual authentication** via custom certificates
* β **HMAC-SHA256** signature generation on device
* β **JSON payload** with: `steps`, `timestamp`, `nonce`, `signature`
* β **Rust backend**:* MQTT TLS client
* HMAC & timestamp validation
* PDA-based step tracking and token minting
* β **Solana Anchor program** with `log_step` instruction
* β **Solana Devnet** deployment and testing---
## π Security Architecture
* HMAC-SHA256 signed payloads (shared secret)
* Timestamp validation to prevent replay attacks (Β±30s)
* TLS mutual authentication (ESP32 β EMQX β backend)
* EMQX Broker enforces certificate-based access and ACL rules
* Backend runs on a hardened Google Cloud VPS with TLS
* PDA ensures unique, tamper-proof on-chain logs per `(user, day)`---
## π Project Structure
```
GreenGait/
βββ backend/ # Rust backend (MQTT client, validation, blockchain interaction)
βββ solana_program/ # Anchor smart contract + TypeScript tests
βββ solana/ # CLI scripts, account utilities, program deploy
βββ frontend/ # (WIP) UI for displaying step history and rewards
βββ firmware/ # ESP32 Arduino code (WiFi, MQTT, HMAC)
βββ docs/ # Arch-Diagram + PPT Presentation + Logo
βββ README.md # You're here!
```---
## π Example Flow
1. Press the button β ESP32 sends a signed JSON payload
2. EMQX broker securely forwards it to the backend
3. Backend verifies the HMAC + timestamp β logs it on-chain
4. If steps are divisible by 3, a token is minted
5. Frontend displays user stats (WIP)---
## π How to Run Locally
### 1. Flash the ESP32
Upload `ESP32.ino` from `firmware/` using Arduino IDE.
Make sure `certificates.h` contains:* `ca.crt`
* `client.crt`
* `client.key`### 2. Start the Rust Backend
```bash
cd backend
cargo run
```Make sure these files exist in `certs/`:
```
ca.crt
client.crt
client.key
stepmint-validator.json (Solana keypair)
```### 3. Run the Solana Tests
```bash
cd solana_program
anchor test
```---
## π What's Next?
* [ ] π§ PDA optimization
* [ ] π NFT/token design for major milestones
* [ ] π¨ Dashboard UI with wallet connection and real-time stats
* [ ] π ESP32 OTA firmware delivery
* [ ] π‘οΈ Replay prevention & abuse detection
* [ ] π Connection with energy harvesting system
* [ ] π°οΈ GPS Accuracy
* [ ] ποΈ User Database---
## π€ Author
**Robert PanΘa**
MSc Student in Cybersecurity at Technical University of Cluj-Napoca
* π§ [LinkedIn](https://www.linkedin.com/in/robert-panta/)
* π [GitHub](https://github.com/RobCyberLab)---
> π *GreenGait β where every step countsβ¦ on-chain, securely, and sustainably.*