Legacy compiler CLI reference
When the Starknet compiler is installed, you can view this command-line help in a terminal by entering the following command:
starknet-compile --help
Usage
starknet-compile [-h] [--abi ABI] [--disable_hint_validation]
[--account_contract] [--dont_filter_identifiers] [-v]
[--prime PRIME] [--cairo_path CAIRO_PATH]
[--preprocess] [--output OUTPUT] [--no_debug_info]
[--debug_info_with_source]
[--cairo_dependencies CAIRO_DEPENDENCIES]
[--no_opt_unused_functions]
file [file ...]
Example
The following example compiles the file contract.cairo
. It generates two files:
contract_compiled.json |
The contract class. This file contains the bytecode and all other information necessary to execute a contract. For information on contract classes, see Contract classes and instances. |
contract_abi.json |
The contract’s ABI. |
starknet-compile contract.cairo \
--output contract_compiled.json \
--abi contract_abi.json
Optional arguments
--dont_filter_identifiers
Disable the filter-identifiers-optimization.If True, all the identifiers will be kept, instead of just the ones mentioned in hints or 'with_attr' statements.
--cairo_path CAIRO_PATH
A list of directories, separated by ":" to resolve import paths. The full list will consist of directories defined by this argument, followed by the environment variable CAIRO_PATH, the working directory and the standard library path.