Welcome to the Utility-Drip-Contracts project! This guide will help you contribute effectively, whether you're working on hardware (C++/Arduino) or smart contracts (Soroban/Rust).
Utility-Drip-Contracts is a utility billing system built on Stellar that allows:
- Individual meter billing and management
- Group billing for property managers
- Real-time balance monitoring
- Automated payment processing
Hardware components handle the physical meter readings and communicate with the blockchain.
Smart contracts handle billing logic, payment processing, and account management.
Required Tools:
- Arduino IDE 2.0+ or PlatformIO
- C++17 compatible compiler
- ESP32 or Arduino-compatible hardware
- Stellar SDK for embedded systems (if available)
Recommended Setup:
# For PlatformIO users
pio project init --board esp32dev
pio lib install "Stellar SDK"Meter Reading Specifications:
- Sample rate: Minimum 1 reading per second
- Accuracy: ±1% for power measurements
- Data format: JSON over MQTT/HTTP
- Power consumption: < 100mA during operation
Communication Protocol:
{
"meter_id": 12345,
"timestamp": 1640995200,
"reading": 1250,
"unit": "watt_hours",
"signature": "0x..."
}C++ Guidelines:
- Use
camelCasefor variables - Use
PascalCasefor classes - Use
UPPER_SNAKE_CASEfor constants - Include comprehensive error handling
- Memory management: prefer RAII patterns
Example Structure:
class UtilityMeter {
private:
uint32_t meterId;
float currentReading;
StellarClient* stellarClient;
public:
UtilityMeter(uint32_t id, StellarClient* client);
bool takeReading();
bool submitToBlockchain();
float getCurrentReading() const;
};Unit Testing:
- Use ArduinoUnit or GoogleTest framework
- Test meter accuracy with known loads
- Validate communication protocols
- Test error recovery mechanisms
Integration Testing:
- Test against testnet blockchain
- Validate contract interactions
- Test network connectivity issues
- Power consumption validation
Pre-deployment Checklist:
- Meter calibration completed
- Network connectivity verified
- Testnet transactions successful
- Power consumption within limits
- Error handling tested
- Firmware version documented
Required Tools:
- Rust 1.70+
- Soroban CLI
- Stellar Testnet access
Setup:
# Install Soroban CLI
cargo install soroban-cli
# Build contracts
make build
# Run tests
make testGas Optimization:
- Minimize storage operations
- Use efficient data structures
- Batch operations when possible
- Consider gas costs in design
Security Guidelines:
- Validate all inputs
- Use proper access controls
- Implement reentrancy protection
- Audit critical functions
Test Coverage:
- Unit tests for all functions
- Integration tests for workflows
- Edge case testing
- Gas usage analysis
git clone https://github.com/your-username/Utility-Drip-Contracts.git
cd Utility-Drip-Contractsgit checkout -b feature/hardware-meter-optimizationFor Hardware Changes:
- Modify C++/Arduino code in
hardware/directory - Update documentation
- Add tests
- Verify against testnet
For Contract Changes:
- Modify Rust code in
contracts/directory - Update tests
- Run gas analysis
- Document changes
# Hardware tests
cd hardware && pio test
# Contract tests
cd contracts && cargo test
# Integration tests
make integration-test- Update README.md if needed
- Add inline code comments
- Update API documentation
- Include hardware specifications
- Create descriptive PR title
- Describe changes in detail
- Include test results
- Tag relevant reviewers
Hardware PRs:
hardware: For hardware-related changesarduino: For Arduino-specific codeembedded: For embedded systems work
Contract PRs:
contracts: For smart contract changessoroban: For Soroban-specific featuresbackend: For backend logic
General:
bugfix: For bug fixesfeature: For new featuresdocumentation: For documentation updatestesting: For test improvements
Hardware Bugs: Include:
- Hardware model and firmware version
- Environmental conditions
- Error logs
- Reproduction steps
- Expected vs actual behavior
Contract Bugs: Include:
- Contract version
- Transaction hash
- Input parameters
- Error message
- Expected vs actual behavior
Hardware Features:
- Describe the hardware capability
- Explain the user benefit
- Consider power/processing constraints
- Include implementation suggestions
Contract Features:
- Describe the functionality
- Explain the use case
- Consider gas implications
- Include API design suggestions
- Be respectful and inclusive
- Provide constructive feedback
- Help others learn
- Follow the code of conduct
- Focus on what's best for the community
- Discord: Utility-Drip Community
- GitHub Issues: For bug reports and feature requests
- Documentation: Check the
/docsdirectory - Examples: See
/examplesdirectory
By contributing, you agree that your contributions will be licensed under the same license as the project.
Thank you for contributing to Utility-Drip-Contracts! 🎉