25 releases (1 stable)

Uses new Rust 2024

1.0.0 Oct 28, 2025
0.3.0 Sep 18, 2025
0.2.4 Oct 8, 2025
0.1.9 Jul 14, 2025
0.0.5 Dec 22, 2023

#1 in #stark

Download history 27798/week @ 2025-10-18 31724/week @ 2025-10-25 27780/week @ 2025-11-01 29599/week @ 2025-11-08 28897/week @ 2025-11-15 42439/week @ 2025-11-22 34187/week @ 2025-11-29 35329/week @ 2025-12-06 38215/week @ 2025-12-13 31200/week @ 2025-12-20 26201/week @ 2025-12-27 26122/week @ 2026-01-03 40584/week @ 2026-01-10 30727/week @ 2026-01-17 30289/week @ 2026-01-24 29731/week @ 2026-01-31

133,981 downloads per month
Used in 138 crates (46 directly)

MIT license

205KB
4.5K SLoC

starknet-types-core

Core types representation for Starknet.

Overview

The starknet-types-core crate provides:

  • The universal Felt (Field Element) type for Cairo and STARK proofs. It was created to reduce the fragmentation in the Starknet Rust ecosystem by providing a standardized representation of the Felt type.

Features

Always on

  • Standardized Felt type: Simplify your codebase by using our standardized Felt type. Optimized for performance: The Felt type has been optimized for high-performance applications.
  • No_std support ✅

Serde

  • Provides a Serialization and Deserialization implementations for the Felt type
  • No_std support ✅

Parity Scale Codec

  • Provides Serialization and Deserialization implementations for the Felt type within the Parity serialization framework
  • No_std support ✅

Arbitrary

  • Provides an Arbitrary implementations for the Felt type

Curve

  • Add the AffinePoint and ProjectivePoint structs, which represent points on the Stark curve for performing elliptic curve operations.
  • No_std support ✅

Hash

  • Implements Pedersen hashing for Felts and Felts array

Examples

Here are some examples of how to use the starknet-types-core types:

    let felt = Felt::from(18);
    let projective_point = ProjectivePoint::new(Felt::from(0), Felt::from(1), Felt::from(0));
    let affine_point = AffinePoint::new(Felt::from(0), Felt::from(1)).unwrap();

Usage

Include starknet-types-core in your library by adding the following to your Cargo.toml:

[dependencies]
starknet-types-core = { version = "0.0.3", git = "https://github.com/starknet-io/types-rs", default-features = false, features = [
    "alloc",
    "serde",
    "arbitrary",
    "curve",
    "hash",
] }

Build from source

Clone the repository and navigate to the starknet-types-core directory. Then run:

cargo build --release

Testing

Clone the repository and navigate to the starknet-types-core directory. Then run:

cargo test

Contributing

Contributions are welcome! Please read our contributing guidelines for more information.

License

This repository is licensed under the MIT License, see LICENSE for more information.

Dependencies

~2.4–4.5MB
~89K SLoC