services
Get a key

library / Blockchain ideas / BI0007

Wallet social feed

Logical, if the wallet is the profile and the feed is what those wallets do on chain. You get a follow list, a backfill of each wallet's latest transactions and a live stream of new ones over one WebSocket.

By Carbium · Consumer and social · BI0007 · updated 2026-11-22

01

Is it logical

Partly, and the split decides the design. A wallet address is a ready-made identity: there is no sign-up and no password, and the owner proves control with a signature. Everything a wallet does is public and ordered, which is the raw material of a feed. Posts, comments and likes are different. Each write on chain pays a fee and stays public for good, so those belong in your own database.

The logical app keeps identity and activity on chain and everything social off chain. The follow list, display names, reactions and notifications live in a small SQLite file or Postgres table keyed by wallet address. The chain supplies the one thing nobody can fake, which is what a wallet actually did.

PieceWhere it livesWhy
IdentityThe wallet addressNo account system to build or secure
Follow listYour database, keyed by addressFree to change, and a follow costs no fee
Feed itemsThe chain, read through CarbiumPublic, ordered and already there
Names, bios, reactionsYour databaseEdits and deletes stay possible
NotificationsYour server, from the live streamOne stream serves every user who follows an address
02

Who uses it

The code only reads, so a team can show it working on day one of a hackathon.

  • A hackathon team gets a social demo on live data with no deployed program. It needs no token, no test funds and no signing.
  • A community or DAO site lists its members' wallets and shows a page of what they just did on chain.
  • A wallet or portfolio app adds a friends tab. The user pastes an address, and the app shows that address's activity beside their own.
03

What it shows

Each history row is one transaction, and a transaction that touches two followed addresses is one history row with both tags. Live rows differ: the code prints one per matching subscription, so that same transaction prints two live rows, one per tag.

ColumnWhere it comes fromNote
TimeblockTime from getSignaturesForAddressCan be null, and the code then prints "time unknown"
WalletsThe followed addresses the transaction mentionsThe code prints the first six characters; your app shows the display name
Signaturesignature in the page or in the logsNotificationThe code prints 12 characters; link the full value to an explorer
Statuserr is null for okA failed transaction is still a row, because the chain records it

History rows come from getSignaturesForAddress, newest first. Live rows come from logsSubscribe and carry no block time, so the code stamps the arrival time and marks the row live.

04

The build

One file that needs @solana/kit and what Node 24 ships. It is read-only: no key pair, nothing sent.

  1. Read the followed addresses from the command line. A real app reads them from its database. The demo takes up to five.
  2. Create one RPC client for https://services.carbium.sh with the key in the x-api-key header.
  3. Open one WebSocket to wss://services.carbium.sh with the key as ?api-key= and send one logsSubscribe per address, with mentions and commitment confirmed.
  4. Backfill, once every subscribe reply has arrived: call getSignaturesForAddress for each address with limit: 5, one call every 4.3 seconds so Free's 0.24 req/s holds. A wallet that still answers 429 after one retry gets a skipped line, and the loop moves on.
  5. Merge the pages into one map keyed by signature, sort newest first and print.
  6. On every logsNotification, print the signature, ok or failed, and the followed address its subscription id belongs to. When the socket closes, print the close code and reason, reconnect after 2 seconds and subscribe again. Every reconnect pays the 25-credit open again for each subscription.
