|
| 1 | +# VanaTensor Satya Proof of Contribution |
| 2 | + |
| 3 | +This repository creating a [proof of contribution](https://docs.vana.org/vana/core-concepts/key-elements/proof-of-contribution) tasks using Python. It is executed on Vana's Satya Network, a group of highly confidential and secure compute nodes that can validate data without revealing its contents to the node operator. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This poc provides a basic structure for building proof tasks that: |
| 8 | + |
| 9 | +1. Read input files from the `/input` directory. |
| 10 | +2. Process the data securely, running any necessary validations to prove the data authentic, unique, high quality, etc. |
| 11 | +3. Write proof results to the `/output/results.json` file in the following format: |
| 12 | + |
| 13 | +```json |
| 14 | +{ |
| 15 | + "dlp_id": 1, |
| 16 | + "valid": true, |
| 17 | + "score": 0.7614457831325301, |
| 18 | + "time_minimums": 1.0, |
| 19 | + "time_correlation": 1.0, |
| 20 | + "time_distribution": 1.0, |
| 21 | + "repeat_anwsers": 1.0, |
| 22 | + "both_sides": 0, |
| 23 | + "model_distribution": 0.0, |
| 24 | + "poison_data": 0.0, |
| 25 | + "uniqueness": 0.0 |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +The project is designed to work with Intel TDX (Trust Domain Extensions), providing hardware-level isolation and security guarantees for confidential computing workloads. |
| 30 | + |
| 31 | +## Project Structure |
| 32 | + |
| 33 | +- `my_proof/`: Contains the main proof logic |
| 34 | + - `proof.py`: Implements the proof generation logic |
| 35 | + - `__main__.py`: Entry point for the proof execution |
| 36 | + - `models/`: Data models for the proof system |
| 37 | +- `demo/`: Contains sample input and output for testing |
| 38 | +- `Dockerfile`: Defines the container image for the proof task |
| 39 | +- `requirements.txt`: Python package dependencies |
| 40 | + |
| 41 | +## Customizing the Proof Logic |
| 42 | + |
| 43 | +The main proof logic is implemented in `my_proof/proof.py`. To customize it, update the `Proof.generate()` function to change how input files are processed. |
| 44 | + |
| 45 | +The proof can be configured using environment variables: |
| 46 | + |
| 47 | +- `USER_EMAIL`: The email address of the data contributor, to verify data ownership |
| 48 | + |
| 49 | +## Local Development |
| 50 | + |
| 51 | +To setup venv and install dependencies: |
| 52 | + |
| 53 | +```bash |
| 54 | +python3 -m venv venv |
| 55 | +source venv/bin/activate |
| 56 | +pip install -r requirements.txt |
| 57 | +export PYTHONPATH=. |
| 58 | +``` |
| 59 | + |
| 60 | +To run the proof locally for testing, you can use Docker: |
| 61 | + |
| 62 | +```bash |
| 63 | +docker build -t my-proof . |
| 64 | +``` |
| 65 | + |
| 66 | +```bash |
| 67 | +docker run --rm --volume $(pwd)/input:/input --volume $(pwd)/output:/output -e AWS_ACCESS_KEY_ID=<your-access-key-id> -e AWS_SECRET_ACCESS_KEY=<your-secret-access-key> my-proof |
| 68 | +``` |
| 69 | + |
| 70 | +## Running with Intel TDX |
| 71 | + |
| 72 | +Intel TDX (Trust Domain Extensions) provides hardware-based memory encryption and integrity protection for virtual machines. To run this container in a TDX-enabled environment, follow your infrastructure provider's specific instructions for deploying confidential containers. |
| 73 | + |
| 74 | +Common volume mounts and environment variables: |
| 75 | + |
| 76 | +```bash |
| 77 | +docker run --rm --volume /path/to/input:/input --volume /path/to/output:/output -e AWS_ACCESS_KEY_ID=<your-access-key-id> -e AWS_SECRET_ACCESS_KEY=<your-secret-access-key> my-proof |
| 78 | +``` |
| 79 | + |
| 80 | +Remember to populate the `/input` directory with the files you want to process. |
| 81 | + |
| 82 | +## Security Features |
| 83 | + |
| 84 | +This proof leverages several security features: |
| 85 | + |
| 86 | +1. **Hardware-based Isolation**: The proof runs inside a TDX-protected environment, isolating it from the rest of the system |
| 87 | +2. **Input/Output Isolation**: Input and output directories are mounted separately, ensuring clear data flow boundaries |
| 88 | +3. **Minimal Container**: Uses a minimal Python base image to reduce attack surface |
| 89 | + |
| 90 | +## Contributing |
| 91 | + |
| 92 | +If you have suggestions for improving this poc, please open an issue or submit a pull request. |
| 93 | + |
| 94 | +## License |
| 95 | + |
| 96 | +[MIT License](LICENSE) |
0 commit comments