Development of an Exchange Rate Lock System (Rate Lock)

A rate locked for the duration of a transaction removes the main source of disputes between the parties. We develop a turnkey rate lock system: we configure price hold modes, recalculation rules, and protection against discrepancies. The share of disputed transactions and manual reconciliations is reduced severalfold.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1359
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Why a rate locking system breaks in a volatile market

A rate locking system promises one thing: the client confirms the exchange rate lock and receives exactly the price they saw on the screen. While the market is calm, the promise holds.

As soon as the price starts moving within a minute, the chain “price source, calculation, confirmation, execution” breaks in several places at once.

The first is divergence of quotes between sources. An exchange, a liquidity pool, and an aggregator produce different values, and the averaging window adds lag: by the time of calculation, the number no longer matches the market.

The wider the spread between venues, the stronger the quote divergence and the more often the system locks in a price that no longer exists on the market.

The second is confirmation delay. Time passes between trade confirmation and its inclusion in a block, and in a volatile market this costs percentage points of movement.

This leads to price slippage: the client receives execution worse than the locked rate, and if the gap exceeds the protection threshold, the trade cancellation triggers.

The most painful part is precisely trade cancellation at the peak of a move. The client sees a rejection exactly when the price has moved in their favor and goes to someone who executed.

Worse, if the rejection arrives with a delay: liquidity is reserved, the rate is locked, but the trade is not closed — the settlement balance does not reconcile, and someone has to sort it out manually.

Let us break down how this chain is closed.

What a managed trade price delivers: the effect on timelines and shares

A signed quote is an obligation, not a picture on a screen. The rate source (Chainlink) returns the value together with a timestamp and a time-to-live, and the exchange contract accepts only those orders whose signature matches and whose window has not expired.

If verification fails, the exchange is not created at all: the user sees a clear error instead of a partially executed trade at a moved price.

Trade confirmation time is reduced because the order now has a single deterministic path: signature verification, funds reservation, settlement. There is no waiting for external rate reconciliation or repeated recalculations — the predictable trade price is known before sending.

The window from click to confirmation goes from tens of seconds to single-digit seconds, and this is a guarantee defined by the quote’s time-to-live, not an average under load.

The share of canceled orders falls for another reason: the client no longer aborts the trade because of market movement between the price display and confirmation.

Cancellation remains a conscious action, and an expired quote does not kill the order but returns it for recalculation at the fresh rate. The number of incomplete exchanges drops severalfold, and every confirmed order reaches settlement.

Manual ticket reviews become automated. A quote has an identifier, all signatures and status transitions are written to a log, so a disputed trade can be reproduced from the log in minutes rather than reconstructed from correspondence.

Tickets like “where did the price go” disappear in normal operation, and support deals with real failures.

Three metrics — time, cancellation share, manual reviews — are displayed on a monitoring dashboard, so the effect of a managed price is visible in numbers, not in words.

Price hold modes: hard, sliding, and conditional

The hold mode determines who bears the risk of rate movement between price calculation and exchange execution.

In the system, it is defined by two parameters: the price hold window — how long the locked value lives — and the per-trade limit — what volume can be closed at this price without recalculation. Below are three modes and the boundaries beyond which each stops working in your favor.

Option When it fits Limitations
Hard price hold The amount to receive is known in advance: payouts, settlements with a fixed quota, operations with low tolerance to deviation Market movement risk lies entirely with the venue, so the window is short and the per-trade limit is lower than in other modes
Sliding price hold Large volumes and periods of volatility, when executing the trade is more important than holding a specific value The final amount is not guaranteed: the price follows the market within a protective corridor; beyond its boundary the trade stops and requires confirmation
Conditional price hold Locking by event: threshold reached, specified time, counterparty status, or settlement stage An external data source and explicit cancellation logic are required — if the condition is unavailable, the order expires rather than executing at the last price

The modes are not mutually exclusive: the core applies hard price hold to standard orders, sliding to large ones, and conditional works as insurance for scenarios with deferred settlement.