main.ts
// BI0007 · Wallet social feed// https://carbium.sh/library/blockchainideas/wallet-social-feed// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { address, createDefaultRpcTransport, createSolanaRpcFromTransport, isSolanaError, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR } from "@solana/kit";const key = process.env.CARBIUM_KEY ?? "";if (!key) {  console.error("Set CARBIUM_KEY to your Carbium API key.");  process.exit(1);}const follows = process.argv.slice(2);if (follows.length < 1 || follows.length > 5) {  console.error("Usage: node main.ts <wallet> [<wallet> ... up to 5]");  process.exit(1);}const rpc = createSolanaRpcFromTransport(  createDefaultRpcTransport({    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",    headers: { "x-api-key": key },  }),);const GAP_MS = 4300; // one 50-cell call per 4.3 s stays under Free's 0.24 req/sconst sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));const short = (s: string) => s.slice(0, 6);const stamp = (t: number) => (t ? new Date(t * 1000).toISOString() : "time unknown");// Resolves once every logsSubscribe on the first socket has been answered.let ready = () => {};const subscribed = new Promise<void>((r) => { ready = () => r(); });// Live rows: one logsSubscribe per followed address, all on one socket.function live(): void {  const subs = new Map<number, string>(); // subscription id to followed address  let replies = 0;  const ws = new WebSocket(`${process.env.CARBIUM_WS_URL ?? "wss://services.carbium.sh"}/?api-key=${key}`);  ws.onopen = () => follows.forEach((w, i) => ws.send(JSON.stringify({    jsonrpc: "2.0", id: i + 1, method: "logsSubscribe",    params: [{ mentions: [w] }, { commitment: "confirmed" }],  })));  ws.onmessage = (ev) => {    const msg = JSON.parse(String(ev.data));    if (msg.id) {      const wallet = follows[msg.id - 1];      if (msg.error) console.log(`subscribe refused for ${short(wallet)}: ${msg.error.message}`);      else subs.set(msg.result, wallet);      if (++replies === follows.length) ready();      return;    }    if (msg.method !== "logsNotification") return;    const { signature, err } = msg.params.result.value;    console.log(`${stamp(Date.now() / 1000)} live ${short(subs.get(msg.params.subscription) ?? "?")} ${signature.slice(0, 12)} ${err === null ? "ok" : "failed"}`);  };  ws.onclose = (ev) => {    console.log(`socket closed, code ${ev.code} reason "${ev.reason}", reconnecting in 2 s`);    setTimeout(live, 2000); // each reconnect pays the 25-credit open again per subscription  };  ws.onerror = () => ws.close();}// History rows: the latest 5 signatures per address, merged newest first.async function backfill(): Promise<void> {  const items = new Map<string, { time: number; failed: boolean; wallets: string[] }>();  for (const [i, wallet] of follows.entries()) {    if (i > 0) await sleep(GAP_MS);    for (let attempt = 0; attempt < 2; attempt++) {      try {        const rows = await rpc.getSignaturesForAddress(address(wallet), { limit: 5, commitment: "confirmed" }).send();        for (const r of rows) {          const item = items.get(r.signature) ?? { time: Number(r.blockTime ?? 0), failed: r.err !== null, wallets: [] };          item.wallets.push(short(wallet));          items.set(r.signature, item);        }        break;      } catch (e) {        if (isSolanaError(e, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR) && e.context.statusCode === 429) {          await sleep(Number(e.context.headers.get("retry-after") ?? 5) * 1000);          if (attempt === 1) console.log(`skipped ${short(wallet)} after two 429s`);        } else throw e;      }    }  }  for (const [sig, it] of [...items].sort((a, b) => b[1].time - a[1].time)) {    console.log(`${stamp(it.time)} ${it.wallets.join("+")} ${sig.slice(0, 12)} ${it.failed ? "failed" : "ok"}`);  }}live(); // the backfill starts once every subscribe reply is in, so nothing lands in the gapsubscribed.then(backfill).catch((e) => console.error("backfill failed:", e instanceof Error ? e.message : e));

run: CARBIUM_KEY=<YOUR_KEY> node main.ts <wallet> [<wallet> ...]

The backfill starts only after every logsSubscribe reply has arrived, so a transaction that lands during the backfill shows up as a live row. The 2-second reconnect window is not covered: a transaction that lands while the socket is down shows up in neither list. The same signature can appear in both lists, so a real app keeps a Set of signatures it has shown.

05

What it costs

History calls are limited by rate: getSignaturesForAddress costs 50 cells, and each plan allows it at the rate below. A live subscription has a credit price: a logs subscription on a mention opens at 25 credits, then costs 20 credits per MiB sent. A refused subscription is free.

PlangetSignaturesForAddress rateBackfill of 100 follows (100 calls at that rate)
Free ($0)0.24 req/sabout 417 s
Dev ($20)1.2 req/sabout 83 s
Business ($250)100 req/sabout 1 s
Pro ($500)500 req/sabout 0.2 s

