| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A collection of Rust examples, SDKs, and tools for building high-performance Solana trading bots. Includes trading examples, SDKs for DEX integration, transaction parsing, key management, and real-time streaming.
中文 | English | Website | Telegram | Discord
☕ Support This Project
This SDK is completely free and open source. However, maintaining and continuously updating it requires significant AI computing resources and token consumption. If this SDK helps with your development, consider making a monthly SOL donation — any amount is appreciated and helps keep this project alive!
Donation Wallet: 6oW7AXz1yRb57pYSxysuXnMs2aR1ha5rzGzReZ1MjPV8
fnzero-examples is a hands-on example collection for building Solana trading bots with the FnZero SDK ecosystem. It focuses on runnable Rust examples for PumpFun bonding-curve trading, PumpSwap AMM trading, encrypted keystore flows, Yellowstone gRPC monitoring, ShredStream monitoring, SWQoS submit lanes, and durable nonce setup.
| Area | Coverage |
|---|---|
| Trading examples | PumpFun buy/sell loops, PumpSwap buy/sell loops, encrypted-keystore variants |
| Sniper examples | PumpFun creator-first-buy monitoring through Yellowstone gRPC or Jito ShredStream |
| SDKs used | sol-trade-sdk, sol-parser-sdk, and sol-safekey |
| Target users | Solana bot developers, copy-trading builders, DEX integrators, and operators testing FnZero SDK workflows |
fnzero-examples/ ├── pumpswap_trade/ # PumpSwap (outer pool) trading example (direct private key) ├── pumpswap_trade_with_safekey/ # PumpSwap (outer pool) trading example (encrypted keystore) ├── pumpfun_trade/ # PumpFun (bonding curve) trading example (direct private key) ├── pumpfun_trade_with_safekey/ # PumpFun (bonding curve) trading example (encrypted keystore) ├── pumpfun_grpc_sniper/ # PumpFun gRPC sniper example (direct private key) └── pumpfun_shredstream_sniper/ # PumpFun ShredStream sniper example (direct private key)
sol-safekey is resolved from crates.io by the encrypted-keystore examples; no sibling checkout is required. Local SDK checkouts remain ignored by .gitignore for optional development work.
| Example | Description | Run Command | Source Code |
|---|---|---|---|
| PumpSwap Trading | Automated buy→wait→sell loop on PumpSwap (outer AMM); configurable rounds and rest | ./run.sh | pumpswap_trade |
| PumpSwap Trading (Encrypted) | Same as above with encrypted keystore | ./run.sh | pumpswap_trade_with_safekey |
| PumpFun Trading | Buy→wait→sell on PumpFun bonding curve; token must not have graduated to PumpSwap | ./run.sh | pumpfun_trade |
| PumpFun Trading (Encrypted) | Same as above; keystore / KEYPAIR_BASE58 | ./run.sh | pumpfun_trade_with_safekey |
| PumpFun gRPC Sniper | Monitor creator first buys through sol-parser-sdk gRPC, buy once, auto-sell after 3s | ./run.sh | pumpfun_grpc_sniper |
| PumpFun ShredStream Sniper | Monitor creator first buys through sol-parser-sdk ShredStream, buy once, auto-sell after 3s | ./run.sh | pumpfun_shredstream_sniper |
Safekey compatibility: both *_with_safekey crates use sol-safekey 0.1.8, sol-trade-sdk 4.0.22, and the same high-level Simple*Params trade API as the direct-key examples. Cargo downloads the library automatically.
| Scenario | Directory |
|---|---|
| Token still on PumpFun bonding curve (not graduated to PumpSwap) | pumpfun_trade or pumpfun_trade_with_safekey |
| Token on PumpSwap outer AMM | pumpswap_trade or pumpswap_trade_with_safekey |
| Private key via PRIVATE_KEY or private_key in YAML | pumpfun_trade / pumpswap_trade |
| Encrypted keystore + password (or fallback KEYPAIR_BASE58) | pumpfun_trade_with_safekey / pumpswap_trade_with_safekey |
| Snipe new PumpFun tokens from a gRPC trade stream | pumpfun_grpc_sniper |
| Snipe new PumpFun tokens from ShredStream outer instructions | pumpfun_shredstream_sniper |
See the low-latency bot development guide for architecture, trade intents, state freshness, SWQoS, and bounded requoting.
| Example | Chinese | English |
|---|---|---|
| PumpSwap (private key) | README_CN.md | README.md |
| PumpSwap (encrypted) | README_CN.md | README.md |
| PumpFun (private key) | README_CN.md | README.md |
| PumpFun (encrypted) | README_CN.md | README.md |
| PumpFun gRPC sniper | README_CN.md | README.md |
| PumpFun ShredStream sniper | README_CN.md | README.md |
| Service | Transport Protocols |
|---|---|
| Astralane | HTTP, QUIC ⚡ |
| BlockRazor | HTTP, gRPC |
| Bloxroute | HTTP |
| FlashBlock | HTTP |
| Jito | HTTP |
| NextBlock | HTTP |
| Node1 | HTTP, QUIC ⚡ |
| Soyas | QUIC ⚡ |
| Speedlanding | QUIC ⚡ |
| Stellium | HTTP |
| Temporal | HTTP |
| ZeroSlot | HTTP |
| Default | RPC |
API Key Application: Apply for API keys through the official website: https://fnzero.dev/swqos
Note: ⚡ = QUIC (Quick UDP Internet Connections) provides lower latency compared to HTTP/gRPC. Services using QUIC (Astralane, Node1, Soyas, Speedlanding) typically offer the best transaction submission performance.
Comprehensive Rust SDK for Solana DEX trading with unified interface for multiple protocols.
Features:
Repository: 0xfnzero/sol-trade-sdk
Transaction parsing SDK with gRPC streaming support for real-time event processing.
Features:
Repository: 0xfnzero/sol-parser-sdk
Encrypted key management library for secure Solana keypair storage.
Features:
Repository: 0xfnzero/sol-safekey
Utilities for Solana transaction streaming and real-time data processing.
Features:
Repository: 0xfnzero/solana-streamer
Do this before running any trading example for the first time. This repository does not ship your private keys, SWQoS API tokens, or production RPC URLs—only *.yaml.example and .env.example templates.
git clone https://github.com/0xfnzero/fnzero-examples.git
cd fnzero-examplescd into the example you need (pumpswap_trade, pumpfun_trade, etc.) and copy templates per environment:
cd pumpswap_trade # or pumpfun_trade / *_with_safekey
cp .env.example .env
cp config/dev/solana.yaml.example config/dev/solana.yaml
cp config/dev/trading.yaml.example config/dev/trading.yaml
# For prod, also copy config/prod/*.example → config/prod/*.yamlpumpfun_grpc_sniper and pumpfun_shredstream_sniper only use .env, no YAML:
cd pumpfun_grpc_sniper # or pumpfun_shredstream_sniper
cp .env.example .envThen edit locally (do not commit; sniper examples only need .env):
| File | What to fill in |
|---|---|
| .env | PRIVATE_KEY or KEYSTORE_PASSWORD, SOLANA_RPC_URL, NONCE_ACCOUNT (if multi-SWQoS), … |
| config/*/solana.yaml | rpc_url, private_key or keystore_path, SWQoS api_token, nonce_config, … |
| config/*/trading.yaml | Buy size, slippage, gas, … |
APP_ENV=dev uses config/dev/, APP_ENV=prod uses config/prod/.
The encrypted examples obtain the sol-safekey library from crates.io automatically. Install the CLI only when you need to create or manage keystore.json:
cargo install sol-safekey --version 0.1.8 --features full --locked
sol-safekey startIn the menu, choose Create encrypted key, then Import existing private key, and save it to /path/to/fnzero-examples/pumpswap_trade_with_safekey/keystore.json.
Then set keystore_path in the example’s solana.yaml (e.g. ./keystore.json).
These paths are ignored by .gitignore—do not force-add them:
Run git status before pushing. If secrets were ever committed, rotate keys and scrub history.
Run commands inside the example crate directory (each folder is its own Cargo package; there is no repo-root workspace). If you have not completed the steps above, copy templates and edit them first.
Option 1: Private key (PumpSwap or PumpFun)
cd pumpswap_trade # outer AMM; use cd pumpfun_trade for bonding-curve tokens
cp .env.example .env
cp config/dev/solana.yaml.example config/dev/solana.yaml
cp config/dev/trading.yaml.example config/dev/trading.yaml
# Edit .env and yaml: PRIVATE_KEY, RPC, SWQoS tokens, nonce, … (see “Before you run”)
./run.sh <TOKEN_MINT_ADDRESS>
# or: cargo run --release -- <TOKEN_MINT_ADDRESS>Option 2: Encrypted keystore (the example library dependency is downloaded automatically; install the CLI to generate a keystore)
cargo install sol-safekey --version 0.1.8 --features full --locked
sol-safekey start
cd /path/to/fnzero-examples/pumpswap_trade_with_safekey # or pumpfun_trade_with_safekey
cp .env.example .env
cp config/dev/solana.yaml.example config/dev/solana.yaml
cp config/dev/trading.yaml.example config/dev/trading.yaml
# Edit solana.yaml: keystore_path, SWQoS, nonce, …
./run.sh <TOKEN_MINT_ADDRESS>When running sol-safekey start, choose Create encrypted key → Import existing private key → Save as Keystore file, then enter the target example's keystore.json path.
# Environment: dev or prod
APP_ENV=dev
# Token mint address to trade
MINT=your_token_mint_address
# Sol amount to buy (SOL)
BUY_SOL_AMOUNT=0.01
# RPC URL
SOLANA_RPC_URL=https://your-rpc-endpoint.com
# Keystore password (for encrypted key)
KEYSTORE_PASSWORD=your_password
# Durable nonce account (required for multiple SWQoS)
NONCE_ACCOUNT=your_nonce_account_addressswqos:
region: "Frankfurt" # or NewYork, Tokyo, etc.
enabled_providers:
- provider: "Astralane"
api_token: "your_token"
enabled: true
- provider: "BlockRazor"
api_token: "your_token"
enabled: true
# Add more providers as neededEach example uses .cargo/config.toml so artifacts go to build-cache/release/ (not the default target/release/).
cd pumpswap_trade # or pumpfun_trade, pumpswap_trade_with_safekey, pumpfun_trade_with_safekey
cargo build --release
./build-cache/release/pumpswap_trade_with_safekey <TOKEN_MINT_ADDRESS>
# macOS → Linux bundle (requires x86_64-unknown-linux-gnu toolchain)
./build-linux-release.sh # produces linux-release/deploy.tar.gzMIT License
The repository currently declares MIT licensing; consult the upstream repository metadata for the authoritative license notice.
Contributions are welcome! Please feel free to submit a Pull Request.
| Back | FazBrowse Home | New Git URL |