Switching is set by a rule at the trade level, so the same integration covers different exchange schemes without rewriting the logic.

Before putting it into operation, we test on a staging bench the window expiration, order splitting by limit, and unavailability of the price source — these three cases are exactly what cause accounting discrepancies.

Implementation procedure: from order flow audit to handover

We start with an audit of the order flow: we look at how a quote travels from source to client, where the rate is actually locked, and at what point it can change unnoticed by both parties.

The result of this stage is a map of bottlenecks and a list of scenarios in which the client receives a rate worse than stated.

  1. Order flow audit — we review logs and queues, calculate the share of orders with rate divergence, and record the delay between confirmation and actual holding.
  2. Rate calculation scheme — we describe quote sources, their weight, spread, and freshness window; we formalize the rule for rejecting stale values in a specification with examples.
  3. Configuration of hold rules — we set the lock window, volume limits, conditions for partial execution and cancellation, and system behavior when the quote stream breaks.
  4. Load testing — we reproduce the profile of real traffic with spikes, measure the time from order submission to lock, and make sure the hold rules do not degrade at peak.
  5. Procedures — we describe for support and the on-call shift how to read divergence logs, what to do when the source stops, and how to document disputed cases.
  6. Handover — we provide configurations, the deployment scheme, test scenarios, and documentation, train the team, and remain available during the support period.

Each step is closed with an artifact that you accept: a flow map, a calculation specification, a set of rules, a load report, procedures, and a documentation package. This way the result is verified before production rollout, not after.

Delivery package: settings, schemes, and calculation procedures

A rate locking system cannot be considered delivered if it can only be operated but not reconfigured.

That is why the package includes artifacts by which the customer’s team can change parameters themselves, and a third-party contractor can understand them without reverse engineering.

  • Configuration files — quote sources, rate hold window, allowable deviation, and trade volume limits. They are edited via configuration, without changing logic or redeploying.
  • Order flow diagrams — the path from submission to execution: where conditions are checked, where collateral is reserved, where the rate is locked, and what happens on failure.
  • Calculation documentation — formulas for execution rate and fees, rounding procedure, source reconciliation rules, and signs of an unexecutable trade.
  • Access rules — roles of operators, administrators, and external systems, a permission matrix, key issuance and revocation procedure, and limits on signing operations.
  • Disputed trade review procedure — filing deadlines, composition of the evidence base, reconciliation with the event log, and a scenario for closing a stuck order.
  • Update and rollback procedure — how a new version is released, who approves it, and how quickly the system returns to previous settings.

Separately, we provide deployment instructions for your environment: changes are tested on a copy before production rollout, so settings and procedures remain working documents, not an appendix to a report.

Case study: how the share of disputed trades was reduced threefold

What was at the input

A mid-sized exchange service: the client clicked “lock rate,” the application remembered the number, and execution went through a separate request to an external quote source.

During sharp market movement, the window between locking and confirmation stretched, and the rate in the trade diverged from the rate at the moment of debit.

Disputed trades accumulated to 4.8% of volume, each ticket took 2–3 days to review — support manually reconciled exchange exports, the internal cache, and CoinGecko data. Up to 11% of orders were canceled by clients themselves without waiting for confirmation.

What was changed

Rate locking was moved to server-side calculation: at the moment of request, a signed rate snapshot with a timestamp is generated, and trade confirmation is calculated from the same snapshot, not from a new request to the source.

The order became idempotent — a unique identifier protects against double debiting when retrying on a poor connection.

We added an allowable deviation threshold: if the rate moves further, the trade is not confirmed automatically but goes to the review queue together with ready context.

What the result was

Share of disputed trades — 4.8% → 1.6%. Ticket review — from two days to 40 minutes: the engineer only needs to open the log where the snapshot, timestamp, and calculation source are stored. The number of canceled orders fell from 11% to 3%.

Divergence between locking and confirmation occurs in 0.1% of trades and is always explainable from the log — calculation stability no longer depends on who pressed the button and at what second.

