Header

Composite 520 v393

ethereum::header::Header

About This Type

Structured type: Header.

A struct-like type where each field is encoded in declaration order.

Encoding: Fields encoded consecutively in declaration order, no field names or separators.

Fields (15)

#NameType
0parent_hashH256
1ommers_hashH256
2beneficiaryH160
3state_rootH256
4transactions_rootH256
5receipts_rootH256
6logs_bloomBloom
7difficultyU256
8numberU256
9gas_limitU256
10gas_usedU256
11timestampu64
12extra_dataVec<u8>
13mix_hashH256
14nonceH64

SCALE Encoding

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

Examples

Struct with 15 fields = parent_hash: H256, ommers_hash: H256, beneficiary: H160, state_root: H256, transactions_root: H256, receipts_root: H256, logs_bloom: Bloom, difficulty: U256, number: U256, gas_limit: U256, gas_used: U256, timestamp: u64, extra_data: Vec<u8>, mix_hash: H256, nonce: H64
0x<field0><field1><field2><field3><field4><field5><field6><field7><field8><field9><field10><field11><field12><field13><field14>
field 0 parent_hash: H256
field 1 ommers_hash: H256
field 2 beneficiary: H160
field 3 state_root: H256
field 4 transactions_root: H256
field 5 receipts_root: H256
field 6 logs_bloom: Bloom
field 7 difficulty: U256
field 8 number: U256
field 9 gas_limit: U256
field 10 gas_used: U256
field 11 timestamp: u64
field 12 extra_data: Vec<u8>
field 13 mix_hash: H256
field 14 nonce: H64

Code Examples

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

const registry = new TypeRegistry();

// Encode Header
const value = registry.createType("Header", {
  parent_hash: 0,
  ommers_hash: 0,
  beneficiary: 0,
  state_root: 0,
  transactions_root: 0,
  receipts_root: 0,
  logs_bloom: 0,
  difficulty: 0,
  number: 0,
  gas_limit: 0,
  gas_used: 0,
  timestamp: 1_000_000_000n,
  extra_data: 0,
  mix_hash: 0,
  nonce: 0
});
console.log("Hex:", value.toHex());

Referenced By (5)

Type Information

Type ID
520
Kind
Composite
Path
ethereum::header::Header
Runtime
v393