Skip to main content

Authentication Methods

ChainStream CLI supports multiple authentication methods. Choose based on your use case:
MethodCommandUse CaseDeFi Support
API Keyconfig set --key apiKey --value <key>Read-only data queriesNo
Wallet LoginloginFull access including DeFiYes
Email OTPlogin user@example.comAccount recovery, new deviceYes
Raw Private Keywallet set-raw --chain baseDev/testing onlyYes
DeFi operations (swap, create token) require a wallet. API Key alone is not sufficient for signing transactions.
The simplest way to authenticate — works with any agent wallet setup:
chainstream config set --key apiKey --value <your_api_key>
Get an API Key from: Verify your configuration:
chainstream config get
# → apiKey: cs_live_****...
# → walletMode: none
Creates a non-custodial wallet with remote signing via a TEE (Trusted Execution Environment). A P-256 device key pair is stored locally for session authentication; the wallet’s signing keys remain in the TEE.

First-time Login

chainstream login
This generates a P-256 device key pair stored in ~/.config/chainstream/keys/ and registers it with the ChainStream auth service. A wallet is created automatically — no email required.

Returning User

chainstream login --key
Re-authenticates using your existing device key. No OTP needed.

With Email (Optional)

# Login with email OTP
chainstream login user@example.com

# Complete verification
chainstream verify --otp-id <id> --code <code> --email user@example.com

Bind Email for Recovery

chainstream bind-email user@example.com
chainstream bind-email-verify --otp-id <id> --code <code> --email user@example.com

Logout

chainstream logout
Clears the session from config but preserves your device keys in ~/.config/chainstream/keys/.

Raw Private Key (Dev Only)

This stores your private key in plaintext in the config file. Only use for development and testing.
# Import EVM private key (Base)
chainstream wallet set-raw --chain base

# Import Solana private key
chainstream wallet set-raw --chain sol
You will be prompted to enter the private key interactively.

Configuration

All CLI configuration is stored in ~/.config/chainstream/config.json:
SettingCommandDescription
API Keyconfig set --key apiKey --value <key>ChainStream API Key
Base URLconfig set --key baseUrl --value <url>API endpoint (default: https://api.chainstream.io)
Wallet Chainconfig set --key walletChain --value <chain>Default chain for wallet operations

View Configuration

# Show all settings (API Key is masked)
chainstream config get

# Show specific setting
chainstream config get --key apiKey

# Show auth status
chainstream config auth
# → Auth: TEE Wallet (org: ...)
# → or: Auth: Raw Key (sol)
# → or: Auth: API Key (cs_live_...)
# → or: Auth: Not configured

Authentication Priority

When multiple credentials are configured, the CLI uses this priority:
  1. API Key — if apiKey is set in config, used directly
  2. Wallet — if a TEE wallet or raw key is configured, used for signing

Environment Variables

VariableDefaultDescription
CHAINSTREAM_API_URLhttps://api.chainstream.ioAPI base URL
CHAINSTREAM_AUTH_URLhttps://api.chainstream.ioAuth service URL
SOLANA_RPC_URLhttps://api.mainnet-beta.solana.comSolana RPC endpoint
BASE_RPC_URLhttps://mainnet.base.orgBase RPC endpoint
CHAINSTREAM_DEBUG(unset)Enable debug output on errors

Next Steps

Command Reference

Explore all available commands

x402 Payment

Auto-purchase subscriptions with USDC