Skip to content

Register

To use the Darkfibre API, you need an API key. Registration is free and takes about 30 seconds.

  1. Go to darkfibre.dev/register
  2. Select Phantom and approve the connection
  3. Sign the verification message when prompted (this proves you own the wallet)
  4. Copy your API key

Open your .env file and add your API key:

.env
DARKFIBRE_API_KEY=api_your_actual_key_here
SOLANA_PRIVATE_KEY=your_private_key_here

Replace api_your_actual_key_here with the key you just received.

If you haven’t already, add your Solana private key (exported from Phantom in the Wallet & SOL step).

Create a quick test to verify everything is configured correctly. Add this to src/index.ts:

import 'dotenv/config';
console.log('API Key loaded:', process.env.DARKFIBRE_API_KEY ? 'Yes' : 'No');
console.log('Private Key loaded:', process.env.SOLANA_PRIVATE_KEY ? 'Yes' : 'No');

Run it:

Terminal window
tsx index.ts

You should see:

API Key loaded: Yes
Private Key loaded: Yes

If either shows “No”, check that your .env file is in the project root and has the correct variable names.


Next: Execute your first trade