11/12 free views
Library/SDK
Library
Application Security

cairo-contracts

by OpenZeppelin

879stars
388forks
17watchers
Updated 8 months ago
About

A secure and modular library of smart contract components written in Cairo for developing on Starknet, a decentralized ZK Rollup.

OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup

Primary Use Case

This tool is used by blockchain developers to build secure, reusable smart contracts on Starknet using the Cairo programming language. It simplifies the development process by providing audited, standard contract implementations like ERC20 tokens, enabling faster and safer deployment of decentralized applications.

Key Features
  • Secure smart contract components written in Cairo
  • Support for Starknet, a decentralized ZK Rollup
  • Modular design allowing selective dependency inclusion
  • Pre-built ERC20 token contract implementation
  • Comprehensive documentation and interactive contract generator
  • Integration with Scarb build system
  • Open source with active maintenance by OpenZeppelin

Installation

  • Install Cairo and Scarb following https://docs.swmansion.com/scarb/download
  • Create a new project with `scarb new my_project && cd my_project`
  • Edit `Scarb.toml` and add the dependency, e.g., `openzeppelin = "3.0.0-alpha.0"` or `openzeppelin_token = "3.0.0-alpha.0"`
  • Build the project with `scarb build` to download and compile dependencies

Usage

>_ scarb new my_project && cd my_project

Creates a new Cairo project and navigates into it

>_ scarb build

Builds the project and downloads the OpenZeppelin Cairo contracts dependencies

>_ git clone [email protected]:OpenZeppelin/cairo-contracts.git

Clones the cairo-contracts repository locally for development or contribution

>_ scarb build -w

Builds the cloned project in watch mode for development

>_ snforge test -w

Runs the test suite in watch mode

>_ Use example ERC20 contract code in `src/lib.cairo`

Demonstrates how to implement an ERC20 token contract using the OpenZeppelin Cairo library

Security Frameworks
Defense Evasion
Credential Access
Initial Access
Execution
Impact
Usage Insights
  • Integrate this library into CI/CD pipelines to enforce secure smart contract standards automatically.
  • Use the modular design to create minimal attack surface contracts, reducing exploitable code.
  • Combine with blockchain security scanners to detect vulnerabilities early in development.
  • Leverage the interactive contract generator to educate developers on secure contract patterns.
  • Employ as a baseline for purple team exercises simulating smart contract exploitation and defense.

Docs Take 2 Hours. AI Takes 10 Seconds.

Ask anything about cairo-contracts. Installation? Config? Troubleshooting? Get answers trained on real docs and GitHub issues—not generic ChatGPT fluff.

This tool hasn't been indexed yet. Request indexing to enable AI chat.

Admin will review your request within 24 hours

Security Profile
Red Team30%
Blue Team80%
Purple Team60%
Details
LicenseMIT License
LanguageRust
Open Issues565
Topics
cairo
smart-contracts
starknet
ethereum
security