Set Env

From Kohaku CLI Wiki — Set the environment variables

Now that we’ve created a wallet. Let’s configure the important environment variables.

Tip: if you don’t want to set the env vars in every new terminal session then you can add these lines to your ~/.bashrc or ~/.zshrc.

# Set DEFAULT_PRIVACY_PROTOCOL

This guide will focus on Tornado Cash as the main privacy solution. So simply execute:

export DEFAULT_PRIVACY_PROTOCOL=tornado

This is a convenience environment variable, setting a single privacy protocol as the “default” to display balances for and interact with (so you don’t have to use --protocol or --include for every command).

If you want Privacy Pools as the default instead, set privacy-pools. (Railgun is still available as railgun — useful when you need an arbitrary ERC-20 that has no Tornado / Privacy Pools pool.)

# Set RPC_URL

We need an Ethereum RPC_URL. Ideally, this is your local node

export RPC_URL=http://localhost:8545

(this is the default so if your node is localohst:8545 the var doesn’t even need to be explicitly set)

Everything else the CLI contacts (Pimlico, Subsquid, PPOI, saga, ASP, …) goes through Tor by default. The Ethereum RPC is the deliberate exception: it stays on clearnet. That is fine when the RPC is local. If you use a remote provider instead, assume it can see which addresses you query and may already identify you via an API key — Tor would not help much there anyway. Details: Network traffic.

If you must use a remote RPC provider (Alchemy, Infura, Ankr, etc):

export RPC_URL=https://rpc.ankr.com/eth/some-api-key

You are then entrusting that provider with privacy-critical information (addresses you query, how they cluster together, network metadata). Prefer a local node when you can OR a local process that can mirror local node functionality (a project i hope to work on!)

# Recommended: public-sync cache

The first mainnet Railgun / Tornado / Privacy Pools sync can fetch a lot of public history. Prefetch the verified v2 snapshot to make first protocol syncs significantly faster:

kohaku fetch-sync-cache

Proving circuits are bundled with the CLI; this step only prepares public sync history. Details: fetch-sync-cache.

Cache lives under <dataDir>/sync-cache-v2. Sepolia still uses its existing sync path. The old <dataDir>/public-sync-cache is no longer read; kohaku clear-tor-cache --public-sync removes both directories.

If you used a wallet before 0.1.0, see Upgrading to 0.1.0 before your first private sync.

# Proving artifacts

Railgun / Tornado / Privacy Pools proving circuits install with the CLI. There is no separate artifact fetch step or fetch-artifacts command anymore.

# Optional: KOHAKU_WITHOUT_TOR

Tor is on by default for non-RPC HTTP. There is no Tor→clearnet fallback for saga CDN requests — they fail if Tor cannot complete the request (unless you explicitly disable Tor). Set this to always skip Tor without passing --without-tor on every command:

export KOHAKU_WITHOUT_TOR=1

Default is unset / 0 (Tor on). Only disable Tor when you understand you are revealing your home IP to Pimlico and other privacy-protocol endpoints — see Network traffic.

# Optional: KOHAKU_GETLOGS_MAX_BLOCK_SPAN

Some RPCs limit how large an eth_getLogs block range they accept. The CLI defaults to 499. Raise or lower it to match what your node / provider allows:

export KOHAKU_GETLOGS_MAX_BLOCK_SPAN=499

# Data directory

Wallet data lives in ~/.kohaku-cli by default. To use a different location, pass --dataDir <path> on every command — there is no persistent config that remembers a custom data directory.