Professional turnkey deployment of smart contracts on TON

Deploying contracts to mainnet is the most risky stage: one mistake in the sequence of actions, and the service is left without a working version. We set up turnkey managed deployment of TON smart contracts: we validate scenarios on testnet and lock down the release procedure so releases stop breaking the product. We'll discuss your task and come back with an assessment and plan.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1375
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1349
  • B2B Advance company logo design
    B2B Advance company logo design
    794
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1087
  • AIDER company logo development
    AIDER company logo development
    1032
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1129

Why TON smart contract deployment fails in production

Publishing a contract on TON is an operation without an undo button.

An uncovered logic branch that was simply never called on the local test bench is deployed along with the contract: some transfers enter a state from which no standard withdrawal is provided, and balances remain at the contract address.

A failure during contract publication rarely looks like a crash — the transaction succeeds, and incorrect behavior surfaces later, once funds have already started flowing to the address.

The second cause is environment mismatch: the source is the same, but initialization parameters, signing keys, and owner wallets differ between testnet and mainnet.

Then the contract address does not match the expected one, while integrations continue sending calls to the previous one. The risk during contract upgrade is added if there is no proven procedure: new logic cannot return rights and funds, and data remains locked in the old one.

A separate class of failures is loss of access to the contract, when control is tied to a key stored in one place or lost together with the infrastructure. Below we break down how this is closed before the first publication.

What managed deployment gives: effect in measurable values

Managed deployment is when contract publication stops being an operation with an unknown outcome. A change in TON follows the same route: artifact build, testnet run, state reconciliation, publication.

The time to release an update from this chain is measured in hours, not days — because the route is not rebuilt from scratch for each task.

The share of successful publications depends not on the code itself but on preparation. The main losses are mismatched addresses, an unfunded balance to pay for execution, storage state that has diverged between the run and the send.

When these steps are automated and checked before sending, first-pass publication becomes the norm, not luck.

We keep rollback speed at the level of minutes: the previous version and its addressing are preserved, and reverting is substituting a known working state, not redevelopment.

The scenario is described in advance — who decides to roll back and based on what signal, and what exactly is substituted for the withdrawn version.

Predictable recovery is provided by the trace of every deployment.

The build artifact, network configuration, state fingerprint, explorer access — from this set the environment is brought up by the same sequence of actions: on a local machine, for a new engineer, and on a backup site, the result matches.

This eliminates entire classes of failures: testnet/mainnet mismatch, lost access to the control contract, manual state edits "in place." We do not measure this with promises — we look at four values: time to release a change, share of successful publications, rollback speed, and time to bring up an environment from scratch.

Deployment approaches: manual, pipeline, managed

TON smart contract deployment is not a single command but a sequence: building the contract code, computing the address from the initial data, funding the balance, publishing a message with the code and state.

When this path is traversed manually, any parameter edit becomes a risk — a discrepancy in the initial data changes the address, and this is discovered only on mainnet.

We divide deployment into three modes and choose based on the task: how many times the contract is rebuilt, who holds the publication keys, and whether a separate testnet is needed.

Approach When it fits Limitations
Manual publication One-off contract, prototype, testnet debugging Initial state parameters are entered manually, there is no change history, rollback is only by redeployment
Deployment pipeline Regular updates, multiple networks and developers Build descriptions are needed, and keys must be moved outside the repository; an error in the branch goes to mainnet automatically
Managed release Production contract with user balances, audit before publication More preparation: a testnet with the same parameters and human release confirmation

The modes are combined: manual publication for testnet verification, pipeline for regular updates, managed release for mainnet launch.

The boundaries of the approach are set not by the tool but by the procedure for handling keys and initial data: losing them makes the contract non-upgradable.

Engineering stages: from audit to handover

Before publication to mainnet, we record what exactly we are deploying, in which environment, and with which key it is signed.

The work order does not depend on project size: first we capture the current state, then we assemble the deployment scheme, and only then do we touch the network. Below is one full cycle.

  1. Configuration audit. We examine sources, build settings, and network parameters: the contract must build reproducibly, and addresses, rights, and limits must be described explicitly rather than "from memory."
  2. Deployment scheme. We fix the order of contract publication and dependencies between them: which must exist earlier so the next one initializes correctly.
  3. Environment and access setup. We separate testnet and mainnet, issue keys by role, and limit the publication wallet to the minimum necessary rights and balance.
  4. Pre-publication check. We run scenarios on testnet: initialization, method calls, access denial, repeat run. We compare state and events with expected ones.
  5. Publication. We deploy strictly according to the scheme and save addresses and transaction hashes — they later confirm that the verified build is the one on the network.
  6. On-chain acceptance. We check contracts through public explorers, call key methods, and compare actual state with the test run result.
  7. Operations handover. We provide addresses, the scheme, update and rollback instructions, key composition, and incident procedures; we stay in touch when parameters change or contracts are added.

Handover artifacts: configurations, policies, regulations

Handover is not an archive of links or a verbal "we'll tell you everything." After commissioning, the client's team retains a set of artifacts that allow the system to be built, deployed, and updated without our involvement.

  • Deployment documentation: build order, environment variable composition and allowed values, requirements for the node and the deployment wallet.
  • Infrastructure diagram: environments, connections between them, external dependencies, and failure points.
  • Access policies: roles, who signs operations with which key, multisignature thresholds, key rotation procedure.
  • Update and rollback regulations: how a new version is rolled out, what checks pass before signing, how to return to the previous one.
  • Acceptance checklist: verifiable items with expected results — contract state, rights, limits, error handling.
