What Webhooks Are Useful for Tracking Wallet Deposits?

The webhook events that matter for tracking crypto wallet deposits and transfers, the fields each needs, and how to handle them reliably, with examples.

· 7 min read

If you track crypto wallets, deposits or payments, webhooks are how the blockchain reaches your code: instead of asking a node every few seconds whether something happened, a service calls your server when it does. Not every event is worth a webhook, though, and a webhook without the right fields leaves you calling an API anyway. This guide lists the webhooks that are actually useful for tracking wallet deposits and transfers, and what to look for in each.

The five webhooks worth having

  1. Incoming transfer to a watched address. The basic one: money arrived at an address you care about. It is how you detect deposits to addresses you created yourself, payments from clients, or funds reaching a treasury wallet.
  2. Outgoing transfer from a watched address. Money left. Useful for security alerts on hot and cold wallets, for reconciling withdrawals you made, and for noticing when a counterparty moves funds.
  3. Deposit credited to a user. One step further than a raw transfer: the deposit was matched to one of your users and its value is known, in dollars, after fees. This is the event an exchange or a game credits a balance from.
  4. Payment completed. For checkouts and invoices: one payment request was paid in full. You fulfil the order from it.
  5. Payout completed or failed. For money going out: a withdrawal or payout you sent was confirmed on the chain, or could not be sent and was returned. You mark the withdrawal done or give the amount back.

Everything else (new blocks, mempool activity, gas prices) is noise for most products. Start with the events that change what your app shows a user.

What a good deposit webhook contains

  • Which address it is about, and your own id for it (the user or order it belongs to), so you never have to look it up.
  • The token and the amount, both in raw form (contract address, smallest unit) and readable form (symbol, whole units), so you cannot misread decimals.
  • Direction: whether the address received or sent.
  • The transaction hash and network, so you can link to an explorer and audit it later.
  • A stable event id, the same on every retry, so you can ignore duplicates.
  • Only confirmed transfers. A webhook for a transaction that can still be dropped is a webhook you might have to undo.

This is what a transfer of a tracked wallet looks like on LirChain:

Incoming or outgoing transfer
{
  "type": "wallet-tracker",
  "event": {
    "id": "95e04e32-5c98-4f68-8c62-f487bda0ed5c",
    "tracker_id": "67153a22-af19-4352-ab8e-041006c76c7b",
    "external_id": "treasury",
    "project_id": "ea54aa6c-21d7-46a4-b1fe-c0703f74a2af",
    "address": "0x52ae0f1c8d4b7a90e3b6c2d15f8a47e09b3c91f3",
    "created_ms": 1791504120904
  },
  "transfer": {
    "network": "ethereum",
    "block_number": 26151012,
    "tx_hash": "0x4e3a…9f21",
    "log_index": "28",
    "from_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
    "to_address": "0x52ae0f1c8d4b7a90e3b6c2d15f8a47e09b3c91f3",
    "asset": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "amount": "102870865",
    "symbol": "USDC",
    "amount_units": "102.870865"
  }
}

event.address is the tracked address, so it received the transfer when it equals to_address. For a deposit credited to one of your users, the webhook carries the value in dollars and the fee instead:

Deposit credited to a user
{
  "type": "deposit-wallet",
  "deposit": {
    "id": "41b0d4fe-8b49-4623-bd8f-6f04586b06c9",
    "wallet_id": "3f4911a7-2c26-4f9c-a97c-80b25b6feb8c",
    "external_id": "customer-7731",
    "project_id": "3d6b1130-da92-4ddf-bad2-93f898993c39",
    "network": "ethereum",
    "asset": "USDT",
    "contract": "0xdac17f958d2ee523a2206206994597c13d831ec7",
    "amount": "250.5",
    "pay_amount": "250.5",
    "fee": "1.2525",
    "receive_amount": "249.2475",
    "created_ms": 1791503990112
  }
}
Payout completed or failed
{
  "type": "payout",
  "payout": {
    "id": "8a1f4c2e-6d3b-4f70-9c15-2e7b0a94d6c3",
    "external_id": "user-5521",
    "network": "polygon",
    "asset": "USDT",
    "contract": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
    "address": "0x52ae0f1c8d4b7a90e3b6c2d15f8a47e09b3c91f3",
    "amount": "25.50",
    "fee": "0.1275",
    "receive_amount": "25.50",
    "pay_amount": "25.6275",
    "status": "completed",
    "tx_hash": "0x9b2c…4e17",
    "created_ms": 1791506100412,
    "processed_ms": 1791506131870
  }
}

