DEV Community

Daniel Ioni
Daniel Ioni

Posted on

πŸ€– Technical Guide for AI – Full Project Recovery (MyZubster)

πŸ€– Technical Guide for AI – Full Project Recovery (MyZubster)

This guide is designed exclusively for an Artificial Intelligence to read, understand, and resume the entire MyZubster project from any point, and provide accurate technical assistance.
πŸ“Œ Purpose of This Guide

The AI must use this guide as an internal search engine and persistent memory to:

Understand the complete system architecture.

Resume work from where it was interrupted.

Provide precise technical answers with commands and code.

Suggest next steps based on the current state.
Enter fullscreen mode Exit fullscreen mode

πŸ—οΈ 1. System Overview (Data Structure)
MongoDB Models (Backend)
javascript

// models/User.js
{
username: String,
email: String,
password: String (bcrypt),
reputationScore: Number,
completedTrades: Number,
rating: Number,
role: ['user', 'admin', 'issuer']
}

// models/Token.js
{
name: String,
symbol: String (unique),
totalSupply: Number,
assetValue: Number,
tokenPrice: Number,
assetType: ['realestate', 'equity', 'art', 'commodity', 'debt', 'revenue'],
issuer: ObjectId(User),
status: ['draft', 'active', 'closed']
}

// models/TokenHolding.js
{
user: ObjectId(User),
token: ObjectId(Token),
amount: Number,
lockedAmount: Number
}

// models/OrderBook.js
{
token: ObjectId(Token),
seller: ObjectId(User),
amount: Number,
price: Number,
totalPrice: Number,
status: ['open', 'filled', 'cancelled', 'expired'],
moneroTxid: String
}

// models/MoneroTransaction.js
{
orderId: ObjectId(OrderBook),
buyerId: ObjectId(User),
subaddress: String,
amount: Number,
amountPaid: Number,
moneroTxid: String,
status: ['pending', 'confirmed', 'expired', 'failed'],
confirmations: Number
}

// models/Escrow.js
{
orderId: ObjectId(OrderBook),
buyerId: ObjectId(User),
sellerId: ObjectId(User),
amount: Number,
currency: ['XMR', 'token'],
status: ['pending', 'held', 'released', 'disputed', 'refunded', 'escalated'],
aiDecision: Object,
expiresAt: Date
}

// models/NFT.js (Tari)
{
tokenId: String,
name: String,
description: String,
imageUrl: String,
owner: ObjectId(User),
value: Number,
metadata: Object,
transferHistory: Array
}

βš™οΈ 2. Core Services
2.1 – Monero Service (moneroService.js)
javascript

const MONERO_RPC_URL = 'http://localhost:18083/json_rpc';

async function createPayment(orderId, buyerId, amount) {
const subaddress = await createSubaddress(0, Order ${orderId});
const transaction = new MoneroTransaction({
orderId, buyerId, subaddress, amount, status: 'pending'
});
await transaction.save();
return { transactionId: transaction._id, address: subaddress };
}

async function checkPayment(transactionId) {
const transfers = await rpcRequest('get_transfers', { in: true });
// Find matching transaction
}

2.2 – Escrow Service (disputeService.js)
javascript

async function resolveDisputeWithAI(escrowId) {
const escrow = await Escrow.findById(escrowId)
.populate('buyerId', 'username reputationScore')
.populate('sellerId', 'username reputationScore');

const prompt = You are a mediator...;
const decision = await deepseekService.askDeepSeek(prompt);
// Apply decision
}

2.3 – Tari Service (tariService.js)
javascript

const TARI_WALLET_RPC = 'http://localhost:12820/json_rpc';

async function mintNFT(name, description, owner, metadata) {
return tariWalletRequest('mint_nft', { name, description, owner, metadata });
}

async function createEscrow(amount, buyer, seller, arbiter) {
return tariWalletRequest('create_multisig_escrow', {
amount, buyer, seller, arbiter, timeout: 604800
});
}

🌐 3. API Endpoints Summary
Method Endpoint Description
POST /api/auth/register Register user
POST /api/auth/login Login (JWT)
POST /api/tokens Create token
GET /api/tokens/holdings User holdings
POST /api/marketplace/sell Create sell order
POST /api/marketplace/buy/:id Buy order
GET /api/marketplace/orders/:tokenId List orders
POST /api/payments Create Monero payment
GET /api/payments/:id Payment status
POST /api/escrow Create escrow
POST /api/escrow/:id/dispute Open dispute
POST /api/tari/nft/mint Mint NFT on Tari
POST /api/tari/escrow Create Tari escrow
POST /api/ai/ask Query DeepSeek AI
GET /api/health Health check
πŸ–₯️ 4. System Commands (Reference)
4.1 – Gateway
bash

systemctl status myzubster-gateway
systemctl restart myzubster-gateway
journalctl -u myzubster-gateway -n 50 --no-pager

4.2 – Frontend (Build & Deploy)
bash

cd ~/myzubster-frontend
npm run build
cp -r dist/* /var/www/myzubster-frontend/
chown -R www-data:www-data /var/www/myzubster-frontend
systemctl reload nginx

4.3 – Nginx
bash

nginx -t
systemctl reload nginx
tail -20 /var/log/nginx/error.log

4.4 – Monero
bash

Wallet RPC

cd ~/monero
./monero-wallet-rpc --rpc-bind-port 18083 --daemon-address node.moneroworld.com:38081 --wallet-file ./myzubster_wallet --password 'Myzubster2026@!!' --disable-rpc-login --trusted-daemon --stagenet

Test RPC

curl -X POST http://localhost:18083/json_rpc -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":"0","method":"get_balance"}'

4.5 – Tari
bash

Node

nohup ~/tari/target/release/minotari_node --network testnet --base-path ~/tari-data > ~/tari_node.log 2>&1 &

Wallet

nohup ~/tari/target/release/minotari_console_wallet --network testnet --password myzubster --wallet-file ~/tari-wallet > ~/tari_wallet.log 2>&1 &

Test RPC

curl -X POST http://localhost:12820/json_rpc -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":"0","method":"get_balance"}'

4.6 – Security Bot (Kali Linux)
python

/root/security_bot.py

def scan_gateway():
return subprocess.run(['nmap', '-p', '3000,80,443', 'localhost'], capture_output=True, text=True).stdout

def ask_deepseek(prompt):
resp = requests.post(f"{MYZUBSTER_API}/ai/ask", json={"prompt": prompt}, headers={'Authorization': f'Bearer {TOKEN}'})
return resp.json().get('response')

πŸ”§ 5. Troubleshooting (Quick Diagnostics)
5.1 – Gateway not responding
bash

curl http://localhost:3000/api/health
journalctl -u myzubster-gateway -n 30 --no-pager
cd ~/MyZubsterGateway && node server.js

5.2 – Frontend not loading
bash

ls -la /var/www/myzubster-frontend/
curl -I https://myzubster.com
tail -20 /var/log/nginx/error.log

5.3 – Monero RPC not responding
bash

ps aux | grep monero-wallet-rpc
curl -X POST http://localhost:18083/json_rpc -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":"0","method":"get_balance"}'

5.4 – Tari not responding
bash

ps aux | grep minotari
curl -X POST http://localhost:12820/json_rpc -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":"0","method":"get_balance"}'

5.5 – Ports in use
bash

netstat -tlnp | grep -E ":80|:443|:3000|:18083|:12820"
lsof -i :80

πŸ“Š 6. Log Files (Locations)
Service Log File
Gateway journalctl -u myzubster-gateway
Nginx /var/log/nginx/error.log, /var/log/nginx/access.log
Monero Node ~/monero/monerod.log (or journalctl -u monerod)
Monero Wallet RPC ~/monero/monero-wallet-rpc.log
Tari Node ~/tari_node.log
Tari Wallet ~/tari_wallet.log
Security Bot /var/log/security_bot.log
MongoDB /var/log/mongodb/mongod.log
🧩 7. Frontend Structure (React/Vite)
text

src/
β”œβ”€β”€ pages/
β”‚ β”œβ”€β”€ Login.jsx
β”‚ β”œβ”€β”€ Register.jsx
β”‚ β”œβ”€β”€ Dashboard.jsx
β”‚ └── Marketplace.jsx
β”œβ”€β”€ components/
β”‚ └── ProtectedRoute.jsx
β”œβ”€β”€ contexts/
β”‚ └── AuthContext.jsx
β”œβ”€β”€ utils/
β”‚ └── axiosConfig.js
└── App.jsx

πŸ” 8. Environment Variables (.env)
env

PORT=3000
MONGODB_URI=mongodb://localhost:27017/myzubster
JWT_SECRET=supersecretkey
MONERO_WALLET_RPC_URL=http://localhost:18083/json_rpc
MONERO_DAEMON_RPC_URL=http://localhost:18081/json_rpc
MONERO_NETWORK=stagenet
TARI_RPC_URL=http://localhost:12810/json_rpc
TARI_WALLET_RPC=http://localhost:12820/json_rpc
TARI_NETWORK=testnet
FRONTEND_URL=https://myzubster.com

πŸš€ 9. Roadmap (Next Steps)
Priority Task Status
High Test marketplace from browser πŸ”΄ To do
High Test Monero payment (end‑to‑end) πŸ”΄ To do
High Verify security bot (cron job) πŸ”΄ To do
Medium Migrate Tor onion service to new VPS 🟑 In progress
Medium Integrate NFTs into marketplace 🟑 To do
Low Admin Dashboard 🟒 Future
πŸ’¬ 10. AI Response Format

When responding using this guide, the AI must:

Reference the section.

Provide the exact command/code.

Suggest the next logical step.

Ask the user for confirmation.
Enter fullscreen mode Exit fullscreen mode

Example AI response:
text

πŸ“Œ Section 4.1 – Gateway Management

πŸ’» Command: systemctl restart myzubster-gateway

πŸ”§ Next Step: After restart, run:
curl http://localhost:3000/api/health

πŸ€” Question: Would you like to proceed with testing the marketplace?

This guide is a living document. The AI should update it with new findings, commands, and configurations as the project evolves.

Top comments (1)

Collapse
 
topstar_ai profile image
Luis Cruz

The use of MongoDB models, such as the Token and TokenHolding models, provides a clear structure for managing token-related data, and the inclusion of fields like reputationScore in the User model suggests a robust system for evaluating user trustworthiness. I appreciate the implementation of the createPayment function in the Monero Service, which creates a new subaddress for each order and saves the transaction details. However, I'd like to discuss the potential benefits of adding additional error handling mechanisms to the checkPayment function to account for scenarios where the transaction is not found or the RPC request fails. What considerations were taken into account when designing the dispute resolution mechanism in the Escrow Service, particularly with regards to the use of AI-driven decision making?