Benchmarks for storage access costs used in fee calculation.
Current Value
0x40787d010000000000e1f50500000000Relevant for: developersvalidators
The Big Picture
Storage operations (read/write) contribute to transaction weight. This constant provides the benchmark costs. More storage operations = higher weight = higher fees.
Why This Matters
Transactions that read/write more storage cost more. Understanding DbWeight helps you estimate fees for storage-heavy operations.
Example
A read costs ~25µs worth of weight, a write costs ~100µs. If your transaction does 10 reads and 5 writes, that's 750µs of DbWeight contribution to your fee.
Common Questions
- Why are writes more expensive than reads?
- Writes modify state, requiring more work (hashing, proof updates, persistence).
From Chain Metadata
The weight of runtime database operations the runtime can invoke.
Use Cases
- Weight calculation
- Fee estimation
- Benchmarking
Code Examples
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query DbWeight constant
const value = await api.constants.System.DbWeight();
console.log("DbWeight:", value);Type Information
- Type
- RuntimeDbWeight
- Byte Size
- variable bytes
- Encoding
- composite
- Raw Hex
- 0x40787d010000000000...
Runtime Info
- Pallet
- System
- First Version
- v101
- Latest Version
- v101
- Current Runtime
- v411