stylusguide
  • 1. Welcome to Arbitrum Stylus and Rust
    • Brief Introduction to Arbitrum Stylus
    • Importance of Rust in Blockchain Development
    • What You'll Learn in This Tutorial Series
  • 2. Setting Up Your Development Environment
    • Installing Rust
    • Setting Up Arbitrum Stylus
    • Basic Commands
  • 3. Your First Smart Contract: Hello World
    • Introduction to Smart Contracts
    • Writing the Hello World Contract
    • Deploying and Testing Your Contract
  • 4. Understanding Smart Contract Storage: Simple Storage
    • Basics of Contract Storage
    • Writing the Simple Storage Contract
    • Interacting with Storage Variables
  • 5. Creating Your Own Token: Token Contract
    • Introduction to Tokens and Standards
    • Writing the Token Contract
    • Deploying and Testing Your Token
  • 6. Additional Resources and Next Steps
Powered by GitBook
On this page
  1. 2. Setting Up Your Development Environment

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.

PreviousSetting Up Arbitrum StylusNext3. Your First Smart Contract: Hello World

Last updated 10 months ago