The NEAR Protocol team executed a technically complex operation, replacing the execution engine of all smart contracts directly while the mainnet was running. According to the engineers' design, users and developers were not supposed to notice any changes — and they succeeded.

Why the old engine became a "tax"

For years, NEAR relied on NearVM — a fork of the popular Wasmer engine. The problem was that this fork was maintained solely by the project's own team. Every update to the Rust language, every new security feature became a burden on the NEAR team. It was inefficient and risky. The project was once simply lucky: it had not synchronized with the original Wasmer just before a critical vulnerability was discovered in it. Having accidentally avoided a catastrophe, the team decided that this could not continue.

The transition to Wasmtime: how it happened

The new standard became Wasmtime — an industry engine under the auspices of the Bytecode Alliance. But simply "flipping a switch" was not possible. To prove the correctness and safety of the transition, network validators ran all real traffic through both virtual machines in parallel, cross-checking every result. The match was absolute: the discrepancy in fees was less than 0.002%, and contract execution itself sped up fourfold.

The "forbidden" solution and compiler bombs

The main engineering puzzle was not in execution, but in compilation. On the NEAR network, contract deployment is compiled directly within a 600-millisecond block. The optimizing compiler has no upper time limit, which opened the door to DoS attacks. The team created a 128 KB "bomb" contract, whose compilation took 7 seconds — enough to miss the block and slow down the entire network.

The obvious solution — introducing a hard time limit on compilation — turned out to be forbidden. Different validators spend different amounts of time on compilation, and a single threshold would have led to a network split: some nodes would accept the contract, others would reject it.

An elegant solution and results

The solution was found in integrating Winch — a single-pass backend of Wasmtime. By adding the missing features, the team reduced the "worst-case compilation" from 7.6 seconds to 36 milliseconds. Working off-chain provided a "luxury unavailable to the protocol": compilation was moved to a separate type of handler, not tied to executing nodes.

The release of Nearcore 2.12 transitioned NEAR's execution environment from NearVM to Wasmtime. For developers and users, nothing changed — the team closed a critical technical debt without breaking anything. This is not the kind of news that makes headlines, but it is precisely such upgrades that make infrastructure truly reliable.

Analyst's comment: Replacing a VM under load is the pinnacle of engineering. NEAR not only solved a security and performance problem but also demonstrated the maturity of its codebase. For investors and developers, this is a signal that the team is capable of the most complex technical maneuvers without harming the network.