How the rate is recalculated for partial order execution

The held price is tied not to the entire order but to the volume for which collateral is reserved.

When partial execution of the order arrives, the contract records the price and volume of that execution as a separate entry, and releases the reserve proportionally: 40% of the closed volume releases 40% of the lock.

The remaining part of the order continues to exist as a separate entity with its own volume and its own hold period.

Then the rate recalculation rule comes into play. The “one quote per order” model holds the original price until the end of the hold period — the remainder is executed at the same price as the first part.

The “quote per execution” model revalues the remainder after each partial execution, taking the price from the current state of the source: a verified oracle such as Chainlink serves as that source, not an in-house calculation module.

The choice of model is a trade-off. A hard-locked price is predictable for the client, but during sharp market movement the remainder becomes a convenient target for arbitrage: the order is deliberately filled in parts while the old quote is still alive.

Revaluation removes this risk but adds uncertainty to the order — it is not known in advance at what rate the tail will close.

Therefore the remainder receives a repeated price hold with explicit boundaries. If the deviation from the original rate exceeds the specified threshold, the remainder is not executed: the system cancels it and returns the reserved collateral rather than closing at a stale price.

Each call is tied to the order identifier and execution number, so reprocessing the same event does not double the reserve.

Externally, this appears as a sequential log: how much was executed and at what price, how much remains, at what price the remainder is held, and until when.

Such a log provides unambiguous reconciliation — a discrepancy between the venue’s report and the order state is visible at a specific step rather than dissolving in an aggregate.

Common technical questions about calculation and protection against divergences

Five questions are asked before work starts: the calculation architecture and the set of checks depend on how the answer is structured. Below are short answers in the form in which we give them: without the phrase “we will make it reliable,” but with concrete mechanics.

Where does the rate come from — one source or several?

We take a sample of independent providers and calculate the median, not the average: a single outlier does not move the result. If quote divergence between sources exceeds the specified tolerance, the value is discarded, not averaged.

What exactly goes into the calculation log?

Each lock writes an immutable entry: input quotes with timestamps, the applied tolerance, the final rate, and the request identifier. The log is append-only, and a correction is made as a separate adjustment entry with a reference to the original.

How is protection against manipulation in a thin market structured?

The rate is calculated over a time window, not from a single point: a short-term volume buy-up will not move the result. For pairs with low liquidity, the deviation threshold is widened, and a large order goes for confirmation.

How fresh must the data be at the moment of locking?

Only a value no older than the specified interval goes into the calculation — a stale quote is flagged and discarded. If the stream breaks, the system switches to a backup source and records the switch in the log.

Can the calculation be verified after the fact?

Yes. From the log entry, the calculation is reproduced: the same input data yields the same rate. This makes it possible to review a disputed case without access to the service’s internal logic.

Let’s discuss the task: what is needed to start work

To come back with an estimate and work plan rather than general wording, we need initial data on your locking scenario. Below is what removes most of the uncertainty; we close some items right on the call.

  • Rate sources: in-house or external, how many independent streams, and how divergence between them is resolved.
  • Locking logic: who initiates it, for what period, what happens upon expiration, and whether it can be extended.
  • Behavior on market deviation: allowable corridor, auto-cancellation, manual confirmation by an operator.
  • Roles and access: who places, confirms, and cancels a lock, and what limits apply to the operator.
  • Where the result is calculated: an isolated environment, custodial accounting, or a hybrid scheme.
  • Accounting and reporting: exports for reconciliation, a log of all actions, and history retention requirements.
  • Load: how many locks per day and how many simultaneously at peak.
  • What already exists: contracts, integrations, test benches, and limitations of your infrastructure.

Based on this data, we assemble an estimate and work plan: we break it into stages and record control points and implementation timelines.

We calculate the locking environment, integrations, and fault tolerance separately — this way rollout can be done in parts without waiting for the entire scope. Describe the task in free form; we will clarify the rest with questions.