Code Monkey home page Code Monkey logo

moonbeam's Introduction

moonbeam

Tests

Run an Ethereum compatible parachain (and blockchain for now, until parachains are more stable) based on Substrate.

See moonbeam.network for the moonbeam blockchain description.
See www.substrate.io for substrate information.

Install (linux)

Get the code

Get the tutorial specific tag of the PureStake/Moonbeam repo:

git clone -b tutorial-v3 https://github.com/PureStake/moonbeam
cd moonbeam

Setting up enviroment

Install Substrate pre-requisites (including Rust):

curl https://getsubstrate.io -sSf | bash -s -- --fast

Run the initialization script, which checks the correct rust nightly version and adds the WASM to that specific version:

./scripts/init.sh

Build Standalone

Build the corresponding binary file:

cd node/standalone
cargo build --release

Build Parachain

Build the corresponding binary file:

cargo build --release

The first build takes a long time, as it compiles all the necessary libraries.

Troubleshooting

If a cargo not found error appears in the terminal, manually add Rust to your system path (or restart your system):

source $HOME/.cargo/env

Run

Standalone Node in dev mode

./node/standalone/target/release/moonbase-standalone --dev

Docker image

Standlone node

An alternative to the steps higlighted before is to use docker to run a pre-build binary. Doing so, you prevent having to install Substrate and all the dependencies, and you can skip the building the node process as well. The only requirement is to have Docker installed, and then you can execute the following command to download the corresponding image:

docker pull purestake/moonbase:tutorial-v3

Once the Docker image is downloaded, you can run it with the following line:

docker run --rm --name moonbeam_standalone --network host purestake/moonbase:tutorial-v3 /moonbase/moonbase-standalone --dev

Chain IDs

The ethereum specification described a numeric Chain Id. The Moonbeam mainnet Chain Id will be 1284 because it takes 1284 milliseconds for a moonbeam to reach Earth.

Moonbeam nodes support multiple public chains and testnets, with the following Chain Ids.

Network Description Chain ID
Local Parachain TestNet 1280
Local Standalone TestNet 1281
Reserved for other TestNets 1282 - 1283
Moonbeam (Polkadot) 1284
Moonriver (Kusama) 1285
Moonrock (Rococo) 1286
Moonbase Alpha TestNet 1287
Reserved for other public networks 1288 - 1289

Runtime Architecture

The Moonbeam Runtime is built using FRAME and consists of several core pallets, as well as a few pallets that are only present conditionally. The core pallets are:

  • Balances: Tracks GLMR token balances
  • Sudo: Allows a privledged acocunt to make arbitrary runtime changes - will be removed before launch
  • Timestamp: On-Chain notion of time
  • EVM: Encapsulates execution logic for an Ethereum Virtual Machine
  • Ethereum: Ethereum-style data encoding and access for the EVM.
  • Ethereum Chain Id: A place to store the chain id for each Moonbeam network
  • Transaction Payment: Transaction payment (fee) management
  • Randomness Collective Flip: A (mock) onchain randomness beacon. Will be replaced by parachain randomness by mainnet.

Parachain

In addition to the core pallets above, the parachain node also features

  • ParachainUpgrade: A helper to perform runtime upgrades on parachains
  • MessageBroker: A helper to receive incoming XCPM messages
  • ParachainInfo: A place to store parachain-relevant constants like parachain id
  • TokenDealer: A helper for accepting incoming cross-chain asset transfers

Standalone

In addition to the core pallets above, the standalone node also features

  • Aura: Slot-based Authority Consensus
  • Grandpa: GRANDPA Authority consensus (This will be removed once it becomes a parachain)

Tests

Tests are run with the following command:

cargo test --verbose

This github repository is also linked to Gitlab CI

Contribute

Code style

Moonbeam is following the Substrate code style
We provide a .editorconfig (compatible with VSCode using RLS)

moonbeam's People

Contributors

crystalin avatar tgmichel avatar joshorndorff avatar mario-sangar avatar thequantumphysicist avatar albertov19 avatar joelamouche avatar dtyoo avatar dependabot[bot] avatar nanocryk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.