moonbeam_core_primitives/lib.rs
1// Copyright 2019-2025 PureStake Inc.
2// This file is part of Moonbeam.
3
4// Moonbeam is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Moonbeam is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.
16
17#![cfg_attr(not(feature = "std"), no_std)]
18
19use account::EthereumSignature;
20use sp_runtime::traits::BlakeTwo256;
21pub use sp_runtime::OpaqueExtrinsic;
22use sp_runtime::{
23 generic,
24 traits::{IdentifyAccount, Verify},
25};
26
27pub type Block = generic::Block<Header, OpaqueExtrinsic>;
28/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
29pub type Signature = EthereumSignature;
30/// Some way of identifying an account on the chain. We intentionally make it equivalent
31/// to the public key of our transaction signing scheme.
32pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
33/// AssetId type
34pub type AssetId = u128;
35/// Balance of an account.
36pub type Balance = u128;
37/// An index to a block.
38pub type BlockNumber = u32;
39/// A hash of some data used by the chain.
40pub type Hash = sp_core::H256;
41/// Block header type as expected by this runtime.
42pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
43/// Index of a transaction in the chain.
44pub type Index = u32;
45/// The address format for describing accounts.
46pub type Address = AccountId;
47/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
48/// never know...
49pub type AccountIndex = u32;
50/// Digest item type.
51pub type DigestItem = generic::DigestItem;