### Steps 1. **Initialize a new Node.js project** (if you don't have one already): ```sh mkdir solana-key-import cd solana-key-import npm init -y ``` 2. **Install required packages**: ```sh npm install @solana/web3.js bs58 ``` 3. **Create a script to import the private key**: Create a file named `importKey.js` and add the following code: ```javascript const bs58 = require('bs58'); const { Keypair } = require('@solana/web3.js'); const privateKey = '4YFq9y5f5hi77Bq8kDCE6VgqoAqKGSQN87yW9YeGybpNfqKUG4WxnwhboHGUeXjY7g8262mhL1kCCM9yy8uGvdj7'; const keypairData = Keypair.fromSeed(Uint8Array.from(bs58.default.decode(privateKey).slice(0, 32))); console.log('Public Key:', keypairData.publicKey.toString()); console.log('Secret Key:', keypairData.secretKey.toString()); ``` 4. **Run the script**: ```sh node importKey.js ``` 5. **Export the private key for use with Solana CLI**: The Solana CLI expects the private key in a JSON file. You can generate this file by modifying your script slightly to save the secret key: Update `importKey.js`: ```javascript const fs = require('fs'); const bs58 = require('bs58'); const { Keypair } = require('@solana/web3.js'); const privateKey = '4YFq9y5f5hi77Bq8kDCE6VgqoAqKGSQN87yW9YeGybpNfqKUG4WxnwhboHGUeXjY7g8262mhL1kCCM9yy8uGvdj7'; const keypairData = Keypair.fromSeed(Uint8Array.from(bs58.default.decode(privateKey).slice(0, 32))); const secretKey = `[${keypairData.secretKey.toString()}]`; fs.writeFileSync('keypair.json', secretKey); console.log('Public Key:', keypairData.publicKey.toString()); console.log('Secret Key saved to keypair.json'); ``` Run the script again: ```sh node importKey.js ``` This will create a file named `keypair.json` with your secret key. 6. **Import the keypair into Solana CLI**: Use the Solana CLI to set the keypair: ```sh solana config set --keypair ./keypair.json ``` Now your Solana CLI is configured to use the imported keypair. ### Verification To verify that the keypair is correctly configured, you can run: ```sh solana address ``` This should display the public address of the imported keypair, which should match the one printed by your Node.js script.