A decentralized air quality monitoring system built on Solana with Ephemeral Rollups integration for efficient sensor data management.
Aeroscan is a blockchain-based protocol that enables secure, verifiable storage and management of environmental sensor data. The protocol tracks air quality metrics including PM2.5, PM10 levels, temperature, and humidity readings while leveraging Ephemeral Rollups for cost-effective and high-throughput data processing.
- Real-time Air Quality Monitoring: Track PM2.5, PM10, temperature, and humidity
- Ephemeral Rollups Integration: Efficient data processing with delegation capabilities
- Decentralized Storage: Immutable sensor data records on Solana
- Event Emission: Real-time notifications for sensor reading updates
- Authority-based Access Control: Secure sensor data management
The protocol consists of four main operations:
- Initialize: Create a new sensor reading account for a user
- Update Reading: Submit new sensor data readings
- Delegate: Move sensor data processing to Ephemeral Rollups for efficiency
- Undelegate: Return sensor data from Ephemeral Rollups back to base layer
Each sensor reading contains:
- Authority: The public key of the sensor owner
- PM2.5: Particulate matter 2.5 microns (µg/m³)
- PM10: Particulate matter 10 microns (µg/m³)
- Temperature: Temperature reading (unit depends on implementation)
- Humidity: Relative humidity percentage
- Timestamp: Unix timestamp of the reading
- Node.js (v16 or higher)
- Solana CLI tools
- Anchor framework
- TypeScript
- Clone the repository:
git clone https://github.com/priyanshpatel18/aeroscan-protocol
cd aeroscan-protocol- Install dependencies:
pnpm install- Build the program:
anchor build- Deploy to devnet:
yarn deploy:devnetThe protocol is configured to work with:
- RPC Endpoint: Helius Devnet
- Ephemeral Rollups: MagicBlock Devnet
- Network: Solana Devnet
await program.methods
.initialize(pm25, pm10, temperature, humidity, aqi)
.accountsPartial({
sensorReading: sensor_reading_pda,
user: wallet.publicKey,
systemProgram: SystemProgram.programId,
})
.rpc();await program.methods
.updateReading(authority, pm25, pm10, temperature, humidity, aqi)
.accountsPartial({
sensorReading: sensor_reading_pda,
})
.rpc();await program.methods
.delegate()
.accounts({
payer: wallet.publicKey,
sensorReading: sensor_reading_pda,
})
.rpc();await program.methods
.undelegate()
.accountsPartial({
user: wallet.publicKey,
sensorReading: sensor_reading_pda,
})
.rpc();- Program ID:
aero8wSmn3uAj5g5jYq92Rd2SQv2MtGxu1ZXfysfFHX - Sensor Reading PDA: Derived from
["sensor_reading", user_pubkey]
The protocol emits SensorReadingEvent whenever sensor data is updated, containing:
- PM2.5 and PM10 levels
- Temperature and humidity readings
- Timestamp of the measurement
Run the test suite:
anchor testThe tests cover:
- Account initialization
- Base layer sensor data updates
- Delegation to Ephemeral Rollups
- Ephemeral Rollups sensor data updates
- Undelegation back to base layer
- Environmental Monitoring Networks: Deploy sensors across cities or regions
- Industrial Compliance: Track air quality for regulatory compliance
- Research Projects: Collect verifiable environmental data for studies
- IoT Integration: Connect physical sensors to blockchain infrastructure
- Data Markets: Create marketplaces for verified environmental data
- Cost Efficiency: Reduce transaction costs for frequent sensor updates
- High Throughput: Process multiple readings without base layer congestion
- Flexible Processing: Delegate data to rollups when needed, undelegate when required
- Immutable Records: Tamper-proof environmental data
- Verifiable Data: Cryptographically secured sensor readings
- Decentralized: No single point of failure or control
- Transparent: Public access to environmental data
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
- Sensor readings are protected by authority-based access control
- Only the sensor owner can update their readings
- All transactions are signed and verified on-chain
- Ephemeral Rollups provide additional security layers