# Bansun user guide

**Current product documentation:** [Bansun Docs](/docs). This technical guide includes legacy self-hosting instructions; the public Docs page describes the current Replit installation.

Bansun is a private AI agent for Ethereum mainnet. No account or wallet connection is required for read-only checks. Optional approval revocation requests a browser-wallet connection and a transaction confirmation. Saved personal records (wallet labels, journal, watchlist, vault) stay on your device; public lookup addresses and online AI submissions are sent to the backend. All times are shown in UTC.

The app groups its tools in five sections: **Trade**, **Protect**, **Understand**, **Private** and **Token**. Tools marked PRIVATE process data on this device; live data and optional server AI explanations still need internet.

---

## Trade

### Ask (the agent)
1. Choose **Agent** (default). Type a question the way you would ask a friend who reads the chain:
   - `Is 0x6982508145454Ce325dDbE47a25d4ec3d2311933 renounced? How much liquidity?`
   - `What is gas now and what does a swap cost?`
   - `Check approvals for vitalik.eth`
   - `I have $5,000, risk 1%, entry 2450, stop 2380. How much ETH can I buy?`
2. The agent first runs the obvious tools (an address triggers a token check, a hash a transaction lookup, "gas" the gas tool, token symbols a price lookup). Then the AI may call up to `AGENT_MAX_STEPS` more tools.
3. Every step is listed with its source and timing, then the answer and a confidence score.
4. Other modes: **Chat** (AI only, no tools), **Local AI** (runs in your browser, nothing leaves the device), **Compare** (several models side by side).
5. **Auto-erase 10 min** wipes the chat from memory; **Save to vault** keeps it encrypted.

The agent only uses addresses you typed in that message. It never reads your saved wallets or journal.

### Market & gas
- **Gas now**: base fee, how full recent blocks are, and the USD cost of sending ETH, a token transfer, an approval and a swap at slow / normal / fast speed.
- **Watchlist**: add a symbol (`LINK`) or any token address. You see price, 24h change and an hourly 24h chart. Click the scan icon to run a token check.
- The list refreshes every 90 seconds while the tab is visible.

### Portfolio
1. Add a public address or ENS name, with an optional label (up to 10 wallets).
2. Bansun shows ETH and token balances, USD value, 24h change and allocation. Every refresh (at most every 30 minutes) adds a snapshot so you can see your own history.
3. Under **Extra tokens to track** add contract addresses that are not on the built-in list.
4. **Storage**: choose *This device* or *Vault (encrypted)*. In vault mode your wallets are unreadable until you unlock the vault.

Tokens with no price are often spam airdrops. Do not try to sell them: the sale page can be a drainer.

### Journal & risk (offline)
- **Trades**: log pair, side, entry, exit (empty = open), size, stop, fees + gas, tags and notes. Edit or delete any trade. Export or import CSV.
- **Statistics**: net P&L, win rate, average win / loss, profit factor, expectancy, average R (needs a stop), max drawdown, streaks, and breakdowns by pair and tag.
- **Position size**: enter account size, risk %, fee %, entry, stop and optional target. Bansun gives the size that loses exactly your risk at the stop (fees included), the reward and R:R at target, the win rate needed to break even, and the leverage the size implies. **Log as open trade** copies the plan into the journal.

---

## Protect

### Before you sign (offline)
Use this whenever your wallet asks for a signature you do not fully understand.

- **Transaction**: paste the `to` address, the value in ETH and the `data` hex. Bansun names the function and explains it: who may spend which token and how much, whether the spender is a known app, whether swap output goes to someone else, whether ETH is sent to a "claim" or "security update" function. When the server is reachable it also checks whether the spender is a personal wallet (a classic scam sign).
- **Signature request**: paste the EIP-712 JSON your wallet shows (`eth_signTypedData_v4`). Bansun recognises Permit, Permit2 (single, batch, transfer) and Seaport listings, and flags unknown spenders, unlimited amounts, long deadlines, batch approvals and listings where you receive nothing.
- **Past transaction**: paste a hash to see what a mined transaction did, its status, fee and token transfers.

