{"id":33561060,"url":"https://github.com/snowstorm05/diesel-attack-web3-game","last_synced_at":"2025-12-31T01:05:03.820Z","repository":{"id":319350867,"uuid":"1074242280","full_name":"Snowstorm05/Diesel-Attack-Web3-Game","owner":"Snowstorm05","description":"Backend server for the Diesel Attack 2D RPG on TON blockchain. Handles NFT/SBT minting, wallet integration, and game reward distribution via Fastify and Tonweb SDK.","archived":false,"fork":false,"pushed_at":"2025-10-11T12:20:48.000Z","size":1165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-23T18:27:26.594Z","etag":null,"topics":["api","blockchain","fastify","func","game","nft","nodejs","orbs","ton","toncoin","typescript","unity","web3","webgl"],"latest_commit_sha":null,"homepage":"https://play.dieselattack.com/","language":"TypeScript","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/Snowstorm05.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-11T12:18:47.000Z","updated_at":"2025-10-16T13:44:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"083cbe65-113d-4825-ae21-18201916de0c","html_url":"https://github.com/Snowstorm05/Diesel-Attack-Web3-Game","commit_stats":null,"previous_names":["snowstrom5/diesel-attack-web3-game","snowstorm05/diesel-attack-web3-game"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Snowstorm05/Diesel-Attack-Web3-Game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowstorm05%2FDiesel-Attack-Web3-Game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowstorm05%2FDiesel-Attack-Web3-Game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowstorm05%2FDiesel-Attack-Web3-Game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowstorm05%2FDiesel-Attack-Web3-Game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snowstorm05","download_url":"https://codeload.github.com/Snowstorm05/Diesel-Attack-Web3-Game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowstorm05%2FDiesel-Attack-Web3-Game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27286492,"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","status":"online","status_checked_at":"2025-11-26T02:00:06.075Z","response_time":193,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","blockchain","fastify","func","game","nft","nodejs","orbs","ton","toncoin","typescript","unity","web3","webgl"],"created_at":"2025-11-27T23:01:47.766Z","updated_at":"2025-11-27T23:04:03.977Z","avatar_url":"https://github.com/Snowstorm05.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Diesel Attack NFT Game Backend API Server\n\nWelcome to the cyberpunk post-apocalyptic world of Diesel Attack\n\nhttps://dieselattack.com\n\nDiesel Attack is a hardcore 2D-platformer with web3 economy based on utility NFTs and SBTs on [TON blockchain](https://ton.org). Desktop web version for now, mobile apps are coming soon.\n\n\n\n![Diesel Attack NFT Game banner 1200x600](/docs/img/diesel-attack-banner_1200x600.jpg)\n\n\u003eTo earn TON coins and collect NFTs and SBTs during the game you need a [TON Wallet](https://ton.org/en/wallets). \n\u003eWe never ask you for keys.\n\n\n\u003cdetails open=\"open\"\u003e\n\u003csummary\u003eTable of Contents\u003c/summary\u003e\n\n- [About](#about)\n- [API Usage](#api-usage)\n    - [API methods](#api-methods)\n    - [Security](#security)\n- [How To Build](#how-to-build)\n    - [Prerequisites](#prerequisites)\n    - [Build the contract](#build-the-contract)\n    - [Deploy to the mainnet](#deploy-to-the-mainnet)\n    - [Tests](#tests)\n\n\n\n\u003c/details\u003e\n\n## About\n\nThis is the source of the backend API server of the RPG 2D-sidescroller game Diesel Attack. It implements smart contracts on the TON blockchain to mint NFTs and SBTs for players during the game on the fly. \n\nWhen a game client app sends a request to the server using API, a player gets a new weapon or ship as NFT based on the weighted random algorithm. Also, players get SBTs for completing the levels and speedrun records. While they need to connect a TON wallet only once starting the game. And NFT and SBT minting operations are totally free for users.\n\n### Tech stack\n\n1. The game is developed on Unity, built with WebGL \u0026 deployed at https://play.dieselattack.com.\n2. Smart contracts are used for on-chain data storage and for minting NFTs and SBTs on the fly, written in FunC. \n3. Backend API server is running on Fastify (Node.js framework) implementing Tonweb SDK. \n4. Orbs TON Access RPC network provides unrestricted decentralized access to the TON blockchain. \n5. Ton Connect 2.0 provides TON authorization in the game. \n6. NFTs and SBTs source images are hosted on IPFS using NFT.Storage. \n7. AWS EC2 \u0026 Route53 are used for both game and backend servers hosting \u0026 load balancing. \n8. TWA is to be used for voting functionality integration inside the Telegram app (to be implemented).\n\n### Implemented functionality\n\n- Unity WebGL client app (the game)\n- Backend API server handling requests\n- Smart contract minting NFTs on the fly\n- TON Connect 2.0 Unity WebGL integration\n\n\n### To be done\n\n- Smart contract minting SBTs on the fly\n- Smart contract storing players database completely on-chain\n- Smart contract funding and distributing Prize Pool\n- TWA dapp for voting and for quick access to leaderboard on-the-go\n- iOS and Android client apps, mobile web version\n\n\n\n## API Usage\n\n\n\n### API methods\n\n#### Status\n\nRequest:\n\n`GET /v2/` returns greetings message (server status check)\n\nResponse:\n\n`Diesel Attack NFT Game Backend API Server 2.1.8`\n\nProduction server endpoint:\n\nhttps://api.dieselattack.com/v2/\n\n#### Mint NFT\n\nRequest:\n\n`GET /v2/mint-nft?id=\u003caddress\u003e\u0026apikey=\u003csecret_token\u003e` mints NFT for player and returns an id of the collectible (weapons for now) and a link to just minted nft on explorer. Where `\u003caddress\u003e` is the player's TON wallet friendly address on the mainnet. And `\u003csecret_token\u003e` is a client app hashed secret token. The response time is less than 1 second.\n\nResponse:\n\n`{ \"success\": \u003ctrue/false\u003e, \"rewardType\": \u003cgun/ship/shield\u003e,\"rewardNum\": \u003cindex\u003e, \"link\": \u003cjust minted nft on blockchain explorer\u003e, \"errorMsg\": \u003cerror message if any\u003e }`\n\nProduction server endpoint:\n\nhttps://api.dieselattack.com/v2/mint-nft?id=EQBiKxj6DSyPRnK4Rg92hRX03Anw5FOXfEbFj6uTnfyln8CS\u0026apikey=e0965cbdf5ba6694039715cf642b44d9a007607294daf4579d8fff62a52016ba\n\n\u003eUntil 31.03 you can check it out by yourself and mint NFT to your TON wallet. Just put your TON wallet address instead of `address`. No keys needed. Browse it and check your wallet NFT section.\n\n\n#### Mint SBT\n\nRequest:\n\n`GET /v2/mint-sbt?id=\u003caddress\u003e\u0026reward=\u003ctype\u003e\u0026num=\u003cindex\u003e\u0026apikey=\u003csecret_token\u003e` mints SBT for player and returns an id of the collectible and a link to just minted sbt on explorer. Where `\u003caddress\u003e` is the player's TON wallet address on the mainnet, `\u003ctype\u003e` is a type of the reward in the game,  `\u003cindex\u003e` is an id of the reward. And `\u003csecret_token\u003e` is a client app hashed secret token.\n\nResponse:\n\n`{ \"success\": \u003ctrue/false\u003e, \"link\": \u003cjust minted sbt on blockchain explorer\u003e, \"errorMsg\": \u003cerror message if any\u003e }`\n\nProduction server endpoint (not implemented yet):\n\nhttps://api.dieselattack.com/v2/mint-sbt?id=EQBiKxj6DSyPRnK4Rg92hRX03Anw5FOXfEbFj6uTnfyln8CS\u0026reward=level\u0026num=1\u0026apikey=e0965cbdf5ba6694039715cf642b44d9a007607294daf4579d8fff62a52016ba\n\n\n### Security\n\n:warning: Till the end of the [Hack-a-TONx w/ DoraHacks](https://dorahacks.io/hackathon/hack-a-tonx/detail) hackathon we left the possibility to check and mint NFT via API link for everyone intentionally.\nBut then server will not process requests with the temporal `Apikey`, only the game app one!\n\nTemporal ApiKey (valid until 31.03.23): `e0965cbdf5ba6694039715cf642b44d9a007607294daf4579d8fff62a52016ba`\n\n## Smart contracts addresses\n\nDiesel Attack wallet official address: `dieselattack.ton` ([View on Tonscan](https://tonscan.org/address/dieselattack.ton))\n\nDiesel Attack NFT Collection official address: `EQB4LidmxGVV2_73UBiAAyQ8nv30u1SRP5_qIpv6UZPG_DOB` ([View on Tonscan](https://tonscan.org/address/EQB4LidmxGVV2_73UBiAAyQ8nv30u1SRP5_qIpv6UZPG_DOB))\n\n## How To Build\n\n### Prerequisites\n\nReferences to the original documentation:\n\n- [Node.js](https://nodejs.org/en/download/package-manager/)\n- [Yarn](https://yarnpkg.com/getting-started/install)\n\n\n### Build the contract\n\n\u003eFunC smart contracts will be compiled and saved as HEX code into the `build` directory in project root. It must be created with appropriate access permissions before building.\n\n1. Install all the dependencies:\n    ```sh\n    yarn\n    ```\n\n2. Build the smart-contract into WebAssembly:\n    ```sh\n    yarn build\n    ```\n\n\n### Deploy to the mainnet\n\n\u003e Credentials are stored in `env` directory in project root and used as environment variables. It must be created with appropriate access permissions before deploying.\n\u003e \n\u003e It should contain the next files:\n\u003e \n\u003e `apikey.env` with `APIKEY=\"\"` in it - client app secret token.\n\u003e `wallet_key.env` with `SECRET_KEY=\"\"` in it - contract owner wallet secret key in Base64 encoding.\n\u003e\n\u003e Server generates `api.log` file in project root directory. It must have appropriate access permissions.\n\n\n1. Deploy the contract to the TON mainnet (workchain 0):\n    ```sh\n    yarn deploy\n    ```\n\n2. Run the server:\n    ```sh\n    yarn start\n    ```\n\n### Tests\n\n- Run the smart contract test: (not implemented yet)\n    ```sh\n    yarn test\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowstorm05%2Fdiesel-attack-web3-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowstorm05%2Fdiesel-attack-web3-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowstorm05%2Fdiesel-attack-web3-game/lists"}