Authentication
Sign in with your email to connect your Starknet wallet
How It Works
StarkFi uses Privy for authentication. When you sign in with your email, a Starknet smart contract wallet (ArgentX v0.5.0) is automatically created and managed for you — no browser extension or seed phrase required.
Sign-in, transaction signing and gas sponsorship go through the StarkFi auth server (server/), which holds the Privy credentials.
The hosted auth server is offline. The CLI defaults to the hosted instance at
https://starkfi-production.up.railway.app, which currently answers404 Application not found. Until it returns,auth loginand every transaction need an auth server you run yourself: follow Self-hosting the auth server below, then sign in.
Self-hosting the auth server
You need: Node.js 22.12+, pnpm, and a Privy app with email login enabled. Copy its App ID and App secret from the dashboard.
git clone https://github.com/ahmetenesdur/starkfi.git
cd starkfi/server
pnpm install
cp .env.example .envEdit .env:
| Variable | Value |
|---|---|
PRIVY_APP_ID | Your Privy App ID |
PRIVY_APP_SECRET | Your Privy App secret |
JWT_SECRET | At least 32 random characters, e.g. the output of openssl rand -base64 32 |
AVNU_API_KEY | Optional. Needed only for gasfree (developer-sponsored) transactions |
PUBLIC_URL | Optional. Sent as the Origin of OTP requests to Privy (default http://localhost:3001) |
Start it and check that it answers:
pnpm dev # http://localhost:3001
curl http://localhost:3001/health # {"status":"ok"}For a long-running deployment, use pnpm build and node --env-file=.env dist/src/index.js. All variables are listed in the Auth Server reference.
Point StarkFi at it in the shell where you sign in:
export STARKFI_API_URL=http://localhost:3001STARKFI_API_URL selects the server for auth login and auth verify. The session then records that server, and every later command, including the MCP server, signs and sponsors transactions through it, so keep it running. A session only works with the server that issued it: sign in again after switching servers.
Sign In (2 Steps)
Step 1 — Request OTP
starkfi auth login you@email.comA one-time password (OTP) is sent to your email address.
Step 2 — Verify OTP
starkfi auth verify you@email.com 123456Replace 123456 with the code from your email. On success, your wallet is connected and your session is saved locally.
✓ Wallet connected
network: mainnet
address: 0x04a3...abcd
walletId: wallet_abc123
message: New wallet created and session saved.First time? If this is a new wallet, fund it with some ETH or STRK — or enable gasfree mode to transact without holding any gas tokens.
Check Your Status
# Show wallet address and network
starkfi address
# Full status check (auth + Fibrous API health)
starkfi statusSign Out
starkfi auth logoutDeletes your stored session. You'll need to re-authenticate to use any commands.
Since v0.8.0, logout first asks the auth server that issued the session to revoke it, which invalidates every session of your account on every device; if the server is unreachable, the local session is still deleted and logout tells you the token stays valid on the server until it expires. v0.7.2 and earlier only delete the local file: the token stays valid on the server for the rest of its 7-day lifetime.
Session Details
Sessions are stored in a platform-specific data directory (managed by env-paths):
| Platform | Path |
|---|---|
| macOS | ~/Library/Application Support/starkfi-nodejs/session.json |
| Linux | ~/.local/share/starkfi-nodejs/session.json |
| Windows | %LOCALAPPDATA%/starkfi-nodejs/Data/session.json |
| Property | Description |
|---|---|
| Persistence | Survives terminal restarts — no need to re-login each time |
| Format | JWT-based with automatic expiry detection |
| Expiry Buffer | 5-minute buffer before JWT expires to prevent mid-request failures |
| Auto-Cleanup | Expired sessions are automatically cleared |
What the Session Contains
| Field | Purpose |
|---|---|
userId | Privy user identifier |
walletId | Embedded wallet identifier |
address | Your Starknet contract address |
publicKey | Wallet public key for signing |
token | JWT for authenticating API requests |
serverUrl | Signing server endpoint |
network | mainnet or sepolia |
Authentication Flow
You (CLI)
│
├─ auth login you@email.com
│ └→ StarkFi Server (Hono) → Privy API → sends OTP email
│
└─ auth verify you@email.com 123456
└→ StarkFi Server → Privy API → creates/retrieves wallet
│
Returns JWT + wallet info
│
CLI saves session.json locallyNext Step
After authenticating, head to the Quick Start to make your first trade.
See Also
- Quick Start — Your first swap, stake, and portfolio view
- Security Architecture — How your keys and sessions are protected
- Auth Server — Server endpoints and deployment
Last updated on