Echidna tricks

Published: June 12, 2025, updated: June 12, 2025

Here are some useful tricks for getting the best out of Echidna.

Echidna is a fuzzing tool for smart contracts written in Solidity. Solidity smart contracts primarily work on the Ethereum blockchain. Some smart contracts are responsible for managing large amounts of cryptocurrency. With Echidna you can evaluate the security of smart contracts.

Compared to code scanners and formal methods, Echidna is good at finding transactions that can trigger unintended behavior in smart contracts. Since Echidna is a coverage-guided fuzzer, it’s also good at finding ways to hit the entire code surface of a smart contract.

To test a smart contract with Echidna, you have to define a testing interface that it can to interact with your contract under test. This interfaces contains either assertions or properties. You can select which kind of test Echidna should perform using the command line flag --test-mode.

Configuration options

Echidna has a lot of configuration options. Here are some options that I recently used when going through the Building Secure Contracts Echidna tutorial:

Here’s how it can look like when you combine some of these settings:

# Give both the Test contract, as well as the sender 100 Wei
balanceContract: 100
balanceAddr: 100
# Run in assertion mode
testMode: assertion
# Let Echidna interact with the public interfaces of all contracts
allContracts: true
# You can leave out leading zeros in addresses
# This address deploys your contract
deployer: "0x30000"
# These addresses interact with your contracts
sender:
  - "0x10000"
  - "0x20000"
  - "0x30000"
# Don't let Echidna send Ether to the test contract
filterBlackList: true
filterFunctions:
  - "Test.fallback()"
cryticArgs:
  - "--solc-remaps"
  - "@openzeppelin=../node_modules/@openzeppelin"
# Run 20 workers in parallel. Adjust to the number of CPU cores
workers: 20
# Attempt to shrink an interesting case 10,000 times
shrinkLimit: 10000
# Run 1 million tests
testLimit: 1000000

When you create your configuration file, you can tell Echidna to use it with the --config command line flag. Here’s how to run Echidna using the configuration file echidna.yaml.

echidna --config echidna.yaml --contract Test test.sol

This assumes your test contract is called Test and is in a file called test.sol:

Resources

Tags

I would be thrilled to hear from you! Please share your thoughts and ideas with me via email.

Back to Index