Weight

Composite 11 v393

sp_weights::weight_v2::Weight

About This Type

Transaction weight measuring computational cost.

Substrate Weight tracks execution time (ref_time) and proof size. Used to calculate transaction fees and ensure blocks do not exceed resource limits.

Common Uses

  • • Fee estimation
  • • Block weight limits
  • • Benchmarking extrinsics

Fields (2)

#NameType
0ref_timeCompact<u64>
1proof_sizeCompact<u64>

SCALE Encoding

Rule
2 fields encoded consecutively in declaration order. No field names or delimiters.
Size
sum of field sizes

Examples

Struct with 2 fields = ref_time: Compact<u64>, proof_size: Compact<u64>
0x<field0><field1>
field 0 ref_time: Compact<u64>
field 1 proof_size: Compact<u64>

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode Weight
const value = registry.createType("Weight", {
  ref_time: 0,
  proof_size: 0
});
console.log("Hex:", value.toHex());

Referenced By (21)

and 1 more...

Type Information

Type ID
11
Kind
Composite
Path
sp_weights::weight_v2::Weight
Runtime
v393