gear_runtime_primitives/
lib.rs

1// This file is part of Gear.
2
3// Copyright (C) 2021-2025 Gear Technologies Inc.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19//! Low-level types used throughout the Substrate code.
20
21#![warn(missing_docs)]
22#![cfg_attr(not(feature = "std"), no_std)]
23
24use sp_runtime::{
25    MultiSignature, OpaqueExtrinsic, generic,
26    traits::{BlakeTwo256, IdentifyAccount, Verify},
27};
28
29/// An index to a block.
30pub type BlockNumber = u32;
31
32/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
33pub type Signature = MultiSignature;
34
35/// Alias to the public key used for this chain.
36pub type AccountPublic = <Signature as Verify>::Signer;
37
38/// Some way of identifying an account on the chain. We intentionally make it equivalent
39/// to the public key of our transaction signing scheme.
40pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
41
42/// The type for looking up accounts. We don't expect more than 4 billion of them.
43pub type AccountIndex = u32;
44
45/// Balance of an account.
46pub type Balance = u128;
47
48/// Type used for expressing timestamp.
49pub type Moment = u64;
50
51/// Nonce of a transaction in the chain.
52pub type Nonce = u32;
53
54/// A hash of some data used by the chain.
55pub type Hash = sp_core::H256;
56
57/// A timestamp: milliseconds since the unix epoch.
58/// `u64` is enough to represent a duration of half a billion years, when the
59/// time scale is milliseconds.
60pub type Timestamp = u64;
61
62/// Digest item type.
63pub type DigestItem = generic::DigestItem;
64/// Header type.
65pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
66/// Block type.
67pub type Block = generic::Block<Header, OpaqueExtrinsic>;
68/// Block ID.
69pub type BlockId = generic::BlockId<Block>;
70
71/// SS58 prefix of VARA.
72pub const VARA_SS58_PREFIX: u8 = 137;