Skip to content

HackTechDev/luanti-nft

Repository files navigation

Pack tout-en-un — Luanti × Blockchain (Mod + Backend + Hardhat)

Ce pack contient tout ce qu’il faut pour tester un flux complet :

  • Mod Luanti luanti_nft (découverte d’artefact → POST → mint d’un NFT)
  • Backend Node.js de minting (Express + ethers)
  • Starter Hardhat (contrat ERC-721 + scripts de déploiement et mint)

Structure

/
├─ luanti_nft/                 # Mod pour Luanti (placez-le dans worldmods/)
├─ luanti-nft-backend/         # Backend de minting
├─ hardhat-starter/            # Projet Hardhat local
└─ _archives/                  # Les 3 archives individuelles (pour référence)

Étapes rapides (local, Hardhat)

1) Lancer une blockchain locale

cd hardhat-starter
npm i
npm run node   # laisse ce terminal ouvert

Dans un deuxième terminal :

cd hardhat-starter
npm run compile
npm run deploy:local
# Notez l'adresse affichée (aussi dans deployments/local.json)
npm run mint:local  # (optionnel) mint de test

2) Démarrer le backend de minting

cd ../luanti-nft-backend
npm i
cp .env.example .env
# Éditez .env :
# RPC_URL=http://127.0.0.1:8545
# CHAIN_ID=31337
# PRIVATE_KEY=<UNE CLÉ PRIVÉE affichée par `npm run node`>
# CONTRACT_ADDRESS=<ADRESSE déployée étape 1>
# API_KEY=super-secret-token
npm start

3) Configurer et lancer Luanti

Dans votre minetest.conf :

secure.http_mods = luanti_nft
luanti_nft.mint_endpoint = http://127.0.0.1:3000/mint
luanti_nft.api_key = super-secret-token
luanti_nft.network = hardhat
luanti_nft.debug = true

Copiez le dossier luanti_nft/ dans worldmods/ (ou mods/) de votre monde Luanti et activez le mod. Dans le jeu, pour tester rapidement :

/giveme luanti_nft:artifact_ore

Placez et creusez le bloc → un NFT est frappé via le backend.


Notes importantes

  • Le backend mint par défaut vers le wallet du serveur. Pour minter vers le wallet du joueur, il faut un mapping pseudo -> adresse côté backend et appeler mintTo(playerAddress, tokenURI).
  • Pour les métadonnées, utilisez IPFS en production (au lieu de data: URI).
  • Sécurisez l’API backend (clé API, IP allowlist, HMAC). Ne committez jamais de clés privées !

Bon build et amusez-vous bien ! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published