types-rs
This repository is an initiative by a group of maintainers to address the fragmentation in the Starknet Rust ecosystem and improve its interoperability. The key motivation behind this repository is to standardize the representation of the Felt
(Field Element) type in Rust, which is massively used as the core and atomic type of the Cairo language and its Virtual Machine.
The Felt
type is currently defined in many different crates and repositories, resulting in increased code complexity and performance issues due to the need for numerous conversions. This repository aims to mitigate these issues by providing a universal Felt
type in Rust.
Crates
This repository hosts three crates:
-
stark-felt
: This crate provides the universal Felt (Field Element) type for Cairo and STARK proofs. -
starknet-types-core
: This crate focuses on Starknet types related to computation and execution, requiring performance and optimization for specific arithmetic and cryptographic operations. -
starknet-types-rpc
: This crate deals with Starknet types used in RPC communication, serde, and transport.
Usage
You can include any of these crates in your library via crates.io or as a git dependency. For example, to include the stark-felt
crate, add the following to your Cargo.toml
:
As a crates.io dependency:
[dependencies]
stark-felt = "0.0.2"
As a git dependency:
[dependencies]
stark-felt = { git = "https://github.com/starknet-io/types-rs" }
Build from source
To build the crates from source, clone the repository and run the following command:
cargo build --release
Testing
To run the tests, clone the repository and run the following command:
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.