Skip to main content
Glama
derive-address.js2.21 kB
#!/usr/bin/env node /** * Derive the public address from the session key private key */ import dotenv from 'dotenv'; import { Wallet } from 'ethers'; dotenv.config(); const DERIVE_WALLET = process.env.DERIVE_WALLET || ""; const DERIVE_PRIVATE_KEY = process.env.DERIVE_PRIVATE_KEY || ""; console.log("🔑 Session Key Address Derivation\n"); console.log("=".repeat(70)); console.log("\n📋 Your Configuration:"); console.log(` Main Wallet: ${DERIVE_WALLET}`); if (!DERIVE_PRIVATE_KEY) { console.error(" ❌ DERIVE_PRIVATE_KEY not set in .env"); process.exit(1); } try { // Derive the address from the private key const wallet = new Wallet(DERIVE_PRIVATE_KEY); const sessionKeyAddress = wallet.address; console.log(` Session Key Private Key: ${DERIVE_PRIVATE_KEY.substring(0, 10)}...${DERIVE_PRIVATE_KEY.substring(DERIVE_PRIVATE_KEY.length - 6)}`); console.log(` Session Key Address: ${sessionKeyAddress}`); console.log("\n" + "=".repeat(70)); console.log("\n✅ IMPORTANT - Register This Address on Derive:\n"); console.log(` ${sessionKeyAddress}`); console.log("\n" + "=".repeat(70)); console.log("\n📝 Steps to Register:\n"); console.log(" 1. Go to: https://app.derive.xyz"); console.log(" 2. Connect with your MAIN wallet: " + DERIVE_WALLET); console.log(" 3. Navigate to: Settings → Developers → Session Keys"); console.log(" 4. Click: 'Register New Session Key'"); console.log(" 5. Enter this address: " + sessionKeyAddress); console.log(" 6. Choose permission: 'admin' (for trading) or 'read-only'"); console.log(" 7. Sign the transaction with your MAIN wallet"); console.log(" 8. Wait for transaction to confirm (check Etherscan)"); console.log(" 9. Run: node test-credentials.js"); console.log("\n💡 Note:"); console.log(" • The session key address is DIFFERENT from your main wallet"); console.log(" • You're registering: " + sessionKeyAddress); console.log(" • NOT registering: " + DERIVE_WALLET); } catch (error) { console.error("\n❌ Error deriving address:", error.message); console.error(" Check that DERIVE_PRIVATE_KEY is a valid 64-character hex string"); process.exit(1); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/solenyaresearch0000/derive-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server