Skip to content

Set of scripts written in Cairo/Starknet to learn and teach newcomers the ecosystem.

License

Notifications You must be signed in to change notification settings

KaizeNodeLabs/stark-cairo-nodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stark-cairo-nodes 🔗💡

📖 Overview

stark-cairo-nodes is a collection of educational scripts built using the Cairo programming language, specifically designed for the Starknet ecosystem. These scripts are ideal for both beginners and intermediate developers looking to deepen their understanding of Cairo and Starknet concepts.

⚙️ Steps to Build and Run Cairo Scripts

1. 🛠️ Set Up Your Environment

  • Install Scarb

    Please refer to the asdf documentation to install all prerequisites

    To get started, install Scarb by running the following commands in your terminal:

  asdf plugin add scarb
  asdf install scarb latest
  asdf global scarb latest
  • Verify Scarb Installation

    Confirm that Scarb is installed correctly by checking its version:

scarb --version

2. 📂 Navigate to the Scripts Directory

First, navigate to the general cairo/scripts/ directory:

cd cairo/scripts/

Then, navigate to the specific script's directory you want to run. For example, if the script you want to execute is in a folder named example_script, navigate into that directory:

cd example_script

3. 🏗️ Build the Project

Build the project with the following command:

scarb build

4. 🚀 Run the Script

To execute the main function of the script, use:

scarb cairo-run

⚙️ Steps to build and and test contracts

1. 🛠️ Set Up Your Environment

  • Install Scarb Before you can build and test Cairo contracts, you need to have Scarb, the official build tool for Cairo. Install it with these steps:
asdf plugin add scarb
asdf install scarb latest
asdf global scarb latest
  • Install Install SnForge (Cairo Testing Framework) SnForge is the tool used to run unit tests for Cairo contracts in the Starknet ecosystem. Install it by running:
pip install snforge

2. ✅ Verify Installations

After installation, confirm that both tools are correctly installed by running:

For Scarb:

scarb --version

For SnForge:

snforge --version

3. 📂 Navigate to the Contract Directory

Proceed to the directory where your Cairo contract is located.

Example:

cd path/to/your/cairo-contract-directory

4. 🏗️ Compile the Contract

Use Scarb to compile your Cairo contract by running:

Copy code
scarb build

This will generate the necessary artifacts for your Cairo contract.

5. 🏃 Run Unit Tests with SnForge

Once the contract is compiled, you can run unit tests using SnForge. .

To run your contract's tests, use the following command:

snforge test

SnForge will automatically detect the test files in your project and run them.

6. 🔁 Review Test Results

After running the tests, you will see the results in your terminal. If the tests fail, the output will include details that will help you debug the issue. If everything passes, you’ll see confirmation that your contract is working as expected.

Give us a star! ⭐

About

Set of scripts written in Cairo/Starknet to learn and teach newcomers the ecosystem.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages