Install or Upgrade the CLI
Installing the CLI or Upgrading to the latest version is as simple as rerunning the installer script. The installer will download the most recent release and replace your existingsim
binary.
Available Commands
sim init
Initializes a new Sim IDX application in the current directory.
This command creates the standard project structure.
It includes a sim.toml
configuration file, a sample listener, and a boilerplate API.
The command initializes a new Git repository, and makes the first commit containing all generated files.
mkdir new-project
and create a new directory before running the init command.
You can optionally scaffold a project from one of the official templates using the --template
flag.
For example, to start from the contract-decoder template:
--template
, the command uses the default sample template.
sim build
Builds your Foundry project by running forge build
under the hood. This compiles every Solidity contract in your project—including the listener contracts inside listeners/
—along with any imported libraries.
sim test
Runs the Solidity tests for your listener contracts.
The tests are located in listeners/test/
.
This command first compiles your contracts and then executes the tests using Foundry.
sim authenticate
Saves your Sim IDX API key locally, allowing the CLI to authenticate with the platform.
You can find and create API keys in the Sim dashboard.
For detailed, step-by-step instructions on obtaining your API key, see the Quickstart guide.
sim help
Displays help information and available commands for the Sim IDX CLI.
This command shows usage instructions, available commands, and options.
sim --help
or sim -h
for the same functionality.
sim --version
Displays the current version of the Sim IDX CLI.
When a CLI command displays an error log, the current CLI version appears at the bottom of the output.
sim abi
Provides a set of commands for managing contract ABIs and generating corresponding Solidity interfaces for use in your listener.
sim abi add <file_path>
Registers a contract ABI with your project and generates all the Solidity interfaces, structs, and helper functions your listener needs.
- Obtain the contract’s ABI JSON from Etherscan or another blockchain explorer.
- Inside your project, create a new file in
abis/
(for example,abis/YourContract.json
). - Paste the ABI JSON into that file and save it.
- Run
sim abi add abis/YourContract.json
pointing to the file you just created.
sim abi codegen
Manually regenerates the Solidity interfaces from all ABI files currently in the abis/
directory. This is useful if the generated files need to be refreshed.
In most cases, you don’t need to run this command manually because it runs automatically after you execute
sim abi add
. Use it only when you want to force-regenerate the interfaces.sim listeners
A namespace for commands that interact with listener contracts during local development.
Similar to sim abi
, you must append a sub-command after listeners
.
sim listeners evaluate
Runs your listener(s) locally against historical main-chain data so you can verify that triggers fire and events are emitted before you deploy the app.
evaluate
does not persist any data. It is purely a local dry-run to ensure your handler logic behaves as expected.Flag | Required | Description |
---|---|---|
--start-block | Yes | First block to process. Note that data availability for historical blocks can vary by chain. See the Supported Chains page for details. |
--chain-id | Conditional* | Chain ID to test against. If omitted, Sim tries to infer it from your addTrigger definitions. Required when your listener has triggers on multiple chains. |
--end-block | No | Last block to process. Provide this if you want to replay more than one block and observe state changes over a range. |
--listeners | No | Specific listener contract to evaluate. Accepts any listener contract within any of the Solidity files in /listener/src . If omitted, the command will run all listener contracts in all files. The command will fail if you specify an unknown listener. |
Handling Failed Transaction Events
When you runsim listeners evaluate
, the output in your terminal may include events where the value of the name
property is prefixed with fail_
, such as fail_PoolCreated
. A fail_
prefix indicates that the event data was generated from a transaction that failed or was reverted onchain.
This output appears exclusively in the terminal during a local
evaluate
run to give you a complete picture of how your listener reacts to all transactions within a block, including failed ones.Data from these failed transactions is not written to your app’s database.It is for informational purposes only.Failed Transaction Example