|
3 | 3 | A plugin for storing data using the 0G protocol within the ElizaOS ecosystem.
|
4 | 4 |
|
5 | 5 | ## Description
|
6 |
| - |
7 | 6 | The 0G plugin enables seamless integration with the Zero Gravity (0G) protocol for decentralized file storage. It provides functionality to upload files to the 0G network.
|
8 | 7 |
|
9 |
| -## Future work |
| 8 | +## Installation |
| 9 | + |
| 10 | +```bash |
| 11 | +pnpm install @elizaos/plugin-0g |
| 12 | +``` |
| 13 | + |
| 14 | +## Configuration |
| 15 | + |
| 16 | +The plugin requires the following environment variables to be set: |
| 17 | +```typescript |
| 18 | +ZEROG_INDEXER_RPC=<0G indexer RPC endpoint> |
| 19 | +ZEROG_EVM_RPC=<0G EVM RPC endpoint> |
| 20 | +ZEROG_PRIVATE_KEY=<Private key for transactions> |
| 21 | +ZEROG_FLOW_ADDRESS=<0G Flow contract address> |
| 22 | +``` |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +### Basic Integration |
| 27 | + |
| 28 | +```typescript |
| 29 | +import { zgPlugin } from '@ai16z/plugin-0g'; |
| 30 | +``` |
| 31 | + |
| 32 | + |
| 33 | +### File Upload Example |
| 34 | + |
| 35 | +```typescript |
| 36 | +// The plugin automatically handles file uploads when triggered |
| 37 | +// through natural language commands like: |
| 38 | + |
| 39 | +"Upload my document.pdf" |
| 40 | +"Store this image.png on 0G" |
| 41 | +"Save my resume.docx to Zero Gravity" |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +## API Reference |
| 46 | + |
| 47 | +### Actions |
| 48 | + |
| 49 | +#### ZG_UPLOAD |
| 50 | + |
| 51 | +Uploads files to the 0G network. |
| 52 | + |
| 53 | +**Aliases:** |
| 54 | +- UPLOAD_FILE_TO_ZG |
| 55 | +- STORE_FILE_ON_ZG |
| 56 | +- SAVE_FILE_TO_ZG |
| 57 | +- UPLOAD_TO_ZERO_GRAVITY |
| 58 | +- STORE_ON_ZERO_GRAVITY |
| 59 | +- SHARE_FILE_ON_ZG |
| 60 | +- PUBLISH_FILE_TO_ZG |
| 61 | + |
| 62 | +**Input Content:** |
| 63 | +```typescript |
| 64 | +interface UploadContent { |
| 65 | +filePath: string; |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | + |
| 70 | +## Common Issues & Troubleshooting |
| 71 | + |
| 72 | +1. **File Access Errors** |
| 73 | + - Ensure the file exists at the specified path |
| 74 | + - Check file permissions |
| 75 | + - Verify the path is absolute or relative to the execution context |
| 76 | + |
| 77 | +2. **Configuration Issues** |
| 78 | + - Verify all required environment variables are set |
| 79 | + - Ensure RPC endpoints are accessible |
| 80 | + - Confirm private key has sufficient permissions |
| 81 | + |
| 82 | +## Security Best Practices |
| 83 | + |
| 84 | +1. **Environment Variables** |
| 85 | + - Never commit private keys to version control |
| 86 | + - Use secure environment variable management |
| 87 | + - Rotate private keys periodically |
| 88 | + |
| 89 | + |
| 90 | +## Development Guide |
| 91 | + |
| 92 | +### Setting Up Development Environment |
| 93 | + |
| 94 | +1. Clone the repository |
| 95 | +2. Install dependencies: |
| 96 | + |
| 97 | +```bash |
| 98 | +pnpm install |
| 99 | +``` |
| 100 | + |
| 101 | +3. Build the plugin: |
| 102 | + |
| 103 | +```bash |
| 104 | +pnpm run build |
| 105 | +``` |
| 106 | + |
| 107 | +4. Run the plugin: |
| 108 | + |
| 109 | +```bash |
| 110 | +pnpm run dev |
| 111 | +``` |
| 112 | + |
| 113 | +## Future Enhancements |
| 114 | + |
| 115 | +- Model service deployment on 0G serving network |
| 116 | +- 0G KV store for plugin state persistence |
| 117 | +- Upload history and file metadata storage |
| 118 | +- 0G as a database option for Eliza state storage |
| 119 | +- Enhanced file path and context extraction |
| 120 | + |
| 121 | +## Contributing |
| 122 | + |
| 123 | +Contributions are welcome! Please see our contributing guidelines for more details. |
| 124 | + |
| 125 | +## License |
10 | 126 |
|
11 |
| -- Enable model service deployment on 0G serving network. |
12 |
| -- Implement 0G KV store for plugin state persistence . |
13 |
| -- Store upload history and file metadata. |
14 |
| -- Provide 0G as a db option for Eliza to store its memory/state. |
15 |
| -- Enhance file path and context extraction. |
| 127 | +[License information needed] |
0 commit comments