Skip to main content

What is the Corelib?

The Cairo core library, also known as Corelib, provides the foundational building blocks for writing provable programs in Cairo. It offers essential utilities, data structures, mathematical functions, cryptographic tools, and system interactions making it suitable for both onchain and offchain development. Whether you are working on Starknet smart contracts, cryptographic applications, or general-purpose Cairo programs, the corelib provides the fundamental tools needed. The corelib is available to all Cairo packages by default, meaning its features are available by simply importing specific modules into your program as follows:

How to use this documentation?

This documentation serves as a comprehensive reference for all components of the Corelib. It organizes functionality into modules, constants, functions, types, and traits, allowing developers to explore and understand available features efficiently. It is based on the auto-generated documentation of the corelib’s codebase using Scarb, so if you find a bug, have a feature request, or want to improve the documentation, simply report an issue or submit a pull request on either Cairo’s or Scarb’s GitHub repositories. If you already know what you are looking for, the fastest way to find it is to use the search bar at the top of the page. Otherwise, you can take a quick tour of the documentation and start clicking on anything the seems interesting. If this is your first time, we recommend starting with browsing the library’s modules and experimenting with their functionality in your Cairo programs. Happy coding! 𓅃

A quick tour of the documentation

Modules

Miscellaneous