Cardano Alerts watches the chain for you. You give it the addresses, stake keys, native-asset policy IDs and script hashes you care about, and it tells you when something happens to them: funds received or spent, tokens minted or burned, a script invoked. This post explains what happens between a new block and your application, and how to connect over each channel.
From block to event
The path has four steps, and only the first and last involve you.
- Your watch list. You add, pause and edit criteria yourself on the search management page. Each criterion has a network (mainnet or preprod) and a
min_confirmationsdepth. - The scan. Every 30 seconds we read the newest blocks and check them against every active watch list. A block is only used once it has at least your
min_confirmationsblocks on top of it. Mainnet is scanned by two independent pipelines, so one can fail without stopping your alerts. - Your event table. Each match is written into a table that belongs to your account alone. It is kept for 30, 90 or 365 days depending on your plan, and it is what the REST API reads from.
- Delivery. You read the table over the REST API, or we push each new event to you over MQTT or Kafka.
What an event looks like
Pull and push deliver the same event. The REST API returns events in a page; MQTT and Kafka wrap each one in a small envelope so heartbeats can share the stream.
{
"id": 48213,
"detected_at": "2026-09-03T14:22:07Z",
"slot_no": 154823011,
"epoch_no": 612,
"block_time": "2026-09-03T14:20:51Z",
"tx_hash": "3a1f2b...e92c",
"address": "addr1q9...xyz",
"event_type": "utxo_received",
"network": "mainnet",
"confirmations": 3,
"data": { "lovelace": "125443210", "assets": {}, "output_index": 2 }
}
On MQTT and Kafka the same object arrives as {"type": "event", "payload": {…}}, and every 10 minutes you also get {"type": "heartbeat", "last_event_id": …, "network": …}, so a quiet chain can't be mistaken for a broken connection.
Four rules make a robust consumer:
- De-duplicate on
id. Delivery is at-least-once: a retry or a failover can send an event twice. If a push keeps failing, the event is still in your table for the REST API. - Keep one cursor per network. IDs are unique within a network. If you watch mainnet and preprod, keep a separate
since_idfor each. - Filter push messages on
network. Your push topic carries every network you subscribed to. - Treat
confirmationsas a hint. The REST API returns an estimate; push sendsnull. Yourmin_confirmationssetting is what we enforce.
Connecting your application
Everything is TLS with a public certificate, so standard client libraries work without extra trust settings. The credential you connect with decides which customer you are, which is why no request ever names someone else's data.
Before you start
- Create an access token on the token management page. The page also shows your
customer_id, which is part of your MQTT and Kafka topic names. Store the token like a password. - Add at least one criterion on the search management page. Events start from the next scan.
- Kafka only: we create your Kafka user and topic and send you the login. Get in touch after sign-up.
Try it in a minute: the BCA alert client
The quickest way to watch your own stream is our open-source client, bca-alert-client on GitHub (Apache-2.0). The Go client is published as a ready-to-run Docker image for amd64 and arm64, so there is nothing to install or build. Pass your credentials as environment variables and pick the channel:
export Customer_id="12345-67890-..."
# MQTT: your access token
export Token=bca_...
docker run --rm -e Token -e Customer_id \
ghcr.io/blockchain-data-analytics/bca-alert-client-go mqtt
# Kafka: the password we sent you
export Kafka_password=...
docker run --rm -e Kafka_password -e Customer_id \
ghcr.io/blockchain-data-analytics/bca-alert-client-go kafka
Every event and heartbeat is printed as it arrives:
2026-09-08T14:55:01.123+00:00 [mqtt/mainnet] event utxo_received id=423726482049734665 slot=197313019 block_time=2026-09-08T14:55:10Z epoch=654 confirmations=-
address: addr1q8055...
tx_hash: 5f2c0a...
data: {"lovelace":"1500000","assets":{},"output_index":0}
2026-09-08T15:05:00+00:00 [mqtt/mainnet] heartbeat last_event_id=423726482049734665 channel_status=ok
-e Name without a value passes the variable from your shell, so your credentials stay out of the command line. Add -e Network=mainnet to show one network only. The image is rebuilt on every change to the client: use latest, or a sha-<commit> tag to pin a version.
When you're ready to build on it, the Go client is written to be extended. A listener hands every message to one or more sinks, and a sink is a single method:
type Sink interface {
Handle(ctx context.Context, m alert.Message) error
}
Write a sink that forwards alerts into your own system, and run it next to the console sink or instead of it. On Kafka, an offset is committed only after every sink has handled the record, so a restart picks up where your code stopped. The repository also has a Prolog client, and its README covers every setting, including persistent MQTT sessions and a watchdog for long-running use. The clients are demo implementations: they show how to receive alerts, but aren't meant to run in production as they are. Events can be missed while a client is down or delivered twice, so reconcile against the REST API before acting on funds.
Pull: the REST API all plans
Ask for everything after the last id you have processed. The response holds up to limit events, the cursor to use next, and whether more are waiting. The rate limit is 10 requests per second on Developer and 20 on Team.
curl "https://api.blockchain-applied.com/api_bca/v1/cardano-alerts/events?since_id=0&limit=100&network=mainnet" \
-H "Authorization: Bearer $TOKEN"
import time, requests
URL = "https://api.blockchain-applied.com/api_bca/v1/cardano-alerts/events"
since = load_cursor("mainnet") # 0 the first time
while True:
r = requests.get(URL, timeout=10,
headers={"Authorization": f"Bearer {TOKEN}"},
params={"since_id": since, "limit": 100, "network": "mainnet"})
r.raise_for_status()
page = r.json()
for ev in page["events"]:
handle(ev) # idempotent: de-duplicate on ev["id"]
since = page.get("next_since_id") or since
save_cursor("mainnet", since)
if not page["has_more"]:
time.sleep(30) # the scan runs every 30 s
Pull is also your safety net when you use push: after an outage on your side, page through from your last stored id.
Push: MQTT Team and Enterprise
Your access token doubles as your MQTT username; the password is ignored. Subscribe to your own topic and events arrive shortly after the scan finds them, with QoS 1.
mosquitto_sub -h mqtt.blockchain-applied.com -p 8883 --tls-use-os-certs \
-u "$TOKEN" -P x -t "bca/$CUSTOMER_ID/events"
import json
import paho.mqtt.client as mqtt
def on_message(client, userdata, msg):
m = json.loads(msg.payload)
if m["type"] == "event":
handle(m["payload"]) # de-duplicate on m["payload"]["id"]
c = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
c.username_pw_set(TOKEN, "x")
c.tls_set() # system CA roots
c.on_message = on_message
c.connect("mqtt.blockchain-applied.com", 8883)
c.subscribe(f"bca/{CUSTOMER_ID}/events", qos=1)
c.loop_forever()
The Go client does the same, with reconnects and a heartbeat watchdog built in.
Your token can only subscribe to bca/<your customer_id>/…. Any other topic, including wildcards such as bca/#, is refused, and publishing is not allowed.
Push: Kafka Team and Enterprise
Each Kafka customer gets one topic with one partition, so events arrive in order, and Kafka keeps them for 7 days on Team and 30 days on Enterprise (up to 1 GiB per topic). Your consumer group name must start with bca.<customer_id>.; offsets are stored in the group, so a restart continues where it stopped.
kcat -b kafka.blockchain-applied.com:9093 \
-X security.protocol=SASL_SSL -X sasl.mechanism=SCRAM-SHA-512 \
-X sasl.username="cust_${CID}_kafka" -X sasl.password="$KAFKA_PASSWORD" \
-G "bca.$CID.reader" "bca.$CID.events"
from confluent_kafka import Consumer
import json
c = Consumer({
"bootstrap.servers": "kafka.blockchain-applied.com:9093",
"security.protocol": "SASL_SSL",
"sasl.mechanism": "SCRAM-SHA-512",
"sasl.username": f"cust_{CID}_kafka",
"sasl.password": KAFKA_PASSWORD,
"group.id": f"bca.{CID}.reader", # must start with bca.<customer_id>.
"auto.offset.reset": "earliest",
})
c.subscribe([f"bca.{CID}.events"])
while True:
msg = c.poll(1.0)
if msg is None or msg.error():
continue
m = json.loads(msg.value())
if m["type"] == "event":
handle(m["payload"])
The Go client uses the group bca.<customer_id>.go-client by default.
The bootstrap address hands your client on to the individual brokers, kafka-0 and kafka-1.blockchain-applied.com, so allow those names through your firewall too.
Which channel fits
| REST pull | MQTT push | Kafka push | |
|---|---|---|---|
| Plans | all | Team, Enterprise | Team, Enterprise |
| Latency | your polling interval | seconds after the scan | seconds after the scan |
| Replay | whole table retention | none, use pull to catch up | 7 or 30 days in the topic |
| Credential | access token | access token | Kafka user + password |
| Good for | batch jobs, scripts, catch-up | bots, lightweight services | data pipelines, stream processing |
On Team, one push channel is active at a time.
What's coming
planned Webhooks, signed with a per-customer secret, for teams that would rather receive an HTTPS call than run a consumer. planned WebSocket or Server-Sent Events, for dashboards and browser apps that want a live stream with the same access token. Coverage of the preview testnet is also on the list.
Your data stays yours
Every customer has their own table, their own MQTT and Kafka topics, and their own credentials, and the credential you connect with decides which customer you are. We wrote up how that separation works, and how we checked it with a formal model, in How Cardano Alerts keeps each customer's data separate.