Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xJonathanLEI/starknet-rs
Complete Starknet library in Rust™
https://github.com/xJonathanLEI/starknet-rs
ethereum rust starknet
Last synced: 24 days ago
JSON representation
Complete Starknet library in Rust™
- Host: GitHub
- URL: https://github.com/xJonathanLEI/starknet-rs
- Owner: xJonathanLEI
- License: apache-2.0
- Created: 2021-12-02T13:36:02.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-29T16:45:03.000Z (5 months ago)
- Last Synced: 2024-07-30T19:51:17.471Z (4 months ago)
- Topics: ethereum, rust, starknet
- Language: Rust
- Homepage: https://starknet.rs
- Size: 3.84 MB
- Stars: 273
- Watchers: 12
- Forks: 93
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-starknet - starknet-rs - Rust library. (Additional developer resources)
- awesome-rust-list - xJonathanLEI/starknet-rs - rs?style=social"/> : Complete Starknet library in Rust™. [starknet.rs](https://github.com/xJonathanLEI/starknet-rs) (Web3 and ZKP Framework)
- awesome-rust-list - xJonathanLEI/starknet-rs - rs?style=social"/> : Complete Starknet library in Rust™. [starknet.rs](https://github.com/xJonathanLEI/starknet-rs) (Web3 and ZKP Framework)
README
starknet-rs
**Complete Starknet library in Rust[™](https://www.reddit.com/r/rust/comments/12e7tdb/rust_trademark_policy_feedback_form/)**
![starknet-version-v0.13.0](https://img.shields.io/badge/Starknet_Version-v0.13.0-2ea44f?logo=ethereum)
[![jsonrpc-spec-v0.7.1](https://img.shields.io/badge/JSON--RPC-v0.7.1-2ea44f?logo=ethereum)](https://github.com/starkware-libs/starknet-specs/tree/v0.7.1)
[![linting-badge](https://github.com/xJonathanLEI/starknet-rs/actions/workflows/lint.yaml/badge.svg?branch=master)](https://github.com/xJonathanLEI/starknet-rs/actions/workflows/lint.yaml)
[![crates-badge](https://img.shields.io/crates/v/starknet.svg)](https://crates.io/crates/starknet)> _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`](./starknet-crypto) does NOT provide constant-time guarantees._
## Adding starknet-rs to your project
To use the crate from [crates.io](https://crates.io/crates/starknet), add the following to your `Cargo.toml` file:
```toml
[dependencies]
starknet = "0.11.0"
```Note that the [crates.io version](https://crates.io/crates/starknet) might be outdated. You may want to use the library directly from GitHub for all the latest features and fixes:
```toml
[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](https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.6.1/src/openzeppelin/account/IAccount.cairo) account contracts
- [ ] Strongly-typed smart contract binding code generation from ABI
- [x] Ledger hardware wallet support## 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-curve`: Starknet curve operations
- `starknet-macros`: Useful macros for using the `starknet` crates
- `starknet-core-derive`: Derive macros for traits in `starknet-core`## WebAssembly
`starknet-rs` can be used as a WebAssembly module. Check out [this example](./examples/starknet-wasm/).
## Using `starknet-rs` from C++
`starknet-rs` can be used as a dynamic or static library from C++. Check out [this example](./examples/starknet-cxx/).
## Performance
Benchmark results for native and WebAssembly targets are available for these crates:
- [starknet-core](./starknet-core/)
- [starknet-crypto](./starknet-crypto/)For instructions on running the benchmark yourself, check [here](./BENCHMARK.md).
## Example
Examples can be found in the [examples folder](./examples):
1. [Get the latest block from `alpha-sepolia` testnet](./examples/get_block.rs)
2. [Deploy contract to `alpha-sepolia` testnet via UDC](./examples/deploy_contract.rs)
3. [Mint yourself 1,000 TST tokens on `alpha-sepolia`](./examples/mint_tokens.rs)
Make sure your account has some L2 Sepolia ETH to pay for the transaction fee.
4. [Declare Cairo 1 contract on `alpha-sepolia` testnet](./examples/declare_cairo1_contract.rs)
Make sure your account has some L2 Sepolia ETH to pay for the transaction fee.
5. [Declare legacy Cairo 0 contract on `alpha-sepolia` testnet](./examples/declare_cairo0_contract.rs)
Make sure your account has some L2 Sepolia ETH to pay for the transaction fee.
6. [Query the latest block number with JSON-RPC](./examples/jsonrpc.rs)
7. [Encoding and decoding Cairo types](./examples/serde.rs)
8. [Batched JSON-RPC requests](./examples/batch.rs)
9. [Call a contract view function](./examples/erc20_balance.rs)
10. [Deploy an Argent X account to a pre-funded address](./examples/deploy_argent_account.rs)
11. [Inspect public key with Ledger](./examples/ledger_public_key.rs)
12. [Deploy an OpenZeppelin account with Ledger](./examples/deploy_account_with_ledger.rs)
13. [Transfer ERC20 tokens with Ledger](./examples/transfer_with_ledger.rs)
14. [Parsing a JSON-RPC request on the server side](./examples/parse_jsonrpc_request.rs)
15. [Inspecting a erased provider-specific error type](./examples/downcast_provider_error.rs)
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](./LICENSE-APACHE) or )
- MIT license ([LICENSE-MIT](./LICENSE-MIT) or )at your option.