FixedI128
Composite 187 v411substrate_fixed::FixedI128
About This Type
Signed binary fixed-point integer with `.bits` codec (substrate-fixed).
Subtensor uses substrate-fixed FixedI128<Frac> aliases (commonly I64F64, sometimes I96F32) for signed quantities like EMAs, weights, and consensus calculations. The chain typeName drops the Frac type parameter; resolve it from the use-site alias.
Encoding: Signed substrate-fixed types encode in two's complement. BigInt("0x...") in JS does NOT sign-extend — for a negative value it returns a huge positive integer. Mask to the inner bit width and adjust manually (e.g. for i128: `v >= 2n**127n ? v - 2n**128n : v`).
For I64F64 (Frac=64): real = bits / 2^64. For I96F32 (Frac=32): real = bits / 2^32.
Common Uses
- • EMA tracking (SubnetEmaTaoFlow, SubnetEmaProtocolFlow)
- • Signed weight and consensus computations
- • Subnet economic smoothing factors
Fields (1)
| # | Name | Type |
|---|---|---|
| 0 | bits | i128 |
SCALE Encoding
- Rule
- 1 field encoded consecutively in declaration order. No field names or delimiters.
- Size
- sum of field sizes
Examples
Struct with 1 field = bits: i128
0x<field0>field 0 bits: i128Code Examples
import { TypeRegistry } from "@polkadot/types";
const registry = new TypeRegistry();
// Encode FixedI128
const value = registry.createType("FixedI128", {
bits: 0
});
console.log("Hex:", value.toHex());Type Parameters
Frac = UInt
Referenced By (8)
Type Information
- Type ID
- 187
- Kind
- Composite
- Path
- substrate_fixed::FixedI128
- Runtime
- v411