{"id":25201444,"url":"https://github.com/johnforfar/game-vm","last_synced_at":"2026-02-26T16:05:11.216Z","repository":{"id":275719608,"uuid":"926926102","full_name":"johnforfar/game-vm","owner":"johnforfar","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-04T12:23:59.000Z","size":6389,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T20:41:14.597Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnforfar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-04T05:06:50.000Z","updated_at":"2025-02-04T12:24:03.000Z","dependencies_parsed_at":"2025-02-04T08:34:44.945Z","dependency_job_id":null,"html_url":"https://github.com/johnforfar/game-vm","commit_stats":null,"previous_names":["johnforfar/game-vm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johnforfar/game-vm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnforfar%2Fgame-vm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnforfar%2Fgame-vm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnforfar%2Fgame-vm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnforfar%2Fgame-vm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnforfar","download_url":"https://codeload.github.com/johnforfar/game-vm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnforfar%2Fgame-vm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260336342,"owners_count":22993739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-10T05:16:30.364Z","updated_at":"2026-02-26T16:05:06.180Z","avatar_url":"https://github.com/johnforfar.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Game VM\n\nGame VM is a purpose-built virtual machine for reduced fees on Solana, designed for game challenge pools and interactive gaming experiences. Based off Code VM, this project inherits the core functionality from the original Code VM while integrating improvements and customizations for improved gaming performance and lower transaction costs.\n\n![version](https://img.shields.io/badge/version-0.2.0-blue.svg?style=flat)\n![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)\n\n---\n\n## Overview\n\nThe Code Virtual Machine (Code VM) was originally designed to facilitate highly efficient payments on Solana by working with compact account representations. Game VM adapts these concepts to the gaming context:\n- **Reduced Fees:** Up to 95% lower transaction fees and 80% lower account rent compared to traditional Solana accounts.\n- **Compressed Accounts:** Dormant accounts can be compressed off-chain, reducing on-chain rent costs to near zero.\n- **On-Demand Decompression:** Accounts are decompressed automatically (via the Code app) or manually with support from public indexers.\n- **Seamless Integration:** Designed for use by the Code app to provide millions of users with a seamless and low-cost gaming experience.\n\n---\n\n## Repository Structure\n\n- **backend/**\n  - **program/** – Contains the smart contract (on-chain program) written in Rust and built with Anchor.\n  - **idl/** – Manages Interface Description Language (IDL) generation. It includes:\n    - A custom Makefile that builds the dummy program with Anchor (using a specified feature set)\n    - A script (`src/scripts/update-discriminators.ts`) powered by Bun.js to update account and instruction discriminators.\n  - **api/** – (If applicable) API definitions and shared types for interacting with the smart contract.\n- **frontend/** – Contains the React application that uses the generated IDL to interact with the deployed program on Solana.\n- **Other Files**\n  - The root README (this file) provides an overall overview.\n  - Additional configuration files (e.g., Cargo.toml, Anchor.toml) are provided throughout the repository.\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- **Solana CLI:** Install as described in the [Solana docs](https://docs.solana.com/cli/install-solana-cli-tools).\n- **Rust \u0026 Cargo:** Ensure the latest stable version is installed.\n- **Anchor Framework:** Version 0.31.1 (or as specified by the repo) for building the program.\n- **Node.js / npm:** Required for the frontend and IDL generation.\n- **Bun.js:** Used to run the discriminator update script.\n- **Vitest:** For testing the generated IDL.\n- **(Optional) Git \u0026 Docker:** For version control and containerized deployment if needed.\n\n### Installation\n\n1. **Clone the Repository:**\n   ```bash\n   git clone https://github.com/your-username/game-vm.git\n   cd game-vm\n   ```\n\n2. **Install Backend Dependencies:**\n   - Navigate into the IDL folder, install the npm dependencies, build with Anchor, and update the IDL:\n     ```bash\n     cd backend/idl/src\n     npm install\n     cargo clean\n     anchor build --skip-lint\n     cd ../      # back to backend/idl\n     make idl\n     ```\n   - The Makefile in `backend/idl` runs the update script (`update-discriminators.ts`) and creates the final `code_vm.json` in `backend/idl` (which is then copied to the frontend).\n\n3. **Setup the Frontend:**\n   - Ensure the updated IDL is copied over:\n     (This step is usually automatically triggered by the repository's Makefile.)\n   - Install frontend dependencies:\n     ```bash\n     cd ../../frontend\n     npm install\n     npm run build\n     npm start\n     ```\n\n4. **Run the Test Suite:**\n   - Start a local Solana validator and create a keypair (e.g., `keypair-owner.json`).\n   - Run the Vitest tests:\n     ```bash\n     vitest run ./backend/idl/src/tests/vm.test.ts --testTimeout 25000 --bail 1\n     ```\n\n---\n\n## Development Workflow\n\n### Backend (Smart Contracts \u0026 IDL)\n\n- **Building the Program:**  \n  The program uses Anchor to compile the smart contract. The IDL is generated during the build process:\n  ```bash\n  cd backend/idl/src\n  cargo clean \u0026\u0026 anchor build --skip-lint\n  cd ../\n  make idl\n  ```\n- **IDL Discriminator Update:**  \n  The `update-discriminators.ts` script modifies the generated IDL to include human-readable discriminators. Every account has a default type assigned if none exists, ensuring the Anchor client can compute the account layout without errors.\n- **Deployment:**  \n  Deploy your smart contract onto your desired Solana cluster:\n  ```bash\n  cd backend\n  anchor deploy\n  ```\n  \n### Frontend (React Application)\n\n- **Using the IDL:**  \n  The frontend imports the generated IDL (`frontend/src/idl/code_vm.json`) to create an Anchor client for interacting with the deployed smart contract.\n- **Start the Application:**\n  ```bash\n  cd frontend\n  npm run build\n  npm start\n  ```\n- **Debugging:**  \n  Check the browser console for errors. Ensure that the updated IDL contains proper `\"type\"` definitions for every account to avoid layout errors (such as missing `.size`).\n\n---\n\n## Original Code VM Content\n\nThis repository was forked from the original Code VM project. The core components of Code VM remain intact:\n\n- **Purpose:** Maintain the original design of a compact on-chain virtual machine for payments on Solana.\n- **Core Functionality:**  \n  - Lowered transaction fees by using compressed on-chain accounts.\n  - Delegated decompression when necessary.\n- **References:**  \n  Refer to the original repository for historical context and additional details:\n  [Original Code VM Repository](https://github.com/code-payments/code-vm)\n\nThe Game VM extends these ideas for gaming use cases while preserving the innovative methods developed in Code VM.\n\n---\n\n## Community \u0026 Support\n\n- **Discord:** [Join our Discord](https://discord.gg/T8Tpj8DBFp) for questions and community support.\n- **Twitter:** Follow [@getcode](https://twitter.com/getcode) for updates.\n- **Issues:** Please file any issues via GitHub.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n\n---\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to help out with this project.\n\n---\n\n## Contact\n\nIf you have further questions or need support, feel free to open an issue in this repository or contact the maintainers directly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnforfar%2Fgame-vm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnforfar%2Fgame-vm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnforfar%2Fgame-vm/lists"}