starknet-rs
starknet-rs copied to clipboard
Complete Starknet library in Rust™
starknet-rs
Complete StarkNet library in Rust
Note that
starknet-rs
is still experimental. Breaking changes will be made before the first stable release. The library is also NOT audited or reviewed for security at the moment. Use at your own risk.
The underlying cryptography library
starknet-crypto
does NOT provide constant-time guarantees.
Adding starknet-rs to your project
To use the crate from crates.io, add the following to your Cargo.toml
file:
[dependencies]
starknet = "0.2.0"
Note that the crates.io version might be outdated. You may want to use the library directly from GitHub for all the latest features and fixes:
[dependencies]
starknet = { git = "https://github.com/xJonathanLEI/starknet-rs" }
Features
- [x] Sequencer gateway / feeder gateway client
- [x] Full node JSON-RPC API client
- [x] Smart contract deployment
- [x] Signer for using IAccount account contracts
- [ ] Strongly-typed smart contract binding code generation from ABI
Crates
This workspace contains the following crates:
-
starknet
: Re-export of other sub-crates (recommended) -
starknet-core
: Core data structures for interacting with StarkNet -
starknet-providers
: Abstraction and implementation of clients for interacting with StarkNet nodes and sequencers -
starknet-contract
: Types for deploying and interacting with StarkNet smart contracts -
starknet-crypto
: Low-level cryptography utilities for StarkNet -
starknet-signers
: StarkNet signer implementations -
starknet-accounts
: Types for handling StarkNet account abstraction -
starknet-ff
: StarkNet field element type -
starknet-macros
: Useful macros for using thestarknet
crates
Example
Examples can be found in the examples folder:
-
Get the latest block from
alpha-goerli
testnet -
Deploy contract to
alpha-goerli
testnet -
Mint yourself 1,000 TST tokens on
alpha-goerli
Make sure your account has some L2 Goerli ETH to pay for the transaction fee. You can use this faucet to fund your account.
-
Declare contract on
alpha-goerli
testnet -
Query the latest block number with JSON-RPC
-
Call a contract view function via sequencer gateway
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.