Basic Commands
Overview of CLI Commands
The cargo-stylus
command-line interface (CLI) is a crucial tool for developing, verifying, and deploying Arbitrum Stylus smart contracts written in Rust. Below are some common commands and their usage:
Creating a New Stylus Project
To start a new Stylus project, use the following command. This clones a local copy of a starter project:
cargo stylus new <YOUR_PROJECT_NAME>
For a minimal setup, you can use:
cargo stylus new --minimal <YOUR_PROJECT_NAME>
Checking Your Project
To ensure your project is valid and can be deployed on the Arbitrum network, use:
cargo stylus check --endpoint https://sepolia-rollup.arbitrum.io/rpc
This command performs various checks on your contract to ensure it meets all requirements.
Deploying Your Project
To deploy your compiled smart contract to the Arbitrum network, use:
cargo stylus deploy --private-key-path=<PRIVKEY_FILE_PATH> --endpoint https://sepolia-rol
lup.arbitrum.io/rpc
Replace <PRIVKEY_FILE_PATH>
with the path to your private key file.
Other Useful Commands
cargo stylus export-abi
: Export the ABI (Application Binary Interface) for your contract.cargo stylus replay
: Replay a transaction for debugging purposes.cargo stylus trace
: Trace a transaction to inspect its execution.
By mastering these commands, you can effectively manage the lifecycle of your Stylus smart contracts from development to deployment.
Last updated