starknet-network-facts
Starknet Network Facts
When to Use
- Reasoning about chain behavior assumptions in contract logic.
- Validating time, fee, and transaction-version dependencies.
When NOT to Use
- Contract implementation details unrelated to chain behavior.
Quick Start
- Identify assumptions in code about tx versions, fee tokens, and timing.
- Verify assumptions against current network behavior before release.
- Add tests for boundary behavior tied to block timing or tx metadata.
Core Focus
- transaction version expectations
- fee token and bounds assumptions
- block-time-sensitive logic
- sequencer and inclusion model implications
Workflow
- Main network-facts workflow: default workflow
References
- Module index: references index
starknet.js Example
import { RpcProvider } from "starknet";
const provider = new RpcProvider({ nodeUrl: process.env.STARKNET_RPC! });
const latest = await provider.getBlock("latest");
console.log({
blockNumber: latest.block_number,
l1GasPrice: latest.l1_gas_price,
l2GasPrice: latest.l2_gas_price,
});
Error Codes and Recovery
| Code | Meaning | Recovery |
|---|---|---|
SNF-001 |
RPC/network fact unavailable | Retry with a fallback RPC and compare outputs before acting. |
SNF-002 |
Conflicting tx-version assumption | Re-check references and update guards/tests for current tx version behavior. |
SNF-003 |
Fee-token assumption mismatch | Add explicit fee-token checks and fee-bound regression tests. |
More from keep-starknet-strange/starknet-agentic
cairo-optimization
Improves Cairo performance after correctness is established. Trigger on "optimize", "gas usage", "reduce steps", "profile", "BoundedInt", "storage packing", "benchmark". Guides profiling, arithmetic optimization, and bounded-int hardening.
41cairo-testing
Cairo smart-contract testing with snforge. Trigger on "write tests", "add unit tests", "fuzz test", "integration test", "test this contract", "regression test". Guides test strategy, cheatcode usage, and coverage.
35cairo-deploy
Deployment guidance for Cairo contracts on Starknet covering sncast commands, account setup, declare/deploy workflow, network configuration, and contract verification.
33cairo-contracts
Use when writing Cairo smart contracts on Starknet — contract structure, storage, events, interfaces, components, OpenZeppelin v3 patterns, and common contract templates.
32cairo-security
Use when reviewing Cairo contracts for security — common vulnerabilities, audit patterns, production hardening, Cairo-specific pitfalls, L1/L2 bridging safety, session key security, precision/rounding bugs, static analysis tooling. Sourced from 50+ public audits and the Cairo Book.
30starknet-js
Reference for building Starknet applications using starknet.js v9.x SDK, including contract interaction, account management, transaction handling, fee estimation, wallet integration, and paymaster flows.
28