Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alling mainnet and develop #102

Merged
merged 5 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23,513 changes: 14,303 additions & 9,210 deletions Cargo.lock

Large diffs are not rendered by default.

178 changes: 178 additions & 0 deletions Cargo.toml

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
<div align="center">
<img src="https://140069760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqMnH71Mmd7Au6HK5UAji%2Fuploads%2FEmgmn8pgCqu9eJaQPNSO%2FNeuroWeb%20X%20visual%20(1).jpg?alt=media&token=320f5009-0932-4ecc-a5a6-3bbb7a56cf45">


[![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Substrate version](https://img.shields.io/badge/Substrate-3.0.0-brightgreen?logo=Parity%20Substrate)](https://substrate.io)
[![Twitter URL](https://img.shields.io/twitter/follow/NeuroWebAI?style=social)](https://twitter.com/NeuroWebAI)
[![Telegram](https://img.shields.io/endpoint?color=neon&style=flat-square&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Forigintrail)](https://t.me/origintrail)
[![Medium](https://badgen.net/badge/icon/medium?icon=medium&label)](https://medium.com/origintrail)
[![Discord](https://img.shields.io/badge/Discord-gray?logo=discord)](https://discord.gg/FCgYk2S)

</div>

NeuroWeb Network is a decentralized Artificial Intelligence blockchain designed to incentivise knowledge creation, connectivity and sharing through **Knowledge Mining**. It's utility token NEURO is designed to fuel the AI knowledge economy, rewarding relevant knowledge contributions to the **OriginTrail Decentralized Knowledge Graph**.
Expand Down Expand Up @@ -48,7 +47,7 @@ To run a full network with multiple NeuroWeb nodes (collators and non-collators)
#### Run A Relay Chain

To start a relay chain we recommend reading and following instructions in [Cumulus Workshop](https://docs.substrate.io/tutorials/build-a-parachain/prepare-a-local-relay-chain/).
NeuroWeb is currently compatible with Polkadot v0.9.40 version.
NeuroWeb is currently compatible with Polkadot v1.11.0 version.

#### Parachain Nodes (Collators)

Expand Down Expand Up @@ -98,10 +97,13 @@ Ensure you set the `ParaId to 2000` and the `parachain: Bool to Yes`.
### Containerize

#### Build

```shell
docker build -t origintrail-parachain .
```

#### Run

```shell
docker run -it -p 30333:30333 -p 9933:9933 -p 9944:9944 -p 9615:9615 -v /data:/data origintrail-parachain:latest\
--base-path=/data --rpc-external --ws-external\
Expand Down
130 changes: 67 additions & 63 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neuroweb-node"
version = "1.3.0"
version = "1.5.0"
authors = ["TraceLabs"]
description = "NeuroWeb - Cumulus FRAME-based Substrate Node"
license = "GPL-3.0-only"
Expand All @@ -14,87 +14,91 @@ name = "neuroweb"
path = "src/main.rs"

[dependencies]
clap = { version = "4.1.8", features = ["derive"] }
futures = "0.3"
log = "0.4.17"
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.152", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
clap = { workspace = true }
futures = { workspace = true }
log = { workspace = true }
codec = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["arbitrary_precision"] }
jsonrpsee = { workspace = true }

# Local
neuroweb-runtime = { path = "../runtime" }
neuroweb-runtime = { workspace = true }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-benchmarking = { workspace = true }
frame-benchmarking-cli = { workspace = true }
pallet-transaction-payment-rpc = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-consensus = { workspace = true }
sc-consensus-aura = { workspace = true }
sc-executor = { workspace = true }
sc-keystore = { workspace = true }
sc-network = { workspace = true }
sc-network-sync = { workspace = true }
sc-rpc = { workspace = true }
sc-rpc-api = { workspace = true }
sc-service = { workspace = true }
sc-sysinfo = { workspace = true }
sc-telemetry = { workspace = true }
sc-tracing = { workspace = true }
sc-transaction-pool = { workspace = true }
sc-transaction-pool-api = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-blockchain = { workspace = true }
sp-consensus = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-inherents = { workspace = true }
sp-keystore = { workspace = true }
sp-offchain = { workspace = true }
sp-runtime = { workspace = true }
sp-timestamp = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40" }
polkadot-cli = { workspace = true }
polkadot-primitives = { workspace = true }
polkadot-service = { workspace = true }
xcm = { workspace = true }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-cli = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true }

# Frontier
fp-evm = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fp-rpc = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-db = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-rpc = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-rpc-core = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-storage = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-mapping-sync = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fp-evm = { workspace = true }
fp-rpc = { workspace = true }
fc-api = { workspace = true }
fc-db = { workspace = true }
fc-rpc = { workspace = true }
fc-rpc-core = { workspace = true }
fc-storage = { workspace = true }
fc-mapping-sync = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-build-script-utils = { workspace = true }

[features]
default = ["fc-rpc/rpc-binary-search-estimate"]
runtime-benchmarks = [
"try-runtime-cli/try-runtime",
"neuroweb-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
]
try-runtime = [
"try-runtime-cli/try-runtime",
"neuroweb-runtime/try-runtime",
]
116 changes: 48 additions & 68 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cumulus_primitives_core::ParaId;
use neuroweb_runtime::{AccountId, AuraId,
EVMConfig, EthereumConfig, Signature, EXISTENTIAL_DEPOSIT};
EVMConfig, Signature, EXISTENTIAL_DEPOSIT};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
Expand All @@ -10,7 +10,7 @@ use std::{collections::BTreeMap, str::FromStr};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec =
sc_service::GenericChainSpec<neuroweb_runtime::GenesisConfig, Extensions>;
sc_service::GenericChainSpec<neuroweb_runtime::RuntimeGenesisConfig, Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
Expand Down Expand Up @@ -65,19 +65,22 @@ pub fn template_session_keys(keys: AuraId) -> neuroweb_runtime::SessionKeys {

pub fn development_config() -> ChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "OTP".into());
properties.insert("tokenSymbol".into(), "NEURO".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 101.into());

ChainSpec::from_genesis(
// Name
"Development",
// ID
"dev",
ChainType::Development,
move || {
testnet_genesis(
// initial collators.
ChainSpec::builder(
neuroweb_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2043,
},
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_properties(properties)
.with_genesis_config(testnet_genesis(
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -103,36 +106,29 @@ pub fn development_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
2000.into(),
)
},
Vec::new(),
None,
None,
None,
None,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2000,
},
)
2043.into(),
))
.build()
}

pub fn local_testnet_config() -> ChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "OTP".into());
properties.insert("tokenSymbol".into(), "NEURO".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 101.into());

ChainSpec::from_genesis(
// Name
"OriginTrail Parachain Testnet",
// ID
"origintrail_parachain_testnet",
ChainType::Local,
move || {
testnet_genesis(
// initial collators.
ChainSpec::builder(
neuroweb_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2043,
},
)
.with_name("NeuroWeb Testnet")
.with_id("neuroweb_testnet")
.with_chain_type(ChainType::Local)
.with_properties(properties)
.with_genesis_config(testnet_genesis(
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -158,43 +154,26 @@ pub fn local_testnet_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
2000.into(),
)
},
// Bootnodes
Vec::new(),
// Telemetry
None,
// Protocol ID
Some("origintrail-parachain"),
// Fork ID
None,
// Properties
Some(properties),
// Extensions
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2000,
},
)
2043.into(),
))
.build()
}

fn testnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
_root_key: AccountId,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> neuroweb_runtime::GenesisConfig {
neuroweb_runtime::GenesisConfig {
system: neuroweb_runtime::SystemConfig {
code: neuroweb_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
},
) -> serde_json::Value {
let config = neuroweb_runtime::RuntimeGenesisConfig {
system: Default::default(),
balances: neuroweb_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: neuroweb_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: neuroweb_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
collator_selection: neuroweb_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -219,11 +198,8 @@ fn testnet_genesis(
parachain_system: Default::default(),
polkadot_xcm: neuroweb_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
// sudo: SudoConfig {
// // Assign network admin rights.
// key: Some(root_key),
// },
vesting: Default::default(),
treasury: Default::default(),
evm: EVMConfig {
Expand Down Expand Up @@ -259,10 +235,14 @@ fn testnet_genesis(
);
map
},
..Default::default()
},
ethereum: EthereumConfig {},
ethereum: Default::default(),
base_fee: Default::default(),
council: Default::default(),
democracy: Default::default(),
}
transaction_payment: Default::default(),
};

serde_json::to_value(&config).expect("Could not build genesis config.")
}
Loading
Loading