{"id":21967027,"url":"https://github.com/ashtech15/web3-mafia-game","last_synced_at":"2026-04-08T11:32:40.994Z","repository":{"id":263972905,"uuid":"883890936","full_name":"ashtech15/Web3-Mafia-Game","owner":"ashtech15","description":"This project has the purpose of proving that the Mafia game can be part of the web3 space.","archived":false,"fork":false,"pushed_at":"2024-12-03T14:15:00.000Z","size":5638,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-03T15:30:58.889Z","etag":null,"topics":["ethereum","hardhat","metamask","nextjs","onchain-game","smartcontracts","solidity","tailwindcss","typescript","vercel","wagmi","web3"],"latest_commit_sha":null,"homepage":"https://web3-mafia-game-demo.vercel.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashtech15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-11-05T18:54:46.000Z","updated_at":"2025-05-12T12:27:53.000Z","dependencies_parsed_at":"2025-01-28T01:44:19.043Z","dependency_job_id":"1d0c521a-9d2c-4a5b-b776-0042ebdfcdb2","html_url":"https://github.com/ashtech15/Web3-Mafia-Game","commit_stats":null,"previous_names":["ashtech15/web3-mafia-game"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashtech15/Web3-Mafia-Game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashtech15%2FWeb3-Mafia-Game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashtech15%2FWeb3-Mafia-Game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashtech15%2FWeb3-Mafia-Game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashtech15%2FWeb3-Mafia-Game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashtech15","download_url":"https://codeload.github.com/ashtech15/Web3-Mafia-Game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashtech15%2FWeb3-Mafia-Game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31554091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ethereum","hardhat","metamask","nextjs","onchain-game","smartcontracts","solidity","tailwindcss","typescript","vercel","wagmi","web3"],"created_at":"2024-11-29T13:19:50.307Z","updated_at":"2026-04-08T11:32:40.970Z","avatar_url":"https://github.com/ashtech15.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔫 𝕸𝖆𝖋𝖎𝖆 𝕲𝖆𝖒𝖊\n\nThis project has the purpose of proving that the Mafia game can be part of the web3 space. The game will use a Scaffold ETH template that uses NextJS and Hardhat. Most of the logic will sit off chain, but where it is possible, we can add the functionality on chain.\n🧪 DOD: Showcase that Mafia game can be integrated and played using Scaffold ETH by choosing from 3 roles (assassin, police officer, citizen), having a total of 4 players and only one team can win: assassins or the town.\n⚙️ Built using NextJS, RainbowKit, Hardhat, Wagmi, Viem, and Typescript.\n\n## Requirements\n\nBefore you begin, you need to install the following tools:\n\n- [Node (\u003e= v18.18)](https://nodejs.org/en/download/)\n- Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install))\n- [Git](https://git-scm.com/downloads)\n\n## Setup\n\nThere are a total of 4 available players and 3 of them are NPC.\nThe user will have to login using his Metamask account then he can press a button to be assigned one of the 3 available roles as such:\n\n- 2 x assassins\n- 1 x police officer\n- 1 x citizen\n  **Secrecy**\n  Each individual has its role hidden from the other participants.\n  The user can see the other’s wallet addresses but cannot see their roles.\n  **Roles**\n\n1. Assassin\n   choose somebody to kill (during night)\n   can vote (during day)\n2. Police Officer\n   do an inquiry about somebody else’s role (during night)\n   can vote (during day)\n3. Citizen\n   can vote (during day)\n\n## Stages\n\n**Waiting**\n\n- Players can join game by paying the joining fee. We need 4 players to start game.\n- Assign role (only at the beginning)\n\n**Night**\n\n- Assasins’s turn - choose somebody to kill\n\n**Day**\n\n- Narrator’s conclusion from last night: “Last night a person was killed by\n  the assassins. The person is {wallet address}.\n- The community debate and choose somebody to kill.”\n- Voting to kill - choose somebody available from the dropdown list to kill.\n  _!!! The person that was kill doesn’t have the right to vote or be killed\n  anymore !!!_\n- If every live players has the same vote, then the voting should be restarted with the note. **\"Voting restarted: One player must have more votes than the others\"**\n\n- Narrator displays voting results: “There were {number} amount of votes\n  for {wallet address} and {number} amount of votes for {wallet address}. By\n  the decision of the community, {wallet address} will be killed”\n- Exception: If the vote result is tie or no one voted after 60 seconds, then we should restart voting.\n\n**Check for winners**\n\nAt this stage, 2/4 persons were killed.\n\n- If the remaining persons are assassins, then display winner message to both assassins and end game\n- If the remaining persons are police officer and citizen, then display winner message to them and end game\n- If the remaining persons are 1 assassin and either the citizen or police officer displayer winner message to assassin and end game.\n\n**Display winner message and end game**\n\n- Store prizez and claim them by the winners (when user presses start to chose a role, it will pay 0.1ETH, the game will start with 0.4ETH paid by each participant, when game is over, prize will be split between winners)\n\n## Quickstart\n\nTo get started with MAFIA game, follow the steps below:\n\n1. Clone this repo \u0026 install dependencies\n\n```\ngit clone https://github.com/musicmediatech/Web3-Mafia-Game.git\ncd mafia-onchain-game\nyarn install\n```\n\n2. Run a local network in the first terminal:\n\n```\nyarn chain\n```\n\nThis command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in `hardhat.config.ts`. 3. On a second terminal, deploy the test contract:\n\n```\nyarn deploy\n```\n\nThis command deploys a test smart contract to the local network. The contract is located in `packages/hardhat/contracts` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/hardhat/deploy` to deploy the contract to the network. You can also customize the deploy script. 4. On a third terminal, start your NextJS app:\n\n```\nyarn start\n```\n\nVisit your app on: `http://localhost:3000`. You can interact with your smart contract using the `Debug Contracts` page. You can tweak the app config in `packages/nextjs/scaffold.config.ts`.\n\n**What's next**:\n\n- Edit your smart contract `YourContract.sol` in `packages/hardhat/contracts`\n- Edit your frontend homepage at `packages/nextjs/app/page.tsx`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation.\n- Edit your deployment scripts in `packages/hardhat/deploy`\n- Edit your smart contract test in: `packages/hardhat/test`. To run test use `yarn hardhat:test`\n- You can add your Alchemy API Key in `scaffold.config.ts` if you want more reliability in your RPC requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashtech15%2Fweb3-mafia-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashtech15%2Fweb3-mafia-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashtech15%2Fweb3-mafia-game/lists"}