Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Prepare mainnet chainspec (#56)
Browse files Browse the repository at this point in the history
* Reset genesis root balance 30000 ksx

* Prepare sherpax mainnet chainspec

* Add sherpax mainnet chainspec by git-lfs

* Run `make format`

* Update README.md

Co-authored-by: icodezjb <[email protected]>
  • Loading branch information
icodezjb and icodezjb authored Jan 12, 2022
1 parent ec02b8a commit 7ed6de1
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node/res/sherpax-raw.json filter=lfs diff=lfs merge=lfs -text
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,9 @@ Refer [Interacting with Moonbeam Using Remix](https://docs.moonbeam.network/gett

## 4. Assets Bridge
Refer [AssetsBridge](./xpallets/assets-bridge/README.md)

## 5. SherpaX Mainnet
[shrepax mainnet chainspec(272MB)](./node/res/sherpax-raw.json)
```bash
./target/release/sherpax --chain=./node/res/sherpax-raw.json --tmp
```
14 changes: 7 additions & 7 deletions node/res/genesis_config/gateway/btc_genesis_params_testnet.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"network": "Testnet",
"confirmation_number": 6,
"height": 70280,
"hash": "0000012b70681d72680375ef72f96c7d9932e9b11d4f4f93a0d6973154e0fbe0",
"height": 72586,
"hash": "000000c99d101b765528ec78a76fe69ea2ed5436eef58c3cb1ffe44c5bd5793a",
"version": 536870912,
"previous_header_hash": "0000006d433f26883aeefa86364ee85ade714685c617fe37d10d11696e322568",
"merkle_root_hash": "f6cb58d2b9358a2c62d336cbbfd8e0873e53ca1d1b6fe7bf7df4df3b47eda859",
"time": 1640573457,
"bits": 503404228,
"nonce": 11603258
"previous_header_hash": "00000103baf0e88ee974a735fa942be0984b7776e445e2d147a37dd8de81e3ff",
"merkle_root_hash": "9ac6a2f0b393d437459f0ea87521d0503836b65a5b44a2f6d42a2514159c7ea2",
"time": 1641953597,
"bits": 503409496,
"nonce": 2235043
}
3 changes: 3 additions & 0 deletions node/res/sherpax-raw.json
Git LFS file not shown
45 changes: 34 additions & 11 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::bitcoin::{
use frame_benchmarking::frame_support::PalletId;
use hex_literal::hex;
use sc_chain_spec::ChainSpecExtension;
use sc_service::config::TelemetryEndpoints;
use sc_service::{ChainType, Properties};
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
Expand All @@ -19,11 +20,21 @@ use sp_core::crypto::UncheckedInto;
use sp_core::{sr25519, Pair, Public};
use sp_finality_grandpa::AuthorityId as GrandpaId;
use sp_runtime::traits::{AccountIdConversion, IdentifyAccount, Verify};
use std::collections::BTreeMap;
use std::{collections::BTreeMap, convert::TryInto};

// The URL for the telemetry server.
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
// Note this is the URL for the telemetry server
const POLKADOT_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
const CHAINX_TELEMETRY_URL: &str = "wss://telemetry.chainx.org/submit/";

const DEFAULT_PROTOCOL_ID: &str = "sherpax";

macro_rules! bootnodes {
( $( $bootnode:expr, )* ) => {
vec![
$($bootnode.to_string().try_into().expect("The bootnode is invalid"),)*
]
}
}
/// Node `ChainSpec` extensions.
///
/// Additional parameters for some Substrate core modules,
Expand Down Expand Up @@ -309,7 +320,13 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
}

#[allow(unused)]
pub fn testnet_config() -> Result<ChainSpec, String> {
pub fn mainnet_config() -> Result<ChainSpec, String> {
let bootnodes = bootnodes![
"/ip4/52.77.243.26/tcp/10025/ws/p2p/12D3KooWK6zL4BFCFgcfCLn8xMmZcAp1wX6nTGfJx3gRzbq6qE3Y",
"/ip4/47.114.74.52/tcp/40041/ws/p2p/12D3KooWJws7aM9euRhEM2CAvNTvKboiVi9wFRdHeWjtLUEiAJWo",
"/ip4/116.62.46.8/tcp/40042/ws/p2p/12D3KooWSAeap3NaSihLuz85tX8uKn8f8Wfgo8iY9WFM1MRAvQiX",
];

let mut properties = Properties::new();
properties.insert("tokenSymbol".into(), "KSX".into());
properties.insert("tokenDecimals".into(), 18i32.into());
Expand All @@ -320,9 +337,9 @@ pub fn testnet_config() -> Result<ChainSpec, String> {

Ok(ChainSpec::from_genesis(
// Name
"SherpaX Testnet",
"SherpaX",
// ID
"sherpax_testnet",
"sherpax_singleton",
ChainType::Live,
move || {
sherpax_genesis(
Expand Down Expand Up @@ -363,11 +380,17 @@ pub fn testnet_config() -> Result<ChainSpec, String> {
)
},
// Bootnodes
vec![],
bootnodes,
// Telemetry
None,
Some(
TelemetryEndpoints::new(vec![
(CHAINX_TELEMETRY_URL.to_string(), 0),
(POLKADOT_TELEMETRY_URL.to_string(), 0),
])
.expect("SherpaX telemetry url is valid; qed"),
),
// Protocol ID
None,
Some(DEFAULT_PROTOCOL_ID),
// Properties
Some(properties),
// Extensions
Expand Down Expand Up @@ -549,8 +572,8 @@ fn load_genesis_config(

// total transfer vesting balances
let transfer_balances = 2631584779144690000000000u128;
// 10000 ksx
let root_balance = 10000000000000000000000u128.saturating_add(transfer_balances);
// 30000 ksx + transfer vesting balances
let root_balance = 30000000000000000000000u128.saturating_add(transfer_balances);

let back_to_treasury = 21000000000000000000000000u128
.saturating_sub(root_balance)
Expand Down

0 comments on commit 7ed6de1

Please sign in to comment.