A server implementation that enables $CHR token transactions on the Chromia blockchain through Virtuals.io G.A.M.E Lite integration. This server provides the infrastructure for AI agents to send $CHR tokens.
This repository provides a server-side implementation for integrating with Virtuals.io G.A.M.E (Generative Autonomous Multimodal Entities) Lite. It demonstrates how to set up endpoints that allow AI agents to initiate $CHR token transfers. Use this as a template to build your own G.A.M.E-enabled applications!
- Automated tipping system for content creators
- Reward distribution for community engagement
- AI-driven token distribution mechanisms
- Gamification rewards system
To install dependencies:
bun install
To run:
bun run src/index.ts
- Start the local development server:
bun run src/index.ts
- Create a public domain using ngrok or any other tunneling service:
ngrok http http://localhost:3000
-
Go to https://game-lite.virtuals.io/ and:
- Upload your
game-list.json
file - Update the function URL from localhost:3000 to your ngrok URL
- Upload your
-
Test the functionality:
- Create a tweet with the format: "send 0.001 $CHR to xxxxxxx"
- Use the tweet ID to simulate the AI Agent's response
The project uses Swagger for API documentation. Add new endpoints using the following format:
/**
* @swagger
* /endpoint:
* get
* name: FUNCTION_NAME
* summary: FUNCTION_DESCRIPTION
* description: HINT
* game_lite_supported: true (set it to false to not be included)
**/
Generate updated G.A.M.E Lite configuration:
bun run script/generateGameLite.ts
-
Setup:
- Set
NODE_ENV=production
- Set
SERVER_SECRET_KEY
with a secure random string - Set the
prodAllowedIps
to support Virtuals' IP
- Set
-
Configure Application:
- Update
game-lite.json
with your productionSERVER_SECRET_KEY
settings - Ensure all sensitive credentials are properly secured
- Update
-
Deployment Steps:
- Build the application:
bun build src/index.ts
- Deploy to your production server
- Set up SSL/TLS for secure HTTPS connections
- Build the application:
-
Security Considerations:
- Keep your
SERVER_SECRET_KEY
secure and never commit it to version control - Regularly rotate security credentials
- Keep your
- Protect the SERVER_SECRET_KEY
- Implement IP allowlisting
- Use HTTPS for all connections
- Implement rate limiting