If you watch your treasury addresses with Cardano Alerts, your events say something about your business: which wallets you care about, when funds move, which contracts you run. Another customer must never see them, not even one event, not even by accident. This post explains how the service is built so that this holds, and what we did to check it.
Shared scan, separate everything else
Scanning the chain once per network and checking every watch list against it is what keeps alerts fast and affordable. That scan is the only step that sees more than one customer's criteria. The moment it finds a match, it writes the event into a table that belongs to the owner of that criterion, and from there on nothing is shared.
Your own table
Each customer has a separate database schema with its own events table, in a separate database per network. Database permissions are granted per schema to the three internal services that need them. No customer ever receives database credentials: you reach your data only through the channels below, which all answer for one customer at a time.
Your own topics
Push delivery publishes to bca/<customer_id>/events on MQTT and bca.<customer_id>.events on Kafka. The delivery service reads the events from your table and takes the topic name from that same table's name, so the rows it reads and the topic it writes to are chosen by one value. There is no shared topic that several customers filter.
Your identity comes from your credential
None of the three channels lets a request say whose data it wants. The server works it out from the credential, every time:
| Channel | You present | We derive | What you can read |
|---|---|---|---|
| REST API | access token | customer_id from the token's hash | your table, nothing else; the request has no customer parameter |
| MQTT | access token as username | customer_id, checked on every subscribe | bca/<your id>/…, read only |
| Kafka | your Kafka user and password | the Kafka user is tied to your id | your one topic, consumer groups starting bca.<your id>. |
| Watch list | your website login | customer_id from your account | your own criteria; another customer's criterion id returns 404 |
Guessing doesn't help either. A subscription to bca/# or +/…/events is refused because it isn't inside your own prefix. Customer ids are fixed-length UUIDs and every check includes the separator after the id (bca/<id>/, bca.<id>.), so one customer's id can never be the start of another's. Connections without a valid credential are refused, Kafka denies anything that has no explicit permission, topics are never created on demand, and customers can't publish anywhere. If the identity lookup itself fails, access is denied, not granted.
Encrypted all the way to the broker
Every connection is TLS. Our ingress routes MQTT and Kafka connections by host name without decrypting them, so encryption ends inside the broker that makes the access decision.
Checking the pipeline with TLA+
The design argument above is about each layer on its own. What it doesn't cover is the system in motion: two mainnet pipelines writing the same events, delivery workers taking over from each other, retries, two networks running side by side, and the people who set up new customers. To check that, we wrote a formal model of the delivery pipeline in TLA+ and let the TLC model checker explore every reachable state.
The model contains what decides where an event goes:
- customer setup: the steps that write a customer's id into the system,
- one scanner per pipeline, writing matches into the owner's table,
- one delivery worker per pipeline, competing for a lease so only one of them delivers per network,
- retries with a maximum number of attempts, and delivery state kept separately in each pipeline's database.
It runs on two customers, two networks and the three pipelines we operate, with the timing ratios of the real deployment. The property we care about most says that only the owner of an event can read the topic it was published to:
\* Only the event's owner can read the topic it was published to.
NoCrossCustomer ==
\A m \in Delivered : Readers(m.topic) \subseteq {m.event.owner}
\* Setup is one-to-one: each customer's steps used one id,
\* and no two customers share an id.
Consistent ==
/\ \A c \in Provisioned : prov[c].api = prov[c].schema
/\ prov[c].api = prov[c].kafka
/\ \A c, d \in Provisioned : c # d => prov[c].api # prov[d].api
The property is deliberately the strict form. "The event went to the owner's topic" is not enough: if two customers had been set up with the same id, the event would go to the owner's topic and a second customer could still read it. So the model asks who can read the topic, not only where it went.
Where your customer_id gets written
Isolation rests on one value, your customer_id, being the same everywhere. The model follows it through the three places where it is written:
What the model checker found
We ran each scenario through TLC. Each one has an expected result, and the check script fails if any scenario stops giving it.
| Scenario | Result |
|---|---|
| Deployed configuration | holds no cross-customer or cross-network delivery in any of 285,724 reachable states, and every event is eventually delivered or left for the REST API |
| Any id may be typed at any setup step | holds whenever setup is one-to-one, across all 9.7 million states |
| Wrong id on the access-token link (1) | leak found by the model; this link is now written automatically from your account |
| Wrong id on the table (2) | no leak events can't be written, so they are lost, not exposed |
| Wrong id on the Kafka user (3) | leak found by the model; this is the setup step we treat with the most care |
| A pipeline started without its network setting | wrong network found by the model; the network is set explicitly in every deployment |
This turns a hunch into a checked statement. With the code as deployed, the only way an event could reach another customer in the model is a setup step that used the wrong customer_id. The routing itself, including the scanners, the lease hand-over and the retries, never sends an event to the wrong reader. And of the three setup steps, only two could cause a leak; one of those, the link between your access token and your account, is no longer typed by anyone.
The same model found two delivery issues that are about duplicates rather than isolation: a lease timeout that was once shorter than the polling interval, which let two workers both deliver, and the fact that a hand-over between pipelines can replay recent events. That is why we ask you to de-duplicate on id.
What a model can and can't tell you
A model is a precise description of the system, not the system itself. The model lives next to the service code, with a table that maps each part of it to the code it stands for. Like any model check, it covers a small instance: two customers and our three pipelines. The routing treats every customer the same way, which is what makes a small instance a meaningful test. It does not cover the REST API's own code, the contents of heartbeats, or the TLS libraries we rely on. For the shared access token we also used a second tool, ProVerif, to check what a leaked token could reach.
What the model gives you is narrower and more useful than "it's secure": a precise list of the conditions under which isolation holds, and confirmation that the moving parts of the pipeline can't break it on their own.
In short
- Your events are written to your own table and published to your own topics.
- Your credential decides who you are; no request can name another customer.
- Everything denies by default, and an error in the identity check denies access.
- A TLA+ model of the delivery pipeline shows that only a mistaken customer id at setup could cause a cross-customer delivery, and points us to exactly which setup steps those are.