What is Starkli
masterstarknet-rs and provides a fast, intuitive way to query the Starknet network and execute transactions.repository·master·Indexed 41 days ago
https://github.com/xjonathanlei/starkliA high-performance CLI tool for interacting with Starknet, powered by starknet-rs. Starkli v0.4.2 provides utilities for managing accounts (supporting Argent, Braavos, and OpenZeppelin variants), declaring Sierra classes, deploying contracts via the Universal Deployer Contract, and handling EIP-2645 HD wallet paths. It features an argument resolution system to simplify inputs using schemes like addr, u256, str, const, selector, storage, and bytearray.
starknet-rs and provides a fast, intuitive way to query the Starknet network and execute transactions.Starting with release v0.4.0, Starkli switched from spec v0.7.1 to v0.8.0. Consequently, Starkli no longer supports paying fees in ETH. All transactions must use STRK for fees.
Note for legacy requirements: If you must send pre-v3 transactions (which allow paying fees in ETH), you must use a v0.3.x Starkli release. However, it is recommended to upgrade contracts to be v3-compatible as pre-v3 transactions will eventually be disabled on the Starknet network.
Starkli connects to the Starknet network through "providers". Currently, Starkli only supports JSON-RPC providers (the sequencer gateway has been deprecated and removed).
Providers can be specified in two ways:
Important Notes:
starkli -vV.sepolia network. If sepolia is not defined in your profile, it uses a free RPC vendor. It is recommended to explicitly define your network rather than relying on this fallback.Starknet uses account abstraction, meaning all accounts are smart contracts. Starkli supports different "flavors" of accounts, referred to as variants. When using the starkli account command, you must specify the variant identifier to access variant-specific subcommands.
Supported variants include:
argent: Argent Xbraavos: Braavosoz: OpenZeppelinStarkli uses argument resolution to expand simple, human-readable inputs into the actual field element arguments required by the network.
By default, arguments are parsed as raw field elements (accepting decimal or hexadecimal). To trigger the resolution process, use the format scheme:content, where scheme is a supported resolution type and content is the input for that scheme.
This makes interacting with contracts easier by allowing you to use names, strings, or integers instead of manually calculating field elements.
The provider field determines how Starkli connects to the network. It can be a shorthand String or a detailed Object.
Used to connect to a specific JSON-RPC endpoint URL.
Shorthand (String): Pass the URL directly as a string.
provider = "https://example.com/"Full Configuration (Object):
Use an object with type = "rpc". This allows for custom HTTP headers.
| Field | Mandatory | Type | Description |
|---|---|---|---|
type | Yes | String | Must be rpc |
url | Yes | String | The JSON-RPC endpoint URL |
headers | No | HttpHeader[] | Array of { name, value } objects |
Used to leverage supported free RPC vendors.
| Field | Mandatory | Type | Description |
|---|---|---|---|
type | Yes | String | Must be free |
vendor | Yes | String | Must be either blast or nethermind |
# RPC Object Example
[default.networks.mainnet]
chain_id = "SN_MAIN"
provider = { type = "rpc", url = "https://example.com/", headers = [ { name = "Api-Key", value = "xxxx" } ] }
# Free Vendor Example
[default.networks.mainnet]
chain_id = "SN_MAIN"
provider = { type = "free", vendor = "blast" }To provide a zero-setup experience, Starkli supports free RPC vendors for specific networks.
Eligible Networks:
mainnetsepoliaBehavior: If you attempt to use one of these networks and it is not already defined in your active profile, Starkli will automatically use the Blast free vendor. This choice is then persisted in your profile, and all subsequent calls for that network will use the same vendor automatically.
You can change the assigned vendor at any time by manually editing your profiles.
In Starkli, a signer is any entity capable of providing valid signatures for transactions. Signers are managed or created using the starkli signer command. Currently, Starkli supports three types of signers:
Hardware wallets like Ledger use Hierarchical Deterministic (HD) paths to derive private keys from a single seed phrase. For Starknet, the standard HD paths (e.g., m/44'/60'/0'/0/0) are not compatible with the Starknet Ledger app. Instead, you must use the EIP-2645 path format.
A standard EIP-2645 path follows this structure:
m/2645'/layer'/application'/eth_address_1'/eth_address_2'/index
In this format, layer, application, eth_address_1, eth_address_2, and index are all 31-bit unsigned numbers.
Because it is difficult to reverse-engineer which HD path corresponds to a specific public key, you must document the paths you use.
Starkli recommends the following pattern for managing multiple accounts:
m//starknet'/starkli' prefix for the first 3 levels.eth_address_1 level constant at 0'.eth_address_2 level as your counter: start at 0' for your first account and increment it for subsequent accounts.index level at 0.Why use eth_address_2 as the counter?
While you could increment the index instead, incrementing eth_address_2 is safer. If you only increment the index and an attacker gains access to the xpub key at the eth_address_2 level, they could potentially compromise the entire set of keys if any single private key in that set is compromised.
Because standard EIP-2645 paths require manually calculating hashes for names, Starkli provides a user-friendly extension. This extension allows you to use non-numerical strings for the layer and application segments, which Starkli automatically converts into the required 31-bit unsigned numbers.
Note: These string-based paths are a Starkli-only extension. They will not work with other HD wallet software (like starknet-rs).
Instead of calculating hashes, you can write:
m/2645'/starknet'/starkli'/0'/0'/0
2645' segmentSince Starkli exclusively uses EIP-2645 paths, you can simplify your path by leaving the first level empty:
m//starknet'/starkli'/0'/0'/0
# Example of a Starkli-style path using strings and omitting the 2645' segment
m//starknet'/starkli'/0'/0'/0The profiles.toml file is used to define custom networks. It is created automatically the first time you use a free RPC vendor. Depending on your operating system, the file is located at:
~/.config/starkli/profiles.toml%AppData%\starkli\profiles.toml