reference

Documentation

Build, configuration, and architecture of the Leviathan chat client

on this page
  1. Architecture
  2. Building from source
  3. Configuration
  4. Accounts and login
  5. Chat commands
  6. Trading (OsirisBot)
  7. Plugins
  8. Security notes

1.Architecture

Leviathan is a chat client built around a client-server model. It connects to one or more chat servers you configure — it does not open peer-to-peer connections to other users, and there is no server-less mode. The client keeps a socket per configured server, registers with the server's standard handshake, and multiplexes all connections with epoll.

The terminal interface is built on ncurses/panel (wide-character build), so the client runs entirely inside a terminal emulator — no GUI toolkit, no browser component.

The crypto trading feature ("OsirisBot") is not part of the C client. It's a separate bot that connects to a chat server like any other user and answers commands such as !wallet or !sell. Two instances exist, one for the Portuguese room (BR) and one for the English room (USA). The bot keeps its own state on the server side.

2.Building from source

You need a C11 toolchain and a few development libraries:

DependencyUsed for
gcc, makeToolchain (built with -std=c11 -Wall -Wextra -Wpedantic)
libncursesw-devTerminal UI (wide-character ncurses + panel)
libssl-devTLS to chat servers, HTTPS to the CoinGecko price API

Package names vary by distro — on Debian/Ubuntu this is typically libncursesw5-dev and libssl-dev; on Fedora, ncurses-devel and openssl-devel.

git clone <repo-url> leviathan
cd leviathan
make            # optimized build -> build/bin/leviathan
make debug      # debug build: -g -O0, AddressSanitizer + UBSan
make install    # installs to $DESTDIR/usr/local/bin/leviathan

Plugins load through dlopen(), so the binary also links against libdl. A background thread (pthreads) refreshes crypto prices without blocking the UI.

3.Configuration

Copy the shipped defaults to your user config directory and edit it:

mkdir -p ~/.config/leviathan
cp config/leviathan.yaml.default ~/.config/leviathan/leviathan.yaml

The config file is YAML and supports a list of servers, so you can connect to several chat networks at once. Each entry has its own tls switch:

servers:
  - name: br
    host: chat.example.org
    port: 6697
    tls: true
    rooms: [br]

log:
  enabled: false
  path: ~/.local/share/leviathan/logs

Message logging is off by default. When you turn it on, the client writes plain-text log files per buffer to the path above — nothing is sent anywhere else.

4.Accounts and login

Accounts are local to the client, not tied to any identity service. Credentials are stored in a plain-text users.db file (username:password_hash) inside your config directory.

Known limitation: passwords are currently hashed with DJB2, a fast non-cryptographic hash with no salt. This is adequate for a local single-user terminal client but should not be treated as protecting against a determined attacker with access to users.db. Do not reuse a password you use elsewhere.

There is no email, phone number, or identity verification anywhere in the client or the trading bot — a login is just a nickname and a local password.

5.Chat commands

CommandEffect
/server <name>Connect to a server defined in your config
/join roomJoin a room on the current server
/msg nick textSend a private message
/leave, /quitLeave a room or disconnect

These are standard client-server chat commands, handled the same way regardless of which server you're connected to.

6.Trading (OsirisBot)

OsirisBot runs on the server side, in the rooms you connect to. It is not something you install locally. Balances are simulated for the purpose of the marketplace — the bot tracks who owns what inside its own ledger and settles trades between users' bot balances.

CommandEffect
!walletShow your balances
!pricesShow current BTC/ETH/XMR/USDT prices
!sell <coin> <amount> <price>List an amount for sale (listing fee applies, see below)
!buy <listing-id>Buy an open listing (transfer fee applies)
!listingsShow the open order book
!historyShow your past trades

Prices come from the public CoinGecko API, polled every couple of minutes. That request is made from the machine running the bot, not from your client, so using the bot does not expose your IP to CoinGecko.

7.Plugins

Plugins are native shared objects (.so), loaded with dlopen() from ~/.config/leviathan/plugins/ at startup. A plugin exposes two entry points, leviathan_plugin_init and leviathan_plugin_shutdown, and gets a small function-pointer table back for reading buffers, printing, and reading/writing config values.

Plugins run with full process privileges. Because they are native code loaded into the same process, a plugin is not sandboxed in any way — it can read any buffer, any file your user account can access, and make any system call, exactly like the main binary. Only load plugins you trust as much as you trust the client itself.

8.Security notes