Bool

Primitive 9 v393

About This Type

Boolean value: true or false.

Used for flags and binary state.

Encoding: 1 byte: 0x00 = false, 0x01 = true.

Primitive Type

Name
Bool
Byte Size
1 byte
SCALE Encoding
Fixed-width, little-endian

SCALE Encoding

Rule
Fixed 1 byte: 0x00 = false, 0x01 = true.
Size
1 byte

Examples

true
0x01
01 true
false
0x00
00 false

Code Examples

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

const registry = new TypeRegistry();

// Encode a Bool value
const value = registry.createType("Bool", true);
console.log("Hex:", value.toHex());
console.log("Bytes:", value.toU8a());

Type Information

Type ID
9
Kind
Primitive
Runtime
v393