Skip to content

bigherc18/starknet-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

starknet-rs

Complete Starknet library in Rust

starknet-version-v0.10.3 jsonrpc-spec-v0.2.1 linting-badge crates-badge

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

  • Sequencer gateway / feeder gateway client
  • Full node JSON-RPC API client
  • Smart contract deployment
  • 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-curve: Starknet curve operations
  • starknet-macros: Useful macros for using the starknet crates

WebAssembly

starknet-rs can be used as a WebAssembly module. Check out this example.

Using starknet-rs from C++

starknet-rs can be used as a dynamic or static library from C++. Check out this example.

Performance

Benchmark results for native and WebAssembly targets are available for these crates:

For instructions on running the benchmark yourself, check here.

Example

Examples can be found in the examples folder:

  1. Get the latest block from alpha-goerli testnet

  2. Deploy contract to alpha-goerli testnet via UDC

  3. 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.

  4. Declare contract on alpha-goerli testnet

    Declaring contracts without going through an account (and thus not paying fees) has been deprecated, so please make sure your account has enough L2 Goerli ETH for the fees.

  5. Query the latest block number with JSON-RPC

  6. Call a contract view function via sequencer gateway

  7. Deploy an Argent X account to a pre-funded address

License

Licensed under either of

at your option.

About

Complete Starknet library in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 97.0%
  • Shell 2.8%
  • Other 0.2%