Universal-Sierra-Compiler is the tool for Sierra compilation. It compiles any ever-existing Sierra version to CASM.
Supported Sierra Versions |
---|
1.5.0 |
~1.4.0 |
~1.3.0 |
~1.2.0 |
1.1.0 |
1.0.0 |
0.1.0 |
To install the binary on your PATH run the following line
curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh
...
universal-sierra-compiler (v1.0.0) has been installed successfully.
๐ Note
If the script can't add installed binary to the PATH, it will print the instructions about adding it manually.
Tool consist of two subcommands:
compile-contract
compile-raw
The first one compiles Sierra of the Starknet contract, while the second one compiles Sierra of the plain Cairo code.
The input of this subcommand is a path to a file with Sierra of the contract
(cairo_lang_starknet_classes::contract_class::ContractClass
) in json format:
$ universal-sierra-compiler \
compile-contract \
--sierra-path ./path/to/sierra.json
{"bytecode": ...}
๐ Note
Please, note that the output is in the JSON format.
To automatically save CASM, pass --output-path
argument:
$ universal-sierra-compiler \
compile-contract \
--sierra-path ./path/to/sierra.json
--output-path ./path/to/casm.json
The input of this subcommand is a path to a file with Sierra program (cairo_lang_sierra::program::Program
) in json format:
$ universal-sierra-compiler \
compile-raw \
--sierra-path ./path/to/sierra.json
{"assembled_cairo_program": ...}
๐ Note
Please, note that the output is in the JSON format.
To automatically save assebled cairo program, pass --output-path
argument:
$ universal-sierra-compiler \
compile-raw \
--sierra-path ./path/to/sierra.json
--output-path ./path/to/casm.json