StarkFiStarkFi

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 answers 404 Application not found. Until it returns, auth login and 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 .env

Edit .env:

VariableValue
PRIVY_APP_IDYour Privy App ID
PRIVY_APP_SECRETYour Privy App secret
JWT_SECRETAt least 32 random characters, e.g. the output of openssl rand -base64 32
AVNU_API_KEYOptional. Needed only for gasfree (developer-sponsored) transactions
PUBLIC_URLOptional. 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:3001

STARKFI_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.com

A one-time password (OTP) is sent to your email address.

Step 2 — Verify OTP

starkfi auth verify you@email.com 123456

Replace 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 status

Sign Out

starkfi auth logout

Deletes 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):

PlatformPath
macOS~/Library/Application Support/starkfi-nodejs/session.json
Linux~/.local/share/starkfi-nodejs/session.json
Windows%LOCALAPPDATA%/starkfi-nodejs/Data/session.json
PropertyDescription
PersistenceSurvives terminal restarts — no need to re-login each time
FormatJWT-based with automatic expiry detection
Expiry Buffer5-minute buffer before JWT expires to prevent mid-request failures
Auto-CleanupExpired sessions are automatically cleared

What the Session Contains

FieldPurpose
userIdPrivy user identifier
walletIdEmbedded wallet identifier
addressYour Starknet contract address
publicKeyWallet public key for signing
tokenJWT for authenticating API requests
serverUrlSigning server endpoint
networkmainnet 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 locally

Next Step

After authenticating, head to the Quick Start to make your first trade.


See Also

Edit on GitHub

Last updated on

On this page