This project, hosted at https://github.com/DiplomaDefence/gamedev/, is being developed as a Diploma Project by the following students:
- Андронов Максим Дмитриевич (Student ID: 31590)
- Чивердин Эдуард Александрович (Student ID: 31583)
- Абилов Мирас (Student ID: 31176)
The goal is to create a Blockchain-Based Gaming System that utilizes Non-Fungible Tokens (NFTs) for in-game assets, enables secure transactions, and explores the economic potential of blockchain technology in gaming.
- NFT Integration: Use NFTs to represent unique in-game assets such as characters, skins, and weapons.
- Blockchain Transactions: Secure, decentralized transactions for in-game purchases and trades.
- Testing: Comprehensive testing strategies for both smart contracts and user interactions.
- Economic Insights: Analysis of the advantages and value of blockchain in the gaming ecosystem.
project/
├── contracts/ # Smart contracts for NFT and game logic
├── tests/ # Test scripts for contracts and transactions
├── src/ # Frontend and backend application code
├── docs/ # Documentation for APIs and features
├── README.md # Project overview and instructions
├── package.json # Project dependencies
├── hardhat.config.js # Configuration for the Hardhat development environment
└── .env # Environment variables (e.g., private keys, API endpoints)
- Node.js: Install the latest version.
- Hardhat: Development environment for Ethereum.
- Metamask: Browser wallet extension.
- Blockchain Testnet: Use Polygon Mumbai, Binance Smart Chain Testnet, or Ethereum Goerli.
- Clone the repository:
git clone https://github.com/DiplomaDefence/gamedev.git
- Navigate to the project directory:
cd gamedev - Install dependencies:
npm install
- Configure environment variables in
.env:PRIVATE_KEY=<Your Private Key> INFURA_API_KEY=<Your Infura API Key> - Compile smart contracts:
npx hardhat compile
Non-Fungible Tokens (NFTs) are unique digital assets stored on the blockchain. In this system, NFTs are used to represent in-game items such as rare collectibles and characters.
Use the ERC-721 or ERC-1155 standards to mint NFTs. Example script:
const { ethers } = require("hardhat");
async function main() {
const nftContract = await ethers.getContractFactory("GameNFT");
const deployedNFT = await nftContract.deploy();
await deployedNFT.deployed();
console.log("NFT Contract deployed to:", deployedNFT.address);
await deployedNFT.mint("0xYourWalletAddress", 1, "ipfs://YourMetadataLink");
console.log("NFT Minted!");
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});- In-game Purchases: Players can use cryptocurrency to buy items.
- Player Trades: Secure player-to-player trading through smart contracts.
Example contract for payments:
pragma solidity ^0.8.0;
contract GamePayment {
function buyItem(address payable seller) public payable {
require(msg.value > 0, "Payment must be greater than 0");
seller.transfer(msg.value);
}
}- Smart Contracts: Ensure the logic for minting, transferring, and purchasing NFTs is correct.
- Frontend: Simulate user interactions and verify transaction workflows.
- Security: Check for vulnerabilities using tools like MythX or Slither.
npx hardhat testSample test script:
const { expect } = require("chai");
describe("GameNFT", function () {
it("Should mint an NFT successfully", async function () {
const GameNFT = await ethers.getContractFactory("GameNFT");
const nft = await GameNFT.deploy();
await nft.deployed();
const mintTx = await nft.mint("0xYourWalletAddress", 1, "ipfs://metadata-link");
await mintTx.wait();
expect(await nft.ownerOf(1)).to.equal("0xYourWalletAddress");
});
});- ERC-721: Standard for unique NFTs.
- ERC-1155: Multi-token standard for both fungible and non-fungible tokens.
- IPFS: Decentralized file storage for metadata.
- Blockchain gaming is transforming in-game asset ownership and monetization.
- Games like Axie Infinity and Gods Unchained showcase how NFTs create new revenue streams.
- Ownership: Players have real ownership of in-game assets.
- Transparency: Immutable transaction records ensure trust.
- Security: Reduced risk of fraud or asset duplication.
- Interoperability: NFTs can be used across different games.
- Polygon (MATIC): Low fees, fast processing, Ethereum-compatible.
- Binance Smart Chain (BSC): Cost-effective, widely used.
- Ethereum Testnets (Goerli, Rinkeby): Ideal for testing.
Feedback and suggestions are welcome for:
- Improving NFT features.
- Enhancing transaction workflows.
- Expanding testing and security measures.
Please submit feedback via GitHub issues or email us at [syrymzhakypbekov@gmail.com].
- Андронов Максим Дмитриевич (31590)
- Чивердин Эдуард Александрович (31583)
- Абилов Мирас (31176)