From 8a42ee0177b2453f5762caacdf2760a1837154c3 Mon Sep 17 00:00:00 2001 From: st4rgard3n Date: Fri, 29 Nov 2024 16:47:11 +0700 Subject: [PATCH] Simple key derivation without TEE --- scripts/derive-keys.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/derive-keys.js diff --git a/scripts/derive-keys.js b/scripts/derive-keys.js new file mode 100644 index 0000000000..26ae53ffdf --- /dev/null +++ b/scripts/derive-keys.js @@ -0,0 +1,19 @@ +const { ethers } = require('ethers'); +require('dotenv').config(); + +// Get and validate the private key +const privateKey = process.env.EVM_PRIVATE_KEY; +if (!privateKey) { + throw new Error('EVM_PRIVATE_KEY is not set in environment variables'); +} + +// Ensure the private key has the correct format +const formattedPrivateKey = privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`; + +// Create a wallet instance +const wallet = new ethers.Wallet(formattedPrivateKey); + +console.log('\nWallet Information:'); +console.log('------------------'); +console.log('Public Key:', wallet.signingKey.publicKey); +console.log('Wallet Address:', wallet.address); \ No newline at end of file