Management option When it fits Limitations
Keys entirely with the client There is an in-house secrets storage service Round-the-clock access control is required
Multisignature with our key Insurance is needed for the first months Operation approval takes longer
Contractor's dedicated environment No staff for operations Dependency on us remains

The format is chosen before deployment: changing the management model on a live contract is more expensive than building it in from the start.

Case: how managed release stopped crashing a payment service

A payment service on TON published contract updates manually: an engineer built the assembly locally, signed it with a key, and uploaded it while checking against a nine-step list.

Over a quarter, this produced nine incident reviews — three outages due to incorrect addressing order, four due to keys mismatching the calling code. Downtime each time took about forty minutes, and during all that time payments did not go through.

What changed

Publication was moved into a single scenario: the build produces the same result on any machine, the signature is read from secure storage, and addressing and rights are reduced to a single run.

Before mainnet, changes must pass on testnet, and before release a snapshot of storage state is taken — rollback to it is one command.

What became

The share of first-pass publications rose from 82% to 99.4%, and the number of incidents per quarter fell from nine to one. Recovery time dropped from forty minutes to four: rollback is switching to the previous snapshot, not manually analyzing causes under pressure. Manual operations in a release dropped to two — launch and confirmation — instead of twelve.

Keys and addresses are now verified by automated checks before a change goes to the network, so errors are caught on testnet rather than on live payments.

What to do if the contract is already deployed and running

Code immutability is a property of the network, not a sentence: a contract cannot be rewritten in place after publication, but an upgrade point can be built in advance.

If it is absent, any logic change means a new address, user migration, and manual balance transfer, and upgrading a running contract turns into a separate project with the risk of losing state.

A working scheme is a proxy contract that stores a reference to the current implementation: external calls go through it, state remains at the previous address, and only the logic changes.

The alternative is to keep the code in storage itself with an administrator's replacement right: upgrading is simpler, but key protection requirements are higher.

State migration proceeds as a separate pass. We version the data structure — each record has a version marker, so old data is read by the previous rules until it is overwritten.

We migrate in batches: the computation limit per transaction prevents updating everything at once, and an idempotent pass allows safely repeating a step after a failure.

Backward compatibility is a condition without which an update breaks clients. External call signatures and read methods remain the same, new fields are added as optional, and outdated logic branches are preserved as long as they are called.

The step-by-step transition is built as follows: a copy on a snapshot of the real state with invariant runs, then switching the pointer to the new implementation and keeping the old code in reserve for rollback. After that, monitoring behavior, and only then removing the migration layer.

Technical doubts worth clearing before starting

Before starting TON smart contract deployment, questions almost always come up not about code logic but about operations: where keys are stored, who has the right to release an update, how the test environment differs from production, and what will remain with your team after handover. Below are short answers to the ones asked most often.

Where are deployment keys stored — and what happens if an engineer leaves the team?

Keys are not stored in the repository or in chat. We create separate wallets for deployment, contract upgrades, and fund withdrawal, and we close access with a 2-of-3 threshold scheme: a single signature does not carry out an operation. During handover, keys are reissued to your addresses, and working copies are revoked.

How are rights divided between the contractor and your team?

The role that builds the contract does not coincide with the role that sends it to mainnet. We do not have permanent access to production keys: an update goes out only after your signature, and every operation is logged with the initiator indicated.

Environments are divided in the same way — development, test environment, and mainnet have their own sets of keys and addresses.

Is the release checked on testnet before going to production?

Yes, and exactly the build that passed the check goes to mainnet. On the test environment we run scenarios: successful call, denial, repeat call, insufficient funds on the account.

The differences between the test environment and production are only addresses and keys; the code version and parameters match.

Will our team be able to maintain the contract without you?

We hand over the contract scheme, role table, update and key revocation procedure, and instructions for recovery from backup. Separately, we conduct a joint release: your engineers perform the operations themselves, while we observe and answer questions.

After that, maintenance proceeds without our involvement — we return when logic needs to be extended.

Let's discuss the task and come back with an estimate and plan

So that the timeline estimate is based on facts rather than assumptions, a short task description and access to the current code are enough to start the discussion.

The more specific the inputs, the more precise the stage composition, the fewer assumptions in the work plan, and the fewer changes along the way.

  • Contract logic: what operations it performs, who calls them and under what conditions, what happens to data on output.
  • Current code state: repository, compilable modules, addresses of already deployed contracts on testnet.
  • Access scheme: who owns the deployment wallet, how operations are confirmed, whether a multisignature scheme is needed.
  • Environment requirements: where we run TON smart contract deployment, in what order we release to mainnet, whether limits and pauses are needed.
  • Load: expected number of operations, message volume, confirmation time requirements.
  • Constraints: deadlines, dependency on other systems, who on your side accepts the result.

As a result, you receive a plan with stage composition, calendar, and control points: logic approval, test deployment acceptance, access rights verification, mainnet release.

After each point, we show the result and only then move on — this way schedule shifts are visible in advance, not on the delivery day. Describe the task and send the inputs — we will come back with an estimate and work plan.