Both frameworks generate a smart contract sample as well as a unit test. Both generated contracts are similar. This will ease the rest of the work. Sometimes, we need to rely on external libraries. We will also compare how to integrate external dependencies.
nile compile
The compiled artifacts are generated in the artifacts
folder. This folder contains both compiled contracts and abis.
All contracts are automatically detected.
However, note that if 2 contracts ahev the same name, nile
won't complain about it but will silently fail later.
External dependencies (such as OpenZeppelin) are managed using python module. In order to install it, you can run
pip install openzeppelin-cairo-contracts
✔️ Pretty output
✔️ All contracts are automatically detected
❌ compilation error messages are difficult to understand ❌ does not support multiple contracts with the same name ❌ requires a pip module to use an external library
protostar build
The compiled artifacts are generated in the build
folder. This folder contains both compiled contracts and abis.
protostar
offers a compilation flag --disable-hint-validation
to allow hints to be part of a smart contract, which is really convenient for debugging purposes.
External dependencies (such as OpenZeppelin) are managed using git submodules. In order to install it, you can run
protostar install https://github.com/OpenZeppelin/cairo-contracts
✔️ Faster to compile
❌ need to provide all contract files in protostar.toml
❌ compilation error messages are difficult to understand
❌ requires a git repository to use an external library
nile | protostar |
---|---|
✔️ pretty output | ❌ need to provide all contract files in protostar.toml |
✔️ all contracts are automatically detected | ❌ compilation error messages are difficult to understand |
❌ compilation error messages are difficult to understand |