referrerpolicy=no-referrer-when-downgrade

node_primitives/
lib.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Low-level types used throughout the Substrate code.
19
20#![warn(missing_docs)]
21#![cfg_attr(not(feature = "std"), no_std)]
22
23use sp_runtime::{
24	generic,
25	traits::{BlakeTwo256, IdentifyAccount, Verify},
26	MultiSignature, OpaqueExtrinsic,
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/// Some way of identifying an account on the chain. We intentionally make it equivalent
36/// to the public key of our transaction signing scheme.
37pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
38
39/// The type for looking up accounts. We don't expect more than 4 billion of them.
40pub type AccountIndex = u32;
41
42/// Balance of an account.
43pub type Balance = u128;
44
45/// Type used for expressing timestamp.
46pub type Moment = u64;
47
48/// Index of a transaction in the chain.
49pub type Nonce = u32;
50
51/// A hash of some data used by the chain.
52pub type Hash = sp_core::H256;
53
54/// A timestamp: milliseconds since the unix epoch.
55/// `u64` is enough to represent a duration of half a billion years, when the
56/// time scale is milliseconds.
57pub type Timestamp = u64;
58
59/// Digest item type.
60pub type DigestItem = generic::DigestItem;
61/// Header type.
62pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
63/// Block type.
64pub type Block = generic::Block<Header, OpaqueExtrinsic>;
65/// Block ID.
66pub type BlockId = generic::BlockId<Block>;