Making webhooks reliable

  • Retries: your server will be down sometimes. A sender that retries for a while, with the same event id, means a deploy does not lose deposits.
  • Idempotency: store the event id and skip one you already handled. Retries make duplicates normal.
  • Signatures: check that the request came from your provider before you credit money. Anyone can POST to a public URL.
  • Confirmations: wait until a transfer is safely confirmed, which differs per chain: 12 blocks on Ethereum, BNB Chain and Polygon, 20 on Tron, 3 on Bitcoin.
  • Answer fast: reply 2xx right away and do slow work afterwards, so the sender does not time out and retry.

A handler that does all of the above:

Webhook handler (Node.js, Express)
import crypto from "node:crypto";
import express from "express";

// The project's signing secret, from its settings in the dashboard (whsec_…)
const SECRET = process.env.LIRCHAIN_WEBHOOK_SECRET;

// Use a table in your database instead of memory in production
const handled = new Set();

function verifyWebhook(rawBody, headers, secret) {
    const id = headers["x-webhook-id"] ?? "";
    const timestamp = headers["x-webhook-timestamp"] ?? "";
    const signature = headers["x-webhook-signature"] ?? "";

    // Refuse old webhooks, so one that was captured cannot be replayed later
    if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) {
        return false;
    }

    const expected = "v1=" + crypto.createHmac("sha256", secret).update(`${id}.${timestamp}.${rawBody}`).digest("hex");

    return signature.length === expected.length && crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}

const app = express();

// The body stays raw: the signature is made over the exact bytes that were sent
app.post("/webhooks/lirchain", express.raw({ type: "application/json" }), (req, res) => {
    if (!verifyWebhook(req.body.toString("utf8"), req.headers, SECRET)) {
        return res.sendStatus(401);
    }

    const id = req.get("x-webhook-id");

    if (handled.has(id)) {
        return res.sendStatus(200);
    }
    handled.add(id);

    const body = JSON.parse(req.body);

    if (body.type === "deposit-wallet") {
        const { external_id, receive_amount } = body.deposit;
        console.log(`credit $${receive_amount} to ${external_id}`);
    }

    if (body.type === "wallet-tracker") {
        const received = body.transfer.to_address === body.event.address;
        console.log(received ? "deposit" : "withdrawal", body.transfer.amount_units, body.transfer.symbol);
    }

    if (body.type === "payout") {
        console.log(`payout ${body.payout.external_id} is ${body.payout.status}`);
    }

    res.sendStatus(200);
});

app.listen(3000);

Answer with a 2xx status within 10 seconds. If your server does not, the same webhook is sent again every minute, up to 20 times, each time with the same x-webhook-id header, so keep the ids you handled and skip repeats.

Every webhook is signed with your project's signing secret, which you find next to the webhook URL in the dashboard. The handler above refuses any request whose signature does not match, so a forged webhook cannot make you credit money. How signatures work.

Prefer a chat message to code? Connect your own Telegram bot in the project's settings and the same events are posted to a chat, group or channel, with a link to the transaction. Telegram notifications.

Getting these webhooks without running nodes

The LirChain Wallet Tracker sends the transfer webhooks for any address on Bitcoin, Ethereum, Solana, Tron, BNB Chain and Polygon. Deposit wallets, one-time payments and payouts send the deposit, payment and payout ones. The Free plan tracks 50 wallets, and every webhook is signed and retried.

Questions and answers

What webhooks are useful for tracking wallet deposits and transfers?
Incoming transfers to a watched address, outgoing transfers from it, deposits credited to a user, completed payments, and completed or failed payouts. Each should carry the address, your own id for it, the token and amount, the transaction hash and a stable event id.
Should a deposit webhook be sent before the transaction is confirmed?
Not if you credit money from it. Wait for safe confirmations (12 blocks on Ethereum, BNB Chain and Polygon, 20 on Tron, 3 on Bitcoin), so a dropped transaction never has to be taken back.
How do I avoid crediting the same deposit twice?
Store the event id from the x-webhook-id header and skip any webhook whose id you already handled. Retries always carry the same id.

Try it on the Free plan

Every product is included, and no card is needed to sign up.

Create a free account

Keep reading