Points are live on Hive-Swap — and so is multi-hop routing!

Published on HivePostify by @hive-swap.com · Wed May 13 2026

This was the cycle where Hive-Swap stopped being a pure router and started rewarding people for using it. Two things drove most of the changes: a full Points + leaderboard system built on top of the existing fee-event log, and a new 3-hop graph router that finally makes the tokens-with-no-SWAP.HIVE-pool corner of Hive Engine actually swappable. Everything else (treasury auto-sweep, four new bridges, public HTTP API, analytics dashboard) is in the cycle too — those land further down.

---

Points, profiles, and a leaderboard

Every successful swap and bridge now rewards points based on the USD value of the action at the time it happened, and that history is permanent — points don't drift when token prices move later. The whole thing piggybacks on the existing 5-minute fee-event sync, so there are no new on-chain ops to pay for and no new sync loops to keep healthy. Two D1 tables back it: pointsevents is the per-event audit log, and userpoints is a denormalized rollup so profile and leaderboard reads are cheap. Awarding is idempotent on opid, so a concurrent or replayed sync can't double-credit.

The progression curve is 30 levels split across 6 tiers (Shrimp → Whale), with L30 anchored at $1M lifetime volume — meaningful for serious users without being unreachable. Tier and milestone badges are computed at read time, which means new badges apply retroactively when added later without needing a migration backfill.

Three new public endpoints went up alongside the UI:

GET /api/v1/profile/{username} GET /api/v1/profile/{username}/activity GET /api/v1/leaderboard

The top-nav WALLET / PROFILE / RANKS dropdown is the entry point in the app. The profile @username is also clickable straight through to peakd.com/@ so you can jump to the user's full Hive social profile from anywhere on the site.

A few infra fixes had to ship the same week to make Points trustworthy:

- feeusd is snapshotted at sync time, so totals on /analytics and the leaderboard stop sliding when HIVE or a fee-token moves. A backfill job fills in NULL rows on every /analytics/refresh and inside the regular maybeSync tick. Points-sync defers NULL rows until backfill catches up instead of recording zero-point events. - Points-sync RPC fan-out is throttled to 25 events/tick with a 60ms gap between getTransactionInfo calls. The first backfill hit api.hive-engine.com with 500 sequential requests, got 429'd on most of them, and only resolved 4-5 events per tick. Multi-tick backfill now keeps us well under the rate limit. - Stale null route cache invalidated — the same rate-limited burst poisoned the route resolver cache, and six out of nine fee-event users never made it onto the leaderboard because a transient 429 got cached with a 1-hour TTL. Bumped the cache key prefix (route4 → route5) and dropped the null TTL from 3600s to 120s so a blip recovers in two minutes instead of an hour.

Real 3-hop routing across the full pool graph

Up until this cycle the router could only quote direct pairs or 2-hop swaps via SWAP.HIVE. Tokens whose only pools pair with other intermediates — HSBIDAO is the canonical example, it has pools only against ECOBANK, LBI, PIXYDUST, and THREE — would appear in the token dropdown and return NOROUTE every time. The new router walks the full pool graph up to 3 hops, evaluates every candidate path (capped for runtime), and picks whichever yields the highest output after fees. The same algorithm picks up real arb gains on pairs that were routable: FLUX→SCRAP +2.1%, LSTR→LBI +77%, SWAP.HBD→LBI +17%.

A handful of routing-correctness fixes shipped alongside the graph walker, because once you start chaining three hops together the rounding behavior of low-precision tokens matters a lot:

- Dust routes are rejected. Two production txs (e397d31c, d492889d) showed the same failure: hops through LEO (precision 3) and BEED (precision 4) intermediates produced sub-satoshi outputs that the SDK silently dropped, and later hops drew from the user's pre-existing balance of the intermediate token. Now the router refuses any path whose intermediate output is below 10 satoshi, and buildSwapWithFee throws DUSTROUTE rather than emit a partial chain. - Intermediate minAmountOut is wired tighter. Pool-only intermediate hops set minAmountOut equal to the next hop's tokenAmount, so a successful hop is provably enough to fund the next draw. The last hop's minAmountOut is recomputed against the actually-emitted poolIn, not the router's full-precision prediction. - Multi-hop inputs get a 50bps buffer. Each non-first hop's tokenAmount was hard-coded to the quote-time prediction of the prior hop's output, so any pool drift below that prediction — pool snapshot caching, in-flight third-party swaps — tripped insufficient input balance and reverted the whole atomic customjson. A small buffer is now shaved off intermediate-hop inputs (compounded per hop); the user-facing slippagePct still drives the final minOut. - Dead pairs are filtered out of routing — pools with zero reserves on either side no longer silently produce dust quotes (RIP BRO:LBI). - Deepest pool wins per leg when multiple pools exist for the same pair.