For the live side, assume one mention per wallet per minute and 2 KiB per notification, then replace that with the MiB you measure on your own addresses. One hundred follows then send about 11.7 MiB an hour, which is about 234 credits an hour. Opening the 100 subscriptions costs 2,500 credits once per connection, which is 0.5% of the Free grant of 500K credits. A reconnect opens them again at the same price.

Subscription counts are capped per account by tier, and Free carries 5 sockets. The code uses one socket for all its subscriptions. Look up the WebSocket caps for your plan before you promise users an unlimited follow list. Past the cap, poll the quiet wallets on a schedule and keep live subscriptions for the wallets users are looking at right now.

$Limits are per account, so every key on the account draws on the same budget.
06

What to add next

  • A users and follows table in node:sqlite, so the follow list survives a restart and one stream can serve every user who follows an address.
  • A token chip on each profile with SPL token balance.
  • A failed tab that reuses the log checks from Failed-mint monitor.
  • Server-sent events to the browser, one connection per user, fed from the shared stream.
07

Where it ends

  • History is the 30-day address index at most. A new user who follows an old wallet sees 30 days, and an empty page past that is the index's age limit and says nothing about the wallet's first transaction.
  • logsSubscribe takes one mention per subscription. Fifty follows are fifty subscriptions at 25 credits each, and a transaction that mentions two of them arrives twice.
  • accountSubscribe stays silent for a plain SOL wallet. A balance feed uses logsSubscribe mentions plus getBalance.
  • Anyone can put your followed address into a transaction, so unsolicited rows will appear. A feed needs a filter: hide failed rows, hide tiny transfers, keep a mute list.
  • A row records that a transaction happened; your code turns swaps, mints and transfers into sentences.
  • There is no profile data. Names and pictures come from your own table.
  • The code never signs or sends, so it has no posts, likes or tips. Those need a writing path you build and test yourself.
08

When it goes wrong

what goes wrongwhat to do
getSignaturesForAddress answers 429.The code retries once after the wait the server names. If it repeats, the code prints a skipped line for that wallet. Widen the gap to your plan's rate (0.24 req/s on Free) and check what else on the account is calling, because the limit is shared across its keys.
A followed wallet returns an empty history.Either the wallet has been quiet for 30 days or more, or the page is past the address index's age limit. The index keeps 30 days at most, so an empty page does not mean the wallet never transacted.
The subscribe reply is an error, or the socket closes straight away.Read the close code and reason the code prints, then check CARBIUM_KEY and that the account is under its socket and subscription caps. A refused subscription is free, but each reconnect pays the 25-credit open again for every subscription that is accepted.
The same transaction shows twice.It mentions two followed addresses and prints one live row per subscription, or it landed during the backfill and appears as a history row and a live row. Keep a Set of signatures and skip repeats.
No live rows print while the history prints.The followed wallets are quiet. Add a busier address to see rows. For a plain SOL wallet, do not switch to accountSubscribe, which stays silent: keep logsSubscribe mentions and read the balance with getBalance.
Credits fall faster than the numbers above.Measure the MiB received. A program address or a busy wallet streams every transaction that mentions it. Follow fewer busy addresses live and poll them instead.
09

Questions

Do I need my own program to build a social app on Solana?

Not for a feed. Reading public transactions needs no program. You need a program or a signed-message scheme only when you add writes such as posts or tips.

Should the follow list live on chain?

Start off chain. A row in your database costs no fee and can be edited or deleted. On chain, each follow is a public transaction that pays a fee.

Will this run on the Free plan?

Yes for a handful of follows. The backfill spaces its calls 4.3 seconds apart to stay under 0.24 req/s, and each live subscription opens at 25 credits against a grant of 500K.

Why logsSubscribe and not accountSubscribe?

accountSubscribe stays silent for a plain SOL wallet. logsSubscribe with a mention fires on any transaction that lists the address, so it covers wallets that only move SOL.

How far back can a new user's feed go?

30 days at most, because getSignaturesForAddress reads Carbium's own address index. For longer history, store the rows yourself from the day a user joins.