Red and yellow indicate warnings to investigate. Green does not guarantee safety; review every action in your wallet, including revocations.

### Token check
Paste a token address (or click USDC, PEPE, LINK). You get:
- a **risk score 0-100** and the reasons,
- **what the code allows**: mint, blacklist, changeable taxes, pause, trading switch, limits, fee exemptions, upgrades,
- **proxy** details (the admin can change the rules),
- **owner** status (renounced or active),
- **Uniswap V2 + V3 liquidity** in WETH, price, market cap and supply.

Well-known tokens (USDC, USDT, WBTC…) are capped at low risk, with a note when the issuer can freeze or mint by design. A score of 0 means "no red flags found", not "safe".

### Approvals
1. Enter a wallet address or ENS name (or click one of your saved wallets).
2. **Deep scan** also reads `Approval` and `ApprovalForAll` events from recent blocks; it can take 20-40 seconds on public RPCs.
3. Each active approval shows the token, spender, allowance and risk: *Unknown spender* (revoke first), *Unlimited*, or *Limited*.
4. **Revoke** opens your browser wallet with a ready transaction (`approve(spender, 0)` or `setApprovalForAll(operator, false)`). The connected account must be the scanned wallet, on Ethereum mainnet. No browser wallet? Copy the revoke data and send it from any wallet to the token contract.

### Scam check (offline)
Paste a DM, Telegram or Discord message, email or link. Bansun flags seed-phrase requests, "validate / sync your wallet", airdrop claims, fake support, giveaways, pump groups, recovery scams, urgency, and look-alike domains of Uniswap, OpenSea, MetaMask, Ledger, Etherscan and others. Advice such as "never share your seed phrase" is not flagged. Optionally ask the AI for an explanation.

---

## Understand

### Simplify
Paste a whitepaper section, staking terms, a risk disclosure or exchange rules. Pick *Everyday words*, *Steps*, *Table* or *5-point summary*. Numbers and dates are kept; fees, lock-ups and slashing are flagged.

### Prediction ledger (offline)
Write a checkable statement (`ETH closes above $3,000 on 2026-12-31 (UTC)`), your probability and the source. When the date passes, mark it happened / did not happen. The Brier score (lower is better, 0.25 = coin flip) shows which sources, AI models included, are actually right. AI answers with a forecast have a **Log prediction** button.

---

## Private

### Vault (offline)
Create a vault with a passphrase of at least 8 characters (four random words work well). Notes are encrypted on your device with AES-256-GCM. The journal, wallets and watchlist can be moved into the vault from their own pages. Export an encrypted backup; it is useless without the passphrase or recovery pieces.

### Recovery (offline)
Split the vault key into pieces (for example 5) and choose how many are needed (for example 3). Give each piece to a different trusted person. Any 3 of them can restore access; 2 learn nothing.

### Credits
When a server enforces credits, get anonymous credits here. Your device creates and blinds them; the server signs without seeing them. Spending a credit proves it is valid and unused, nothing else. If the server's key changes, Bansun warns you.

### Privacy check (offline)
Shows what your browser exposes (permissions, storage, Global Privacy Control), a habit checklist, and a button that wipes all Bansun data from this device.

---

## Token

### $BANSUN
The token is **not launched**. The page explains its five jobs (private payment for AI, operator staking, rewarding accurate models, funding public safety tools, governance), how a private payment works, a draft allocation, the roadmap and the risks. Paste any contract that claims to be $BANSUN into the checker: until launch, every one is fake.

---

## Self-hosting in one minute

- `docker compose up -d`, or `sh install.sh` on Linux / macOS. Open `http://localhost:8787`.
- For the most privacy, run your own Ethereum node (or a Helios light client) and set `ETH_RPC_URLS` to it.
- `npm run vendor` makes the in-browser local AI work offline.
