Conghao97's picture tcftrees's picture
ProgramGen release
d086025
|
Raw History Blame Contribute Delete
3.82 kB

How Much ? (howmuch-rs) — Usage Documentation

A library providing helpers for various StarkNet fees-related tasks. It can be used as a library or as a CLI. This document covers CLI usage for a cleanroom inference environment.

Prerequisites

Installation

cargo install howmuch-rs

Usage

How much ?

Usage: howmuch-rs <COMMAND>

Commands:
  fees  Fees related subcommands
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help information
  -V, --version  Print version information

Subcommand: fees estimate-on-network

Estimate fees from one network to another.

Usage: howmuch-rs fees estimate-on-network <OPTIONS>
Flag Required Default Description
--tx-hash <TX_HASH> Yes — Transaction hash on the source network.
--source-network-gateway-url <URL> No https://alpha4-2.starknet.io/feeder_gateway (goerli 2 testnet) Source network gateway URL.
--destination-network-gateway-url <URL> No https://alpha-mainnet.starknet.io/feeder_gateway (mainnet) Destination network gateway URL. If identical to the source, it is ignored.
--source-block-number <N> No latest block Source block number.
--destination-block-number <N> No latest block Destination block number.
--usd <BOOL> No false If true, display a dollar cost estimation in the output.

Short form: -t for --tx-hash.

Example:

RUST_LOG=debug howmuch-rs fees estimate-on-network \
--tx-hash=0x073251e7ff3843c4954aa2e7f38d8c29034e34a1ddbaeb1e62605ec10ca22367 \
--source-block-number=21410 \
--destination-block-number=15925

Subcommand: fees summary

Print a summary of the resources used by a transaction.

Usage: howmuch-rs fees summary <OPTIONS>

Input (one of):

Flag Required Default Description
--tx-hash <TX_HASH> one of --tx-hash or --transaction-file — Transaction hash to fetch.
--gateway-url <URL> No https://alpha4-2.starknet.io/feeder_gateway Gateway URL used when fetching by --tx-hash.
--transaction-file <PATH> one of --tx-hash or --transaction-file — File containing a transaction receipt. Overrides --tx-hash and --gateway-url.

Resource weight overrides (defaults shown):

Flag Default
--steps-weight <F> 0.05
--pedersen-weight <F> 1.6
--range-check-weight <F> 0.8
--ecdsa-weight <F> 102.4
--bitwise-weight <F> 3.2
--ec_op-weight <F> 51.2

Resource count overrides (replace the count parsed from the receipt):

Flag Description
--steps <N> Override the step count.
--pedersen <N> Override the pedersen count.
--range_check <N> Override the range_check count.
--ecdsa <N> Override the ecdsa count.
--bitwise <N> Override the bitwise count.
--ec_op <N> Override the ec_op count.

Short form: -t for --tx-hash.

Examples:

howmuch-rs fees summary \
--tx-hash=0x073251e7ff3843c4954aa2e7f38d8c29034e34a1ddbaeb1e62605ec10ca22367

or with a local receipt file:

howmuch-rs fees summary --transaction_file example_transaction.json

Input / output formats

  • Transaction receipt input (--transaction-file): a JSON object with a StarkNet transaction receipt, including execution_resources (with n_steps, builtin_instance_counter, n_memory_holes) and actual_fee. A sample receipt is provided in example_transaction.json.
  • Output: human-readable text summarizing fees / resource usage.
  • Logging: RUST_LOG environment variable controls log verbosity (e.g. RUST_LOG=debug).