Skip to main content

Authentication

The CLI uses API wallets for signing transactions on behalf of your Decibel subaccount. API wallets can be created at app.decibel.trade/api. They allow programmatic trading without permitting deposits or withdrawals. The CLI resolves credentials in this order:
  1. --account <alias> flag - Use a named account from local storage
  2. DECIBEL_PRIVATE_KEY environment variable - API wallet private key
  3. DECIBEL_SUBACCOUNT_ADDRESS environment variable - Subaccount address (read-only operations)
  4. Default account from local storage (~/.decibel/data.db)

Adding an account

Run the interactive setup:
decibel-cli account add
You’ll be prompted for:
  • Subaccount address - Your Decibel subaccount address (starts with 0x)
  • Account type - api-wallet (for trading) or read-only (for monitoring)
  • Private key - API wallet private key (for api-wallet type only)
  • Alias - A short name like main, trading, or bot
  • Set as default - Whether to use this account by default
Accounts are stored locally in ~/.decibel/data.db with private keys encrypted at rest.

Managing accounts

decibel-cli account ls              # List all accounts
decibel-cli account set-default     # Change the default account
decibel-cli account remove          # Remove an account
decibel-cli account info            # Show balances and equity

Network selection

The CLI supports four networks:
NetworkDescription
mainnetProduction (real funds)
testnetPublic testnet
localLocal development
Set the network with the --network flag or DECIBEL_NETWORK environment variable:
# Per-command
decibel-cli markets ls --network testnet

# Or set globally
export DECIBEL_NETWORK=testnet
The default network is testnet.

Environment variables

VariableDescription
DECIBEL_PRIVATE_KEYAPI wallet private key for signing transactions
DECIBEL_SUBACCOUNT_ADDRESSSubaccount address for read operations
DECIBEL_ACCOUNT_ALIASAccount alias from stored accounts
DECIBEL_NETWORKNetwork (mainnet, testnet, local)
DECIBEL_NODE_API_KEYRequired. Node API key for authentication
DECIBEL_GAS_STATION_API_KEYGas Station API key for sponsored transactions
You can place these in a .env file in your working directory - the CLI loads it automatically via dotenv.

Global options

These options are available on all commands:
OptionDescription
--jsonOutput in JSON format (machine-readable)
--network <name>Network to use
--account <alias>Use a specific stored account
-h, --helpShow help for any command

MCP server

The CLI includes a built-in MCP server for AI agent integration. See the MCP Server Installation page for setup instructions.