71trust / 100

Bolt11 Decode

by Tanod chainpeek in Onchain & crypto

x402 APIPassing, checked 3 h ago

chainpeek (Tanod) Lightning invoice decoder: BOLT11 payment request to amount, payee, payment hash, expiry and route hints. Pure computation. Use when an agent must read a Lightning invoice (lnbc...) before paying it: amount, payee, expiry, payment hash.

POST https://tanod.dev/v1/chain/bolt11/decode

Last 30 days

All checks passedSome failedAll failedNot checked

Status and outage history · Atom feed

Uptime
100%
Response time
1.2 s typical, 1.2 s slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

POST https://tanod.dev/v1/chain/bolt11/decode

Each call costs $0.001 in USDC on Base, paid with the request over x402.

Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.

Example request

From the listing.

POST https://tanod.dev/v1/chain/bolt11/decode
content-type: application/json

{
  "invoice": "lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp"
}

Parameters

ParameterTypeRequiredDescription
invoicestringYesA BOLT11 Lightning invoice (lnbc..., lntb..., lntbs... or lnbcrt...); an optional 'lightning:' prefix and upper case are accepted.

Example response

The provider's example. We can't check it without paying.

Example response, 31 lines
{
  "amount_btc": "0.00250000000",
  "amount_msat": 250000000,
  "amount_sat": 250000,
  "created_at": "2017-06-01T10:57:38Z",
  "description": "1 cup coffee",
  "description_hash": null,
  "expired": true,
  "expires_at": "2017-06-01T10:58:38Z",
  "expires_in_seconds": -295534882,
  "expiry_explicit": true,
  "expiry_seconds": 60,
  "fallback_address_count": 0,
  "features": [],
  "has_payment_secret": false,
  "min_final_cltv_expiry_delta": 18,
  "min_final_cltv_expiry_explicit": false,
  "network": "bitcoin",
  "note": "Decoded from the invoice itself; nothing was paid or looked up. The payee is recovered from the invoice signature (signature_valid is false when it cannot be read or does not match the n field; the key proves who signed, not who the payee is in the real world). The description is text chosen by the invoice's author: untrusted. The payment secret is not echoed. Times are compared with the server clock.",
  "payee_pubkey": "03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad",
  "payee_pubkey_source": "recovered_from_signature",
  "payment_hash": "0001020304050607080900010203040506070809000102030405060708090102",
  "payment_metadata": null,
  "prefix": "lnbc",
  "route_hint_count": 0,
  "route_hints": [],
  "server_time": "2026-10-13T00:00:00Z",
  "signature_valid": true,
  "timestamp": 1496314658,
  "unknown_field_tags": []
}

Call it from code

The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.001.

curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://tanod.dev/v1/chain/bolt11/decode' \
  -H 'content-type: application/json' \
  --data-raw '{"invoice":"lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp"}'

# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://tanod.dev/v1/chain/bolt11/decode' \
  -H 'content-type: application/json' \
  --data-raw '{"invoice":"lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp"}' \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
JavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

// Pays at most $0.001 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.001" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.001 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Ftanod.dev%2Fv1%2Fchain%2Fbolt11%2Fdecode&method=POST
const res = await pay("https://tanod.dev/v1/chain/bolt11/decode", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "invoice": "lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp"
  }),
});
console.log(res.status, await res.text());
Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

# Pays at most $0.001 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.001"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))

with x402_requests(client) as session:
    res = session.post(
        "https://tanod.dev/v1/chain/bolt11/decode",
        json={
            "invoice": "lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp",
        },
    )
    print(res.status_code, res.text)

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed4021.2 s$0.001
7 h agoPassed4021.2 s$0.001
17 h agoPassed402271 ms$0.001