ETH Seed Extraction

This web script checks multiple derivatives and highlights addresses with a transaction history. It requires a free api key from etherscan.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ethereum Private Key Derivation</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ethers/5.7.2/ethers.umd.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.container {
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.input-group {
margin-bottom: 10px;
}
.input-group label {
display: block;
margin-bottom: 5px;
}
.input-group textarea, .input-group input {
width: 100%;
padding: 10px;
box-sizing: border-box;
margin-bottom: 10px;
}
.input-group button {
padding: 10px 20px;
cursor: pointer;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
}
.input-group button:hover {
background-color: #0056b3;
}
.output {
margin-top: 20px;
padding: 10px;
background-color: #e9ecef;
border-radius: 5px;
}
.output pre {
white-space: pre-wrap;
word-wrap: break-word;
}
.highlight {
background-color: #d4edda;
padding: 5px;
border-radius: 5px;
}
</style>
</head>
<body>
<div class="container">
<div class="input-group">
<label for="seedPhrase">Enter your 12 or 24-word seed phrase:</label>
<textarea id="seedPhrase" placeholder="your seed phrase here"></textarea>
</div>
<div class="input-group">
<button onclick="derivePrivateKeys()">Derive Private Keys</button>
<button onclick="pauseDerivation()">Pause</button>
</div>
<div id="output" class="output"></div>
<div id="log" class="output"></div>
</div>
<script>
let pause = false;
async function derivePrivateKeys() {
pause = false;
const seedPhrase = document.getElementById('seedPhrase').value.trim();
const wordCount = seedPhrase.split(' ').length;
const apiKey = 'Etherscan_API_Key'; // Replace with your Etherscan API key
const coinType = 60; // Ethereum
if (wordCount !== 12 && wordCount !== 24) {
document.getElementById('output').innerText = 'Please enter a valid 12 or 24-word seed phrase.';
return;
}
try {
const keys = [];
const checkedAddresses = [];
const providerUrl = `https://api.etherscan.io/api?module=account&action=balance&tag=latest&apikey=${apiKey}`;
const txCountUrl = `https://api.etherscan.io/api?module=account&action=txlist&sort=asc&apikey=${apiKey}`;
const commonPaths = [
`m/44'/${coinType}'/0'/0/0`,
`m/44'/${coinType}'/0'/0/1`,
`m/44'/${coinType}'/0'/0/2`,
`m/44'/${coinType}'/0'/0/3`,
`m/44'/${coinType}'/0'/0/4`,
`m/44'/${coinType}'/0'/0/5`,
`m/44'/${coinType}'/0'`,
`m/44'/${coinType}'/1'`,
`m/44'/${coinType}'/0'/0`,
`m/44'/${coinType}'/0'/0/0`,
`m/44'/${coinType}'/0'/1`,
`m/44'/${coinType}'/0'/2`,
`m/44'/${coinType}'/0'/3`,
`m/44'/${coinType}'/0'/4`
];
for (let i = 0; i < commonPaths.length && !pause; i++) {
const wallet = ethers.Wallet.fromMnemonic(seedPhrase, commonPaths[i]);
const response = await fetch(`${providerUrl}&address=${wallet.address}`);
const data = await response.json();
const balanceInEth = ethers.utils.formatEther(data.result);
const txResponse = await fetch(`${txCountUrl}&address=${wallet.address}`);
const txData = await txResponse.json();
const hasTransactions = txData.result && txData.result.length > 0;
const addressInfo = `Address ${i + 1}: ${wallet.address} (Balance: ${balanceInEth} ETH) - Path: ${commonPaths[i]}`;
const privateKeyInfo = `Private Key ${i + 1}: ${wallet.privateKey}`;
keys.push(`${addressInfo}\n${privateKeyInfo}\n`);
checkedAddresses.push(`<div class="${hasTransactions ? 'highlight' : ''}">Checked Address ${i + 1}: ${wallet.address} (Balance: ${balanceInEth} ETH) - Path: ${commonPaths[i]}</div>`);
document.getElementById('log').innerHTML += checkedAddresses[checkedAddresses.length - 1] + '\n';
if (parseFloat(balanceInEth) > 0) {
break; // Stop if an address with a balance is found
}
}
document.getElementById('output').innerHTML = '<pre>' + keys.join('\n') + '</pre>';
} catch (error) {
document.getElementById('output').innerText = 'Error deriving private keys: ' + error.message;
}
}
function pauseDerivation() {
pause = true;
}
</script>
</body>
</html>