DbWeight

Constant v101 → current RuntimeDbWeight

Benchmarks for storage access costs used in fee calculation.

Current Value

0x40787d010000000000e1f50500000000
Relevant 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 { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query DbWeight constant
const value = api.consts[stringCamelCase("System")][stringCamelCase("DbWeight")];
console.log("DbWeight:", value.toHuman());

Type Information

Byte Size
variable bytes
Encoding
composite
Raw Hex
0x40787d010000000000...

Runtime Info

Pallet
System
First Version
v101
Latest Version
v101
Current Runtime
v393