Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rkdud007/rifle
Starknet Blocktime estimator in Rust
https://github.com/rkdud007/rifle
ethereum rust starknet
Last synced: about 1 month ago
JSON representation
Starknet Blocktime estimator in Rust
- Host: GitHub
- URL: https://github.com/rkdud007/rifle
- Owner: rkdud007
- Created: 2023-08-19T09:07:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-21T06:15:50.000Z (over 1 year ago)
- Last Synced: 2024-08-04T01:03:55.579Z (4 months ago)
- Topics: ethereum, rust, starknet
- Language: Rust
- Homepage:
- Size: 1.34 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
- awesome-starknet - rifle - Blocktime estimator in Rust. (Additional developer resources)
README
# rifle
---
Rifle is a blocktime estimator for Starknet written in Rust. Made by learning purpose. This project is inspired by ([snipe](https://github.com/0xcacti/snipe)). You can use package at [Crate.io](https://crates.io/crates/rifle)
## Install
Run the following Cargo command in your project directory:
```sh
cargo add rifle
```Or add the following line to your Cargo.toml:
```
rifle = "0.1.0"
```## Features
### Convert blocknumber to time.
This feature relies on the `starknet_getBlockWithTxHashes` endpoint. Get timestamp from blocknumber through this endpoint. If you want to return in unix format, add `-f unix` command.
### Convert time to blocknumber.
This feature is using binary search algorithm to search for the nearest blocknumber with given target timestamp.
### Select network want to query.
You can use options to choose. `-n mainnet` will allow you to query from Starkent mainnet, `-n goerli` will allow you to query from Starkent goerli, `-n goerli2` will allow you to query from Starkent goerli2.
If you provide `--rpc-url`, it will get data from rpc client.
## Usage
```
Usage: rifle [OPTIONS] [COMMAND]Commands:
--to-time Convert blocknumber to time. [aliases: btt]
--to-block Convert time to blocknumber. [aliases: ttb]
help Print this message or the help of the given subcommand(s)Options:
-n, --network Network: [mainnet/goerli/goerli2]
-u, --rpc-url The RPC endpoint
-f, --format The format to use time
-h, --help Print help
```### `--to-block`
```
Convert time to blocknumber.Usage: rifle --to-block
Arguments:
Options:
-h, --help Print help
```### `--to-time`
```
Convert blocknumber to time.Usage: rifle --to-time
Arguments:
The blocknumber to convertOptions:
-h, --help Print help
```## Improvement
- [ ] timezone support
- [ ] algorithm upgrade?