Order-book routing pairs naturally with the multi-hop path: the router now considers each leg's HE order book (market.buy / market.sell) alongside the AMM pool and picks pool-only, book-only, or a ternary-search-optimal pool+book split. Two things make this clean in practice:

- The market contract's 0.001 BEED multi-tx fee is auto-bundled in the same atomic tx when the user doesn't already hold BEED — including a pre-leg pool buy of BEE → BEED through SWAP.HIVE when they don't hold BEE either. All bootstrap ops are exempt from the BEED fee so they ride for free in the user-signed tx. - BEED routing is now an always-visible toggle below the To box (persisted in localStorage), so users can pre-opt-in rather than having to discover the hint tooltip on a quote where a book opportunity happens to exist.

/docs/api, /llms.txt, and /llms-full.txt were all updated in the same commits as the router changes — /quote and /swap/build responses serialize the new poolPortion / bookPortion fields, and the docs now show a split-route example plus the BEED multi-tx fee disclaimer (which the public API does not auto-bundle, unlike the web UI).

---

Also shipped this cycle

- Four new bridges. /bridge now covers BTC, LTC, DOGE, BCH via the @btc-swap converter, plus native ETH, BNB, POL, SOL peg-out gateways. Shared splitters were taught about 8-decimal precision, so a 0.05 SWAP.LTC peg-out sends 0.04987500 net (above the gateway minimum) with a 0.00012500 platform fee, instead of the prior 0.049/0.001 split which would have been rejected by the daemon. Verified end-to-end on mainnet — 0.05030000 SWAP.LTC went out and 0.04978114 LTC landed at the destination address. - HBD ↔ SWAP.HBD bridge via DSwap (@graphene-swap), including a gateway health check, estimated time, and direct support links to dswap.trade. - Bridge beta gating. A dismissible amber banner above every /bridge tab plus a $50-USD threshold confirmation checkbox on each bridge subcomponent. The checkbox auto-resets whenever the amount changes, so a user can't pre-confirm a tiny amount and then bump it up. USD value is derived per token via a new useTokenUsd hook that reuses the existing HE pool price-map pattern — HIVE, HBD, wHIVE, the four converter coins, and the four native bridges are all priced with no new network endpoints. - Public v1 HTTP API at api.hive-swap.com — /quote, /swap/build, /bridge/, /pools, /tokens, /gateways, /status, /analytics/, /health. Per-IP rate limit (30/60s) via the Cloudflare ratelimit binding, full docs at /docs/api, plus /llms.txt + /llms-full.txt for AI consumers. Returns unsigned customjson ops — the caller signs and broadcasts. - Platform analytics dashboard at /analytics. Derives platform-wide swap and bridge activity from the on-chain history of hive-swap-fees (HE accountHistory + Hive L1 condenserapi). KPI cards, area chart with volume/fees toggle, activity histogram, top-fee-earning tokens with sparklines, polling recent-activity feed with token-logo route pills and on-chain failure detection. A globally-shared Refresh button is rate-limited to one request per 60s across all users via a single KV lock. - Ownership-proven Keychain connect. The connect modal previously stored any typed username with no Keychain involvement, so the UI would happily render balances and history under a spoofed account. Now we issue a randomized signBuffer challenge against the posting key — Keychain rejects if the extension has no key for that account, so a successful sign proves ownership. - Multi-account switcher. Store multiple Keychain accounts and one-click switch between them, so power users can hop wallets without re-verifying each time.

Smaller improvements

- Activity feed and history pages render every route as token-logo pills (the same component everywhere — RecentActivity, SwapHistory, PoolHistory). - /analytics caches recent activity in localStorage and paginates past 10 rows so the page hydrates instantly. - Per-token spinner on Recent Activity during initial load, the 60s poll, and manual refresh. - All / Swaps / Bridges filter on Recent Activity. - Chart bucket sizes scale smoothly with range — 30d no longer jumps from 6h to daily. - /analytics polling now uses an in-isolate L1 cache layered over KV, dropping us well under the 1k/day KV write free-tier ceiling. - History resolver now recognizes the BEED order-book leg (market.sell / market.buy) and flags malformed multi-hop routes as partial, so a tx like e397d31c (which silently drained a pre-existing ONEUP balance) stops rendering as a clean success, and a working split-route tx like 74b5bc45 stops dropping its first hop. - Wallet button on mobile compacted to fit the header; long usernames truncate in the connected state. - Profile button + new menu items pulse subtly so users discover the Points page, Ranks, and account switcher instead of leaving them hidden behind a hover. - Top beta banner: smoother GPU-composited marquee, shorter line height, single-copy scroll that clearly enters from the right and exits past the left.

---

Try it: [hive-swap.com](https://www.hive-swap.com) Public API docs: [hive-swap.com/docs/api](https://www.hive-swap.com/docs/api) Follow: @hive-swap

Tags: #hivedevs#hive#hive-engine#defi#dex#devs#development

View full post on HivePostify →

Join HivePostify — Pakistan's First Web3 Platform →