Server IP : 103.6.199.200 / Your IP : 3.147.51.75 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 : |
<!DOCTYPE html> <html> <head> <title>TronWeb Account Generator</title> </head> <body> <h1>TronWeb Account Generator</h1> <form id="accountForm"> <label for="accountType">Account Type:</label> <select id="accountType" name="accountType"> <option value="createAccount">Create Account</option> <option value="createRandom">Create Random Account</option> <option value="fromMnemonic">From Mnemonic</option> </select> <div id="mnemonicContainer" style="display: none;"> <label for="mnemonic">Mnemonic:</label> <input type="text" id="mnemonic" name="mnemonic" placeholder="Enter mnemonic" /> </div> <div id="pathContainer" style="display: none;"> <label for="path">Path:</label> <input type="text" id="path" name="path" placeholder="Enter path" /> </div> <button type="submit">Generate Account</button> </form> <div id="resultContainer" style="display: none;"> <h2>Generated Account</h2> <div id="accountInfo"></div> </div> <h2>Tron Multisig Wallet Generator</h2> <form id="multisigForm"> <label for="threshold">Threshold (Number of Signatories Required):</label> <input type="number" id="threshold" required min="1" max="10"><br> <label for="account1">Signatory Account 1:</label> <input type="text" id="account1" required><br> <button type="button" onclick="generateMultisigWallet()">Generate Multisig Wallet</button> </form> <div id="result"></div> <script> async function generateMultisigWallet() { // Get input values const threshold = document.getElementById("threshold").value; const account1 = document.getElementById("account1").value; // Validate input if needed try { // Create Tronlink instance const tronlink = window.tronlink; // Ensure Tronlink is installed and accessible if (!tronlink || !tronlink.ready) { throw new Error("Tronlink not found or not ready. Please install and unlock Tronlink extension."); } // Create multisig account const multisigAddress = await tronlink.request( "wallet/createMultisigAccount", { threshold: threshold, keys: [account1], } ); // Display the result document.getElementById("result").innerHTML = `Multisig Wallet Address: ${multisigAddress}`; } catch (error) { console.error(error); alert("Error: " + error.message); } } </script> <script> const accountForm = document.getElementById('accountForm'); const accountType = document.getElementById('accountType'); const mnemonicContainer = document.getElementById('mnemonicContainer'); const pathContainer = document.getElementById('pathContainer'); const resultContainer = document.getElementById('resultContainer'); const accountInfo = document.getElementById('accountInfo'); // Show/hide mnemonic and path inputs based on selected account type accountType.addEventListener('change', () => { if (accountType.value === 'fromMnemonic') { mnemonicContainer.style.display = 'block'; pathContainer.style.display = 'block'; } else { mnemonicContainer.style.display = 'none'; pathContainer.style.display = 'none'; } }); accountForm.addEventListener('submit', async (event) => { event.preventDefault(); const formData = new FormData(accountForm); const selectedAccountType = formData.get('accountType'); try { const response = await fetch('/generateAccount', { method: 'POST', body: new URLSearchParams(formData) }); const data = await response.json(); if (data.success) { accountInfo.innerHTML = JSON.stringify(data.accountInfo, null, 2); resultContainer.style.display = 'block'; } else { console.error(data.error); } } catch (error) { console.error(error); } }); </script> <script src="https://cdn.jsdelivr.net/npm/tronweb@2.2.7/dist/TronWeb.js"></script> <script> // Define your TronWeb configuration const fullNode = 'https://api.trongrid.io'; const solidityNode = 'https://api.trongrid.io'; const eventServer = 'https://api.trongrid.io'; const tronWeb = new TronWeb(fullNode, solidityNode, eventServer); // Function to generate a TRON account function generateAccount() { const privateKey = TronWeb.utils.crypto.randomBytes(32); const publicKey = TronWeb.address.fromPrivateKey(privateKey); const address = TronWeb.address.fromHex(publicKey); return { privateKey, publicKey, address }; } // Function to generate the multisig account function generateMultisig() { // Generate three individual accounts const account1 = generateAccount(); const account2 = generateAccount(); const account3 = generateAccount(); console.log('Account 1:', account1.address); console.log('Account 2:', account2.address); console.log('Account 3:', account3.address); // Combine public keys for multisig account (2-of-3) const multisigPublicKey = TronWeb.utils.crypto.combinePublicKeys([ account1.publicKey, account2.publicKey, account3.publicKey, ]); console.log('Multisig Public Key:', multisigPublicKey); // Deploy the multisig account (simplified for demonstration) async function deployMultisigAccount() { try { const multisigAccount = await tronWeb.createAccount(); // Create a new multisig account const multisigAddress = multisigAccount.address.base58; // Send a transaction to create the multisig account (simplified, should be properly implemented) const transaction = await tronWeb.transactionBuilder.createAccount( multisigAddress, 1000000, // Initial TRX balance for the account multisigPublicKey ); const signedTransaction = await tronWeb.trx.sign( transaction, account1.privateKey ); const result = await tronWeb.trx.sendRawTransaction(signedTransaction); console.log('Multisig Account Created:', multisigAddress); // Display the generated multisig account information document.getElementById('multisigPublicKey').textContent = multisigPublicKey; document.getElementById('multisigAddress').textContent = multisigAddress; document.getElementById('output').style.display = 'block'; } catch (error) { console.error('Error creating multisig account:', error); } } // Deploy the multisig account deployMultisigAccount(); } </script> </body> </html>