Skip to content

Code Examples

Complete examples using the official @darkfibre/sdk npm package.

View all examples on GitHub

  • Node.js 20+
  • Darkfibre API key (register here)
  • Solana wallet private key (base58)
ExampleDescription
Quick StartMinimal buy example in under 30 lines
Buy + SellComplete round-trip with error handling
Sniping BotWebSocket listener for new token launches
Terminal window
git clone https://github.com/darkfibre-dev/darkfibre-examples.git
cd darkfibre-examples

Each example is self-contained with its own package.json. Pick one and run:

Terminal window
cd 01-quick-start # or 02-buy-sell, 03-sniping-bot
npm install
cp .env.example .env
# Edit .env with your credentials
npm start

All examples use the same environment variables:

VariableDescription
DARKFIBRE_API_KEYYour Darkfibre API key
SOLANA_PRIVATE_KEYYour wallet private key (base58)

Your private key is used only locally for signing transactions - it is never sent to the API.