FR EN
Testing a blockchain application: smart contracts, transactions and MiCA
4 October 2026 Oussama Belakhdar 7 min read

Testing a blockchain application: smart contracts, transactions and MiCA

On a blockchain, a confirmed transaction cannot be cancelled, and a deployed smart contract cannot be patched like a web application. Testing therefore happens before, and it must cover what a malicious user will try.

Key takeaways
  • A deployed bug is final: testing happens before deployment, not after.
  • Test on a testnet or a local network, never with real funds.
  • Think like an attacker: unauthorised calls, extreme amounts, transaction ordering.
  • MiCA has applied since 30 December 2024 to crypto-asset service providers in the EU.

Oussama Belakhdar, QA architect and founder of AutomationDataCamp, has worked on testing projects for blockchain applications. This page sets out what we check before a smart contract goes to mainnet. Our clients are not named.

What do the blockchain security figures say?

$2.2 bn Crypto assets stolen in hacks in 2024. Chainalysis — Crypto hacking report 2025
$3.4 bn Crypto assets stolen from January to early December 2025, including $1.5 bn in a single attack (Bybit, February 2025). Chainalysis — Crypto hacking report 2026

Figures published by the organisations cited, not results of our own engagements.

Why is testing a blockchain application different?

  • The code of a deployed smart contract is in principle immutable: a fix means a new deployment, a migration or an upgrade mechanism designed in from the start (proxy), which must itself be tested.
  • The result depends on the chain state, the order of transactions within a block and the fees (gas): two runs of the same call do not necessarily play out the same way.
  • The code is public and the funds are directly reachable: every exposed function is an attack surface, probed by strangers as soon as it goes live.
  • The application combines three layers: the contracts, intermediate services (indexers, oracles, APIs) and the interface connected to the user's wallet.

Which scenarios should be tested first on a smart contract?

  1. Contract functions: nominal cases, boundary values, zero or very large amounts, arithmetic overflows.
  2. Access control: a restricted function rejects any other caller, and transferring the admin role is tested too.
  3. Reentrancy and external calls: a malicious contract cannot call the function back before it has finished executing.
  4. Events and final state: every transaction emits the right events and leaves consistent balances.
  5. Gas cost of frequent functions, and no loop whose cost grows without bound with the number of users.
  6. Wallet journeys: connection, signature, rejected signature, wrong network, pending then failed transaction.

Technical and regulatory requirements to test

Unit testing and fuzzing. The Ethereum documentation recommends combining unit tests, integration tests on a copy (fork) of the network, property-based tests and static analysis. Tools such as Foundry generate a large number of random inputs for the same function (fuzzing) and check invariants: for example, the sum of balances never exceeds the total supply.

Security audits. An external audit complements testing; it does not replace it. The OWASP Smart Contract Top 10 lists the most common vulnerability families (access control, price oracle manipulation, logic errors, reentrancy…) and serves as a checklist before the audit.

Gas and testnets. Every operation on Ethereum consumes gas, paid by the user: a function that costs too much is a functional defect. End-to-end tests run first on a local chain, then on a public testnet such as Sepolia, with worthless tokens.

MiCA, Regulation (EU) 2023/1114. The provisions on asset-referenced tokens and e-money tokens have applied since 30 June 2024; the rest of the regulation, including the authorisation of crypto-asset service providers, since 30 December 2024. Authorised providers also fall within the scope of DORA and its resilience testing obligations.

An example test case: addresses and amounts in base units. Two front-end defects regularly reach wallet journeys. The first concerns addresses: EIP-55 encodes a checksum in the upper and lower case of the hexadecimal letters, so the interface must reject 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed (a test vector from the specification) once a single letter has changed case, while accepting the all-lowercase form, which the specification's test cases list as valid. The second concerns amounts: an ERC-20 token stores amounts as integers in its smallest unit, and its optional decimals function says how to display them, often 18. 0.1 token is then 100000000000000000 base units, far above the largest integer a JavaScript Number represents exactly (253 − 1). Tests therefore cover amounts with all 18 decimals, round trips between display and base units, and a token that does not implement decimals, which the standard allows. Conversions must use integer arithmetic (BigInt), never floating point.

Before mainnet: the go-live checklist

A mainnet deployment is prepared like a launch with no way back. Before signing the deployment transaction, we check that every function that moves funds is covered by unit tests, that invariants have run under fuzzing for a large number of runs, that static analysis no longer reports any unexplained warning, that deployment addresses and parameters have been reviewed by a second person, and that the pause or upgrade mechanism, if there is one, has been tested with the real roles.

After deployment, a read-only smoke test confirms the contract's initial state (owner, parameters, balances) before it is opened to the public.

How do we organise testing for a blockchain application?

  1. Start from what an attacker would try. Functions that move funds or change permissions are tested first, with inputs an honest user would never send.
  2. Three levels of automation. Unit tests and fuzzing for contracts, API tests for intermediate services, Playwright for journeys with a simulated wallet, the whole set running in your CI pipeline; k6 measures how APIs and indexers hold up under load.
  3. No real funds. Local chain, network fork or testnet, with test accounts and tokens.
  4. AI, with a review. An assistant helps suggest invariants and attack cases to test. Before it is kept, a test written by AI goes through our 7-question checklist. The method is detailed in our case study: from a PDF specification to Playwright tests.

Where should you start?

If a contract is about to go to an external audit, now is the time to strengthen its tests: the auditor can then spend their time on subtle flaws rather than on errors tests would have caught.

A QA audit reviews your application: a written assessment, a test strategy adapted to your industry and a costed action plan, in 5 days, for €1,000 excl. VAT as a fixed fee. Delivered remotely, in English or French, for companies in the US, the UK, Canada, Australia, Europe, the Gulf and the Nordics. The first scoping session is free.

See the QA audit at €1,000 excl. VAT

Frequently asked questions about blockchain application testing

Why test a smart contract before deploying it?

Because a deployed contract cannot be changed like a regular application and a confirmed transaction cannot be cancelled. A bug found after deployment can lead to permanent losses.

How do you test a blockchain application safely?

On a local network or a testnet, with fictitious accounts and funds, and automated tests covering the contract, the intermediate services and the interface.

Does fuzzing replace a smart contract audit?

No. Fuzzing and unit tests find the errors you can express as properties; an audit brings an outside view of the design and of economic attacks. The two complement each other, and well-tested code lets the audit go further.

How do you test gas consumption?

By measuring the gas used by each frequent function in unit tests, comparing it from one version to the next, and checking that no function has a cost that grows without bound with the number of users or stored items.

How much does a QA audit cost at AutomationDataCamp?

The QA audit and diagnosis costs €1,000 excl. VAT as a fixed fee, over 5 days: a written assessment, a test strategy and a costed action plan. The first scoping session is free.

Other industries: Healthcare · E-invoicing · Finance · Logistics · E-commerce · Document management. All industries.

Page signed by Oussama Belakhdar, written with the help of AI. Regulatory references link to the official sources above; they are not legal advice.

Related articles