Chiliz

Case 02

Making an application the source of truth for a financial calculation

Context

Chiliz is a blockchain company best known for fan tokens — crypto tokens tied to sports clubs — and for running its own chain. My last team there: four to five backend developers, no dedicated frontend, tasked with building a new tool for the finance branch — the team that trades the company’s own tokens internally. The tool helps decide whether to buy, sell or stake. About 90 tokens, one liquidity pool per token. Trading those tokens, and the percentage taken on exchanges, is a core revenue stream for the company; exact figures are confidential.

The project had been started in Python, in-house, on the idea that Python is what comes up most with AI. Nobody in the company had mastered it. So we went back to what the team could actually run in production: PHP and Symfony. Same logic for the frontend: rather than a JS framework nobody knew, Symfony UX and Twig — a decision I contributed to.

The problem

At the heart of the tool: the NCS and CS calculation — non-circulating supply and circulating supply — that is, how many of our tokens are in circulation and how many are not. Every trading decision depends on it. Until then, the calculation was done by the BI (business intelligence) team, through an export treated as the source of truth. The goal: have the application take over the calculation, prove it correct against BI, then become the reference itself.

One property weighs on everything else: the calculation is cumulative. Each value depends on every earlier transaction. For an up-to-date result, you have to replay the entire history.

What I decided

The proof of concept already existed. I rewrote the implementation documentation — how we bring this into the application — then broke the epic down into stories and tasks. The team estimated it in refinement. I took most of the implementation and ownership of the subject. First version in one month.

Validation against production data was done in pair with a colleague, because I did not have production access.

What pushed back

The rule we had been given was clean. The history was not. From the first tests, discrepancies with BI: the existing data was full of manual adjustments made over time, and since the calculation is cumulative, a single exception in the past shifts everything that follows.

The real work was therefore an exception hunt: find out who, what, when, why. We also realised some information was missing and lived on the blockchain. Querying the chain on every calculation cost too much time; we decided to import that data into our database and query it directly.

Last source of discrepancy: precision. Amounts have 18 decimal places, bounded. Our libraries handle them correctly; Redshift, on the BI side (AWS’s data warehouse), less so — hence rounding differences that accumulate over a cumulative calculation. We defined a tolerance rather than chase a perfect equality that was not on our side.

Non-technical friction: expectations that needed aligning. A good part of the work was agreeing on what we were delivering before building it.

Outcome

What it shows

I can take a proof of concept and turn it into software that holds: implementation documentation, breakdown, end-to-end ownership. I know the business rule and the real data are two different things, and that the work is almost always in the gap between them. I choose technologies on what the team can maintain, not on fashion. And when a calculation drives decisions, I do not consider it delivered until it is proven against the existing reference, with an explicit tolerance.

Case 03

Batching blockchain transactions without all-or-nothing

Context

Same application as the previous case, but the other half of the product: beyond calculations, the tool let the finance team execute all its on-chain operations on the token pools themselves — transfers between wallets, deposits into a pool, withdrawals, swaps. Those operations were built first; the decision-support tools came on top.

On the technical side: PHP and Symfony, PostgreSQL, AWS SQS/SNS, Node.js and TypeScript, Fireblocks for the wallets.

The problem

A trader works on several pools at once. One operation at a time meant going to a pool, making the deposit, coming back, going to the next one, and so on — four times, ten times. The need was simple: “I want to deposit this amount into these four pools, in one entry, and have it go.”

The easy way, and why I didn’t take it

On the chain, one transaction = one signature. There is a “batch” transaction type that groups several sub-transactions under a single signature — but it is atomic: the slightest execution error in one sub-transaction (insufficient funds on one pool, for instance) fails the whole batch. For a trader, losing the three deposits that were fine because the fourth lacked funds is worse than signing four times.

What I decided

Chaining: send the first transaction of the batch, wait for the chain to confirm it, then send the next. One signature per transaction, but a single entry on the user’s side, and above all partial success is possible — a failing transaction does not prevent the others from executing.

The architecture around it:

What pushed back

The single signature. The finance team also wanted to sign only once. The only way was the chain’s atomic batch, with the all-or-nothing we had just ruled out. With no satisfactory solution and with priorities changing, the subject was deprioritised. Chaining covered most of the value: the single entry and the resilience.

Outcome

What it shows

I start from the user’s need (one entry, not one signature) and identify what actually carries value in it. Faced with a platform constraint, I compare options on their failure modes — atomic and brittle versus chained and resilient — and pick the one whose failure costs least. I design for observability: two levels of status, a listener on the source of truth. And I can say a subject did not make it to the end — and why — without dressing it up as “delivered”.

Case 04

Taking over a drifting project without steamrolling its owner

Context

Same application. The subject: pool creation. When the company issues a new token, a matching liquidity pool has to be created — token against crypto, or token against token — and seeded with a first deposit. That first deposit sets the conversion ratio, hence the starting price at which trading begins. Goal: a single entry point in the application, a single confirmation, and a process as automated as possible.

A saturated team: everyone owning a subject with a close deadline. This one had been designed and carried by a junior developer I was mentoring.

The problem

Two problems, one inside the other.

The subject was drifting. The developer asked a lot of questions, no longer knew where he was going, produced things that broke in testing and could not debug them. Management noticed. One month late, strong pressure to deliver.

The initial design was wrong. V1 made two blockchain calls: create the pool, then deposit. Between the two, a window: anyone holding tokens could deposit before us and take ownership of the pool. And the real process was much longer than two calls: wallet allowances on each token, creation, allowance on the pool, indexing — with none of those steps leaving a trace. We knew neither what had happened, nor when, nor why.

What I decided

The takeover. I first helped as backup, on debugging. Then, under pressure and because I was losing time on both sides — my own subjects and his questions — I went to the scrum master and the tech lead to propose taking over ownership. The developer himself asked for it: too much pressure, he would not make it. I took it over because I was already mentoring him and had a clear idea of what needed doing.

He stayed in every review. We talked offline: I walked him through each choice, why, and under which conditions. Part of what I implemented was the feedback I had already given him — add logging, represent each event in a table with a status.

The rework. Switch to a method that creates the pool and makes the first deposit in a single transaction: the window closes, and we save a signature. All allowances integrated as automated prerequisites of the process. And I reapplied to pool creation the tracking mechanism I was building in parallel for allowances: an event table per step, each with its status, to know at any moment where the process stands.

What pushed back

The company’s wallets were managed by Fireblocks, an institutional custody platform. Some actions and some wallets required approval from an admin account — the user only signed part of it, the rest went through the admin. On top of that, Fireblocks whitelisting, also subject to admin signature. Every step of the process had to accommodate these two layers of approval.

Outcome

What it shows

I spot when a subject is drifting and act before it sinks — through management, not around it. I take the load without taking the place: the developer asked to step out, he stayed in the reviews, he had every decision explained. I challenge a design that “works” when its failure mode is unacceptable. And I design for tracking: if you cannot tell where a process stands, you can neither debug it nor trust it.