Server IP : 103.6.199.200 / Your IP : 18.116.52.43 Web Server : Microsoft-IIS/10.0 System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586 User : EMPUSA$ ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Domains/tradepan/applefile/ |
Upload File : |
const express = require('express'); const app = express(); const bodyParser = require('body-parser'); const TronWeb = require('tronweb'); // Configure TronWeb const fullNode = 'https://api.trongrid.io'; // Replace with your preferred full node URL const solidityNode = 'https://api.trongrid.io'; // Replace with your preferred solidity node URL const eventServer = 'https://api.trongrid.io'; // Replace with your preferred event server URL const privateKey = '7bb4184520643408461bd38889fbe236a63c3ebe263593b0d991d43324acc98b'; // Replace with your private key const tronWeb = new TronWeb(fullNode, solidityNode, eventServer, privateKey); // Middleware app.use(bodyParser.urlencoded({ extended: false })); app.use(express.static('public')); // Routes app.get('/', (req, res) => { res.sendFile(__dirname + '/index.html'); }); app.post('/generateAccount', async (req, res) => { const { accountType, mnemonic, path } = req.body; try { let accountInfo; if (accountType === 'createAccount') { accountInfo = await tronWeb.createAccount(); } else if (accountType === 'createRandom') { accountInfo = await tronWeb.createRandom(); } else if (accountType === 'fromMnemonic') { accountInfo = await tronWeb.fromMnemonic(mnemonic, path); } res.json({ success: true, accountInfo }); } catch (error) { res.json({ success: false, error: error.message }); } }); // Start the server const port = 3000; // Replace with your desired port number app.listen(port, () => { console.log(`Server running on port ${port}`); });