Wallet Import
let privateKey;
try {
const wallet = ec.keyFromPrivate(privateKey); // Initialize wallet with the private key
const address = wallet.getPublic().getX().toString(16); // Derive the address
const fullAddress = wallet.getPublic('hex'); // Get the full address in hexadecimal
// Verify if the address starts with 'f'
if (!address.startsWith('f')) {
return res.status(400).json({ error: 'Incompatible wallet address, please check the private key and try again' });
}
} catch (error) {
res.status(500).json({ error: 'Error importing wallet' });
}Last updated