Skip to content

brahim-cherifi/vega-tron-wallet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transaction Management Dashboard

A web-based dashboard for managing cryptocurrency transaction requests. Users can submit transactions through the mobile app, and you can approve/reject them through this dashboard.

Features

  • Real-time Transaction Management: View all pending, confirmed, and failed transactions
  • Status Updates: Change transaction status from pending to confirmed or failed
  • Transaction Hash: Add blockchain transaction hash when confirming
  • Statistics: View total, pending, confirmed, and failed transaction counts
  • Filtering: Filter transactions by status
  • Test Interface: Submit test transactions directly from the dashboard

Setup

1. Install Dependencies

cd web_dashboard
npm install

2. Start the Server

npm start

The dashboard will be available at: http://localhost:3000

3. Access the Dashboard

Open your browser and navigate to http://localhost:3000

How It Works

For Transaction Requesters (Mobile App Users)

  1. Users submit transaction requests through the mobile app
  2. Transactions appear in the dashboard with "Pending" status
  3. Users wait for approval/rejection
  4. Once approved, they receive the transaction hash

For Admin (Dashboard User)

  1. View all incoming transaction requests
  2. Review transaction details (from, to, amount, token)
  3. For each pending transaction:
    • Confirm: Enter the blockchain transaction hash and mark as confirmed
    • Fail: Mark the transaction as failed

API Endpoints

The server provides these endpoints for mobile app integration:

  • GET /api/transactions - Get all transactions
  • GET /api/transactions/pending - Get pending transactions
  • POST /api/transactions/submit - Submit new transaction
  • GET /api/transactions/:id/status - Check transaction status
  • POST /api/transactions/:id/cancel - Cancel a transaction

Mobile App Integration

Update your Flutter app's .env file:

WEB_SERVER_BASE_URL=http://YOUR_SERVER_IP:3000/api

Replace YOUR_SERVER_IP with:

  • localhost for emulator
  • Your computer's IP address for physical device (e.g., 192.168.56.1)

Testing

  1. Use the "Submit Test Transaction" form on the dashboard
  2. Enter test addresses and amounts
  3. Click "Submit Transaction"
  4. The transaction will appear in the pending list
  5. Enter a test hash and confirm, or mark as failed

Transaction Flow

Mobile App          Dashboard           Blockchain
    |                   |                    |
    |-- Submit Tx ----->|                    |
    |                   |                    |
    |<-- Pending -------|                    |
    |                   |                    |
    |   (waiting...)    |-- Manual Tx ------>|
    |                   |                    |
    |                   |<-- Tx Hash ---------|
    |                   |                    |
    |<-- Confirmed -----|                    |
    |    + Hash        |                    |

Security Notes

⚠️ For Production Use:

  1. Add authentication to the dashboard
  2. Use HTTPS instead of HTTP
  3. Implement rate limiting
  4. Use a proper database (PostgreSQL, MongoDB)
  5. Add input validation and sanitization
  6. Implement webhook notifications
  7. Add transaction signing verification

Customization

Change Port

Edit server.js:

const PORT = process.env.PORT || 3000; // Change 3000 to your desired port

Add Authentication

Example with basic auth:

app.use((req, res, next) => {
    const auth = req.headers.authorization;
    if (!auth || auth !== 'Bearer YOUR_SECRET_TOKEN') {
        return res.status(401).json({ error: 'Unauthorized' });
    }
    next();
});

Database Integration

Replace in-memory storage with MongoDB:

const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/transactions');

const Transaction = mongoose.model('Transaction', {
    from: String,
    to: String,
    amount: Number,
    tokenType: String,
    status: String,
    hash: String,
    timestamp: Date
});

Deployment

Deploy to Heroku

  1. Create a Heroku app
  2. Add this to package.json:
    "engines": {
      "node": "18.x"
    }
  3. Deploy:
    git init
    heroku create your-app-name
    git add .
    git commit -m "Initial commit"
    git push heroku main

Deploy to VPS

  1. Install Node.js on your server
  2. Clone the repository
  3. Install PM2: npm install -g pm2
  4. Start with PM2: pm2 start server.js
  5. Setup Nginx reverse proxy

Support

For issues or questions, please check the main project repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published