Create a toolbox app for crypto beginner. All in one single html
- User
Create a toolbox app for crypto beginner. All in one single html
- Assistant
Below is an example of a single-file HTML "Crypto Toolbox" app for beginners. This self-contained page provides three mini-tools:
-
Price Checker & Converter:
Choose a cryptocurrency (Bitcoin, Ethereum, or Litecoin), fetch its latest USD price using the CoinGecko API, and convert a specified amount to its USD value. -
Mnemonic Generator:
Generate a 12-word mnemonic using a sample list of words (for illustrative purposes only). -
Crypto Glossary:
Click on a term (Bitcoin, Blockchain, Wallet, ICO) to toggle a brief definition.
Simply copy the code into an HTML file (e.g.,
crypto_toolbox.html) on your computer and open it in your browser.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Crypto Toolbox for Beginners</title> <style> body { font-family: Arial, sans-serif; margin: 30px; background: #f9f9f9; color: #333; } h1, h2 { color: #2c3e50; } section { background: #fff; padding: 20px; margin-bottom: 20px; border-radius: 8px; box-shadow: 0 0 8px rgba(0,0,0,0.1); } label { display: inline-block; margin-bottom: 10px; } button { cursor: pointer; padding: 6px 12px; background: #3498db; border: none; color: #fff; border-radius: 4px; margin-top: 5px; } button:hover { background: #2980b9; } input[type="number"] { padding: 4px; margin-left: 5px; width: 80px; } .glossaryItem { background: #8e44ad; margin: 5px 0; } .glossaryItem:hover { background: #732d91; } .definition { margin-left: 20px; font-style: italic; color: #555; } </style> </head> <body> <h1>Crypto Toolbox for Beginners</h1> <!-- Price Checker and Converter Section --> <section id="priceChecker"> <h2>1. Price Checker & Converter</h2> <label> Choose Cryptocurrency: <select id="cryptoSelect"> <option value="bitcoin">Bitcoin</option> <option value="ethereum">Ethereum</option> <option value="litecoin">Litecoin</option> </select> </label> <br> <button id="getPriceBtn">Get Latest Price</button> <p id="priceDisplay">Price: N/A</p> <br> <label> Amount: <input type="number" id="amountInput" step="any" value="1"> </label> <button id="convertBtn">Convert to USD</button> <p id="convertDisplay">Value in USD: N/A</p> </section> <!-- Mnemonic Generator Section --> <section id="mnemonicGenerator"> <h2>2. Mnemonic Generator</h2> <p> (Note: This generator uses a small sample word list. In production, use a proper BIP39 library.) </p> <button id="generateMnemonicBtn">Generate 12-Word Mnemonic</button> <p id="mnemonicDisplay" style="font-weight: bold;"></p> </section> <!-- Crypto Glossary Section --> <section id="cryptoGlossary"> <h2>3. Crypto Glossary</h2> <p>Click on a term to toggle its definition:</p> <div> <button class="glossaryItem" data-definition="A decentralized digital currency, without a central bank or single administrator.">Bitcoin</button> <p class="definition" style="display:none;"></p> </div> <div> <button class="glossaryItem" data-definition="The technology behind cryptocurrencies that allows data to be distributed but not copied.">Blockchain</button> <p class="definition" style="display:none;"></p> </div> <div> <button class="glossaryItem" data-definition="A tool (software or hardware) that stores your cryptocurrency keys and allows you to send/receive crypto.">Wallet</button> <p class="definition" style="display:none;"></p> </div> <div> <button class="glossaryItem" data-definition="ICO stands for Initial Coin Offering, a fundraising mechanism in which new projects sell their underlying crypto tokens.">ICO</button> <p class="definition" style="display:none;"></p> </div> </section> <script> // --- Price Checker & Converter --- document.getElementById('getPriceBtn').addEventListener('click', function() { var crypto = document.getElementById('cryptoSelect').value; var priceDisplay = document.getElementById('priceDisplay'); // Using CoinGecko's API to fetch price data. fetch('https://api.coingecko.com/api/v3/simple/price?ids=' + crypto + '&vs_currencies=usd') .then(response => response.json()) .then(data => { if (data[crypto] && data[crypto].usd) { var price = data[crypto].usd; priceDisplay.textContent = "Price: $" + price; // Save the fetched price for conversion document.getElementById('convertBtn').dataset.price = price; } else { priceDisplay.textContent = "Price information not available."; } }) .catch(error => { console.error('Error fetching price:', error); priceDisplay.textContent = "Error fetching price."; }); }); document.getElementById('convertBtn').addEventListener('click', function() { var price = parseFloat(document.getElementById('convertBtn').dataset.price); var amount = parseFloat(document.getElementById('amountInput').value); var convertDisplay = document.getElementById('convertDisplay'); if (!isNaN(price) && !isNaN(amount)) { var total = price * amount; convertDisplay.textContent = "Value in USD: $" + total.toFixed(2); } else { convertDisplay.textContent = "Please fetch the price and enter a valid amount."; } }); // --- Mnemonic Generator --- // Sample word list (not full BIP39). For production use a real library. var wordList = [ "abandon", "ability", "able", "about", "above", "absent", "absorb", "abstract", "absurd", "abuse", "access", "accident", "account", "accuse", "achieve", "acid", "acoustic", "acquire", "across", "act", "action", "actor", "actress", "actual", "adapt", "add", "addict", "address", "adjust", "admit", "adult", "advance", "advice", "aerobic", "affair", "afford", "afraid", "again", "age", "agent", "agree", "ahead", "aim", "air", "airport", "aisle", "alarm", "album" ]; document.getElementById('generateMnemonicBtn').addEventListener('click', function() { var mnemonic = []; for (var i = 0; i < 12; i++) { // Pick a random word from the word list var index = Math.floor(Math.random() * wordList.length); mnemonic.push(wordList[index]); } document.getElementById('mnemonicDisplay').textContent = mnemonic.join(" "); }); // --- Crypto Glossary --- var glossaryItems = document.querySelectorAll('.glossaryItem'); glossaryItems.forEach(function(item) { item.addEventListener('click', function() { var definition = this.dataset.definition; var defParagraph = this.nextElementSibling; // Toggle the display of the definition text if (defParagraph.style.display === "none" || defParagraph.style.display === "") { defParagraph.textContent = definition; defParagraph.style.display = "block"; } else { defParagraph.style.display = "none"; } }); }); </script> </body> </html>
How to Use
-
Price Checker & Converter:
- Select a cryptocurrency from the dropdown and click Get Latest Price to fetch its current USD price.
- Enter an amount and click Convert to USD to see its value in dollars.
-
Mnemonic Generator:
- Click Generate 12-Word Mnemonic to display a randomly generated mnemonic phrase (for demonstration only).
-
Crypto Glossary:
- Click on any glossary button (e.g., "Bitcoin") to toggle the display of its definition.
This toolbox provides a basic starting point for crypto beginners with interactive examples and can be expanded or improved further as needed. Enjoy exploring the world of cryptocurrency!
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.