Every time you trade on a public DEX, bots can see your transaction before it lands on-chain. They front-run you, sandwich you, and extract value from your trade. This is called MEV (Maximal Extractable Value) — and it costs Solana traders millions.
Bastion is a dark pool protocol — your orders are encrypted using Zero-Knowledge Proofs before they enter the mempool. Nobody can see what you're trading, how much, or in which direction. The proof guarantees the order is valid without revealing anything about it.
| Problem | Bastion's Solution |
|---|---|
| Sandwich attacks | Orders are encrypted — bots can't see your trade size or direction |
| Front-running | Commitment-based ordering hides intent until execution |
| Price impact on large orders | Dark pool matching keeps whale trades off the public orderbook |
| Privacy | ZK proofs verify solvency without revealing account details |
Install and launch the interactive terminal in two commands:
# Install the Bastion CLI
curl -fsSL https://raw.githubusercontent.com/krishnagoyal099/Bastion-solana/main/install-cli.sh | bash
# Launch the trading terminal
bastionYou can also run commands directly:
bastion trade # Open quick trade
bastion deposit 5 # Deposit 5 SOL to the dark pool
bastion withdraw 2 # Withdraw 2 SOL
bastion ticker # Live market prices
bastion config set-network devnet| Program | Address (Devnet) | Purpose |
|---|---|---|
bastion-pool |
CbHS6twCMkYyodaEUtvonRV6HVBZnkGjekohLqXJziU5 |
ZK dark pool — commitments, proofs, matching, settlement |
bastion-amm |
BvFgtfCEeCcMHoN1PRHSXkdzVYTka1NsrVBTeHmnDN2D |
Constant-product AMM — fallback liquidity when dark pool has no match |
A full trading terminal built with bash and gum:
[>] Quick Trade — Submit encrypted ZK orders
[$] Deposit / Withdraw — Move funds in and out of the dark pool
[~] Liquidity Center — Add/remove AMM liquidity
[%] Live Market Ticker — Real-time prices with sparklines
[<] Arbitrage Scanner — Detect cross-venue price gaps
[W] Whale Mode — Iceberg orders (split large trades automatically)
[!] MEV Attack Simulator — See sandwich attacks vs. Bastion protection
[Z] ZK Proof Demo — Interactive walkthrough of how ZK commitments work
- TypeScript SDK (
sdk/) — Programmatic access to dark pool and AMM - Relayer (
relayer/) — Off-chain order matching and Jito MEV bundle submission - Indexer (
indexer/) — Transaction parser for on-chain activity - ZK Circuits (
zk/) — Halo2-based proof generation compiled to WASM
┌─────────────────────────────────────────────────────────────┐
│ BASTION CLI (bash/gum) │
│ Trade | Deposit | Withdraw | Liquidity | Ticker | ZK Demo │
└───────────────────────┬─────────────────────────────────────┘
│
┌────────────▼────────────┐
│ TypeScript SDK │
│ + Relayer Service │
└────────────┬────────────┘
│
┌────────────▼────────────┐
│ Solana Programs │
│ ┌────────────────────┐ │
│ │ bastion-pool │ │ ZK Dark Pool
│ │ bastion-amm │ │ Constant Product AMM
│ └────────────────────┘ │
└────────────┬────────────┘
│
┌────────────▼────────────┐
│ Solana Network │
│ localnet | devnet │
└─────────────────────────┘
| Tool | Version | Install |
|---|---|---|
| Rust | 1.75+ | rustup.rs |
| Solana CLI | 1.18+ | docs.solana.com |
| Anchor | 0.31.1 | anchor-lang.com |
| Node.js | 18+ | nodejs.org |
| gum | 0.14+ | github.com/charmbracelet/gum |
# Clone
git clone https://github.com/krishnagoyal099/Bastion-solana.git
cd Bastion-solana
# Build smart contracts
anchor build
# Start local validator + deploy
solana-test-validator --reset &
anchor deploy
# Initialize the pool
npm install
npx ts-node scripts/init-pool.ts
# Launch the CLI
./cli/bastionbastion config set-network devnet # Use Solana devnet
bastion config set-network localnet # Use local validator
bastion config show # View current config- Encrypted orders — All trades are hidden behind SHA-256 commitments, validated via ZK proofs
- No replay attacks — Nullifier system prevents double-spend
- Trustless escrow — Pool funds live in PDA-derived vaults with no admin drain keys
- MEV-immune by design — Bots cannot extract value from data they cannot see
Full details: audit_scope.md · threat_model.md
The status bar in the Bastion CLI displays disconnected when it cannot reach the Solana RPC endpoint.
Cause: The CLI defaults to localnet (http://127.0.0.1:8899). If the local validator isn't running, every RPC health check fails and the status falls back to "disconnected."
Fix — Option 1: Start the local validator
solana-test-validatorOnce the validator is listening on port 8899, restart the CLI and it will show connected.
Fix — Option 2: Switch to devnet
If you don't need a local validator, point the CLI at Solana's public devnet:
bastion config set-network devnetVerify the connection
# From the CLI Settings menu → "Test Network Connection"
# Or directly:
solana cluster-version --url http://127.0.0.1:8899 # localnet
solana cluster-version --url https://api.devnet.solana.com # devnet| Symptom | Cause | Fix |
|---|---|---|
gum: command not found |
gum TUI dependency not installed |
Install via brew install gum, sudo apt install gum, or go install github.com/charmbracelet/gum@latest |
| Airdrop fails | Airdrop only works on devnet/localnet | Switch network: bastion config set-network devnet |
| Deposit says "On-chain deposit unavailable" | Validator not running or programs not deployed | Start validator, then run anchor deploy and npx ts-node scripts/init-pool.ts |
Balance shows ? or 0.00 |
Wallet keypair missing or no funds | Create identity in Identity Manager, then request airdrop from Settings |
bastion/
├── cli/ # Interactive terminal UI
│ ├── bastion # Main entry point
│ ├── lib/ # Feature modules (trade, liquidity, zkproof, etc.)
│ └── config/ # Network and contract configuration
├── programs/ # Solana smart contracts (Anchor/Rust)
│ ├── bastion-pool/ # ZK dark pool program
│ └── bastion-amm/ # Constant product AMM program
├── sdk/ # TypeScript SDK for programmatic access
├── relayer/ # Off-chain matching engine (Rust)
├── indexer/ # On-chain transaction indexer
├── zk/ # Halo2 ZK circuits + WASM prover
├── scripts/ # Deployment and initialization scripts
├── landing-page/ # React/Vite website (bastion-solana.vercel.app)
├── tests/ # Integration and anchor tests
└── install-cli.sh # One-line installer script
| Website | bastion-solana.vercel.app |
| GitHub | github.com/krishnagoyal099/Bastion-solana |
| License | MIT |
