Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6053c7d
MESHNET Phase 2: Complete implementation with offline mining, autonom…
Jul 20, 2025
3c6633d
feat: Add deploy_testnet.py and update existing files for MESHNET Pha…
Jul 20, 2025
5f1c722
Auto-polished code and updated README via Colab
Jul 20, 2025
354578d
Add comprehensive event listener framework for Eliza agent
Jul 20, 2025
f2dcd67
Add action handler stubs for Eliza event listeners
Jul 20, 2025
dd71eb2
Refactor XMRT and MeshMiner for upgradeability, add DAO contract, and…
Jul 21, 2025
3c3941b
docs: Add agents.md and update README to reference it
Jul 22, 2025
be957db
revert: Revert incorrect agents.md and README.md changes in phase-2-d…
Jul 22, 2025
da781b8
feat: Add enhanced Eliza daemon - agents/eliza-daemon/eliza_daemon.py
DevGruGold Jul 22, 2025
1217036
feat: Add enhanced Eliza daemon - agents/eliza-daemon/config.json.tem…
DevGruGold Jul 22, 2025
e4633c9
feat: Add enhanced Eliza daemon - agents/eliza-daemon/README.md
DevGruGold Jul 22, 2025
614c99b
feat: Add enhanced Eliza daemon - agents/eliza-daemon/Dockerfile
DevGruGold Jul 22, 2025
2002218
feat: Add enhanced Eliza daemon - agents/eliza-daemon/agent/langchain…
DevGruGold Jul 22, 2025
13d5549
feat: Add enhanced Eliza daemon - agents/eliza-daemon/agent/__init__.py
DevGruGold Jul 22, 2025
a5b8ea5
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/__init__.py
DevGruGold Jul 22, 2025
8c7e7c2
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/governanc…
DevGruGold Jul 22, 2025
38f855a
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/handle_re…
DevGruGold Jul 22, 2025
07080f8
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/monitor_m…
DevGruGold Jul 22, 2025
b9c53b8
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/monitor_t…
DevGruGold Jul 22, 2025
37c0494
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/notify_di…
DevGruGold Jul 22, 2025
e110f6a
feat: Add enhanced Eliza daemon - agents/eliza-daemon/tasks/meshnet_c…
DevGruGold Jul 22, 2025
d7e4ff1
feat: Add enhanced Eliza daemon - agents/eliza-daemon/config.meshnet.…
DevGruGold Jul 22, 2025
6427234
feat: Add enhanced Eliza daemon - agents/eliza-daemon/enhanced_daemon.py
DevGruGold Jul 22, 2025
ce0cd42
feat: Add enhanced Eliza daemon - agents/eliza-daemon/DEPLOYMENT.md
DevGruGold Jul 22, 2025
36003de
feat: Add enhanced Eliza daemon - agents/eliza-daemon/requirements.txt
DevGruGold Jul 22, 2025
4e9f7b4
feat: Add enhanced Eliza daemon - agents/eliza-daemon/docker-compose.yml
DevGruGold Jul 22, 2025
d341834
feat: Add enhanced Eliza daemon - agents/eliza-daemon/monitoring/prom…
DevGruGold Jul 22, 2025
f46d72e
docs: Add comprehensive Eliza daemon integration assessment
DevGruGold Jul 22, 2025
a1fdab9
Add MeshMiner.sol - Core mining operations contract with proof valida…
DevGruGold Jul 22, 2025
03b2ad3
Add Oracle.sol - Decentralized oracle for off-chain data validation
DevGruGold Jul 22, 2025
ea9b5fd
Add Treasury.sol - Multi-signature treasury management with role-base…
DevGruGold Jul 22, 2025
ee90eff
Add Governance.sol - Advanced governance with timelock and voting power
DevGruGold Jul 22, 2025
bb57cc8
Add ReputationSystem.sol - Miner reputation and trust scoring system
DevGruGold Jul 22, 2025
4fc5233
Add ProofVerifier.sol - Cryptographic proof validation for mining
DevGruGold Jul 22, 2025
e110f28
Add MeshNetDeployer.sol - Comprehensive deployment contract for all M…
DevGruGold Jul 22, 2025
556cb24
Add complete deployment script for MESHNET ecosystem with proper role…
DevGruGold Jul 22, 2025
1de7963
Moved MeshMiner.sol to contracts/ and removed empty contracts/mesh/ d…
DevGruGold Jul 23, 2025
616ea46
Updated README.md with instructions for future agents
DevGruGold Jul 23, 2025
39dfe33
Updated README.md with accurate smart contract list
DevGruGold Jul 23, 2025
88379ae
Integrate SupportXMR API for real mining data
DevGruGold Jul 25, 2025
1085c61
Merge branch 'main' into phase-2-deploy
DevGruGold Nov 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Ethereum Network Configuration
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID
PRIVATE_KEY=your_private_key_here

# Etherscan API Key for contract verification
ETHERSCAN_API_KEY=your_etherscan_api_key_here

# Contract Addresses (will be populated after deployment)
XMRT_ADDRESS=
MESH_MINER_ADDRESS=
DAO_ADDRESS=

343 changes: 313 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,328 @@
# MESHNET: XMRT-Meshtastic Full-Stack Ecosystem
# MESHNET Phase 2 - Offline Mesh Mining with Autonomous DAO Operations

## Overview
MESHNET is a monorepo integrating Meshtastic mesh networking with the XMRT ecosystem for resilient, off-grid, agent-driven applications. Built for full-stack functionality: frontend UIs, backend bridges/agents, and core mesh logic.

### Structure
- **frontend/**: Web dashboards (from xmrt-meshtastic-web).
- **backend/**: Bridges and agents (from xmrt-bridge, xmrt-agents).
- **mesh/**: Meshtastic core (Python/Rust integrations).
- **utils/**: Shared tools/scripts.
- **docs/**: Guides and API refs.
MESHNET Phase 2 introduces offline-capable mesh mining with autonomous DAO operations powered by Eliza AI. This implementation enables miners to operate in offline environments while maintaining decentralized reward distribution through smart contracts deployed on Sepolia testnet.

### Setup
1. Clone: `git clone https://github.com/DevGruGold/MESHNET.git`
2. Install: `npm install` (for Node) and `pip install -r requirements.txt` (for Python).
3. Run: `npm start` for frontend, or `python backend/bridge.py` for bridging.
## Architecture

### Usage
- Simulate: Run integration script with 'simulate' port.
- Live: Connect Meshtastic hardware and bridge to XMRT API.
- Extend: Add agents for AI routing or trust scoring.
### Core Components

### Contributing
Fork, PR, or collaborate—let's mesh the world! 🚀
1. **Smart Contracts**
- `DAO.sol`: Manages decentralized autonomous organization proposals and voting.
- `Governance.sol`: Handles governance-related functions and roles.
- `MeshMiner.sol`: Manages rig registration, proof submission, and reward distribution.
- `MeshNetDeployer.sol`: Utility contract for deploying other MeshNet contracts.
- `Oracle.sol`: Provides external data feeds to smart contracts.
- `ProofVerifier.sol`: Verifies cryptographic proofs submitted by miners.
- `ReputationSystem.sol`: Manages and tracks reputation scores within the network.
- `Treasury.sol`: Securely holds and manages project funds.
- `XMRT.sol`: Extended ERC20 token with DAO functionality and mesh reward integration.

License: MIT (or your choice).
2. **Autonomous Agents**
- **Eliza**: Cognitive creator with CEO_AI_ROLE for autonomous proposal creation
- **Langflow**: Executor with AUDIT_AI_ROLE for proposal validation and execution

## Next Phase Enhancements
- **Docker Support:** Run with `docker compose up` for full-stack deployment.
- **CI/CD:** GitHub Actions auto-tests on push.
- **Diagrams:** (Add your architecture diagram here, e.g., via draw.io).
3. **Oracle System**
- **Validator Node**: Processes offline mining data and submits proofs to blockchain
- **Scoreboard Ingestion**: Parses and validates mining session data

4. **Mining Infrastructure**
- **Termux Integration**: Modified XMRig for offline-capable mining
- **Offline Logging**: Local storage of mining sessions for later synchronization

## Features

### Offline Mining Capability
- Miners can operate without internet connectivity
- Local hash count logging to `/sdcard/MESHNET/scoreboard.json`
- Automatic synchronization upon reconnection
- Rig ID-based identity management

### Autonomous DAO Operations
- Eliza AI creates reward proposals based on hash-weighted distribution
- Configurable proposal intervals and minimum proof thresholds
- Langflow validation and execution of approved proposals
- Transparent on-chain governance

### Decentralized Reward System
- Hash-based proportional reward calculation
- Cryptographic proof verification
- Real-time reward tracking and distribution
- Claimable reward interface

## Quick Start

### Prerequisites
- Node.js 16+ and npm
- Hardhat development environment
- Sepolia testnet ETH (0.05 ETH minimum)
- Termux (for Android mining)

### Installation

```bash
# Clone the repository
git clone https://github.com/DevGruGold/MESHNET.git
cd MESHNET

# Switch to phase-2-deploy branch
git checkout phase-2-deploy

# Install dependencies
npm install

# Copy environment configuration
cp .env.example .env
# Edit .env with your configuration
```

### Deployment

```bash
# Compile contracts
npm run compile

# Run tests
npm run test

# Deploy to Sepolia testnet
npm run deploy:sepolia
```

### Configuration

1. **Update .env file** with your private keys and RPC URLs
2. **Configure contract addresses** in deployment-info.json after deployment
3. **Set up Oracle** with validator private key
4. **Initialize Eliza agent** with contract addresses

## Usage

### Rig Registration

```javascript
// Register a new mining rig
await meshMiner.registerRig(rigId, walletAddress);
```

### Mining Setup (Termux)

```bash
# Make script executable
chmod +x scripts/termux/miner_meshnet.sh

# Start mining
./scripts/termux/miner_meshnet.sh
```

### Oracle Operation

```bash
# Run oracle submitter
cd oracle/scoreboard
python3 submitter.py
```

### Eliza Agent

```bash
# Start autonomous agent
cd agents/eliza
python3 agent_loop.py
```

## Smart Contract Interface

### MeshMiner.sol

```solidity
// Register a mining rig
function registerRig(bytes32 rigId, address owner) public

// Submit mining proof (validator only)
function submitProof(bytes32 rigId, uint256 hashes, bytes memory signature) public

// Distribute rewards (validator only)
function distributeReward(address miner, uint256 rewardAmount) public
```

### XMRT.sol

```solidity
// Mint rewards from mesh mining (validator only)
function rewardFromMesh(address to, uint256 amount) public

// Create DAO proposal (Eliza/Langflow only)
function createProposal(bytes32 proposalId, address target, uint256 value, bytes memory data) public
```

## Testing

### Unit Tests

```bash
# Run all tests
npm run test

# Run specific test file
npx hardhat test test/deployment_test.js
```

### Integration Testing

The test suite includes:
- Contract deployment verification
- Rig registration and validation
- Proof submission workflows
- Reward distribution mechanisms
- Offline mining simulation
- Gas usage analysis

### Test Scenarios

1. **3 Miners Offline → Reconnect + Submit**
- Miners accumulate hashes offline
- Reconnect and submit proofs via Oracle
- Eliza creates reward proposal
- Langflow executes distribution

2. **Autonomous Proposal Creation**
- Eliza monitors scoreboard data
- Creates hash-weighted reward proposals
- Respects minimum proof thresholds
- Maintains proposal intervals

## Security Considerations

### Access Control
- Role-based permissions for all critical functions
- Multi-signature requirements for high-value operations
- Signature verification for mining proofs

### Input Validation
- Rig ID uniqueness enforcement
- Hash count validation
- Signature authenticity checks

### Economic Security
- Minimum proof thresholds prevent spam
- Proportional reward distribution
- Gas-efficient operations

## Gas Usage

Typical gas costs on Sepolia:
- Rig registration: ~150,000 gas
- Proof submission: ~120,000 gas
- Reward distribution: ~180,000 gas

## Frontend Integration

### Dashboard Components
- Real-time mining statistics
- Rig status monitoring
- Reward tracking interface
- Network topology visualization

### API Endpoints
```
GET /api/mesh/rigs - List registered rigs
GET /api/mesh/rewards/{address} - Get claimable rewards
POST /api/mesh/register - Register new rig
POST /api/mesh/claim-rewards - Claim pending rewards
```

## Troubleshooting

### Common Issues

1. **Rig Registration Fails**
- Ensure rig ID is unique
- Check wallet connection
- Verify sufficient gas

2. **Proof Submission Rejected**
- Validate Oracle permissions
- Check signature format
- Ensure minimum hash threshold

3. **Rewards Not Distributed**
- Verify Eliza agent is running
- Check proposal interval settings
- Ensure Langflow validation

### Debug Commands

```bash
# Check contract deployment
npx hardhat verify --network sepolia <contract_address>

# Monitor events
npx hardhat console --network sepolia

# Test Oracle connection
python3 oracle/scoreboard/submitter.py --test
```

## Roadmap
- v1.1: Add real-time agent analytics.
- v2.0: Mobile integrations with Android/Apple forks.

Badges: [![CI](https://github.com/DevGruGold/MESHNET/actions/workflows/ci.yml/badge.svg)](https://github.com/DevGruGold/MESHNET/actions)
### Phase 3 Enhancements
- Mainnet deployment
- Advanced analytics dashboard
- Mobile app development
- Hardware wallet integration
- Multi-network support

### Performance Optimizations
- Layer 2 integration
- Batch proof submissions
- Optimized gas usage
- Enhanced offline capabilities

## Contributing

1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Support

For technical support and questions:
- GitHub Issues: [MESHNET Issues](https://github.com/DevGruGold/MESHNET/issues)
- Documentation: [MESHNET Wiki](https://github.com/DevGruGold/MESHNET/wiki)
- Community: [Discord Server](https://discord.gg/meshnet)

## Acknowledgments

- OpenZeppelin for secure smart contract libraries
- Hardhat for development framework
- Termux community for mobile mining support
- XMRT DAO community for governance insights



## Instructions for Future Agents

This project is designed to facilitate offline mesh mining with autonomous DAO operations. Here are some areas for future improvement and considerations for the next agent:

1. **Comprehensive Testing**: While unit and integration tests are present, consider expanding test coverage, especially for edge cases and security vulnerabilities in smart contracts. Fuzz testing and formal verification could be valuable additions.
2. **Gas Optimization**: Review smart contract functions for further gas optimization. Even small reductions can lead to significant savings over time, especially on mainnet deployment.
3. **Frontend Enhancements**: The current frontend integration is outlined. Develop a fully functional and user-friendly dashboard that visualizes all aspects of the MESHNET ecosystem, including real-time mining statistics, DAO proposals, and reward distribution.
4. **Oracle Robustness**: Enhance the Oracle system's robustness and fault tolerance. Consider implementing decentralized oracle solutions to reduce single points of failure.
5. **Agent Intelligence**: Improve the intelligence and autonomy of Eliza and Langflow agents. Explore advanced AI/ML techniques for more sophisticated proposal creation and execution, and consider integrating with more diverse data sources.
6. **Security Audits**: Before mainnet deployment, a thorough security audit of all smart contracts and the overall system architecture is highly recommended.
7. **Documentation**: Continuously update and expand documentation for all components, including detailed API specifications, smart contract function explanations, and deployment guides.
8. **Scalability**: As the network grows, evaluate and implement solutions for scalability, such as Layer 2 integrations or sharding, to handle increased transaction volume.
9. **User Experience**: Focus on improving the overall user experience for miners, DAO participants, and developers. Simplify setup processes and provide clear feedback mechanisms.

## Next Next Phase: Dashboard & Deployment
- **Dashboard:** Run `streamlit run frontend/dashboard/app.py` for real-time monitoring.
- **Tests:** `python -m unittest discover utils/tests`.
- **Deployment:** GitHub Actions for Vercel/cloud deploys.
By focusing on these areas, the MESHNET project can be significantly improved and prepared for wider adoption and mainnet deployment.

## Next Next Next Phase: Auth, Integrations, Cloud Demo
- **Authentication:** Secure dashboard with passwords/OAuth.
Expand Down
Loading
Loading