GithubHelp home page GithubHelp logo

mario-sangar / moonbeam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moonbeam-foundation/moonbeam

0.0 0.0 0.0 7.87 MB

License: GNU General Public License v3.0

Rust 50.17% Shell 5.39% Dockerfile 1.03% TypeScript 42.64% Ruby 0.62% HTML 0.14%

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 wasm32-unknown-unknown target to that specific version:

./scripts/init.sh

Build the Moonbeam Node

Build the corresponding binary file:

cargo build --release

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

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 a Development Node

Moonbeam is designed to be a parachain on the Polkadot network. For testing your contracts locally, spinning up a full relay-para network is a lot of overhead.

A simpler solution is to run the --dev node, a simple node that is not backed by any relay chain, but still runs the Moonbeam runtime logic.

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

Docker image

An alternative to building locally is to use docker to run a pre-build binary. The only requirement is to have Docker installed.

# Pull the docker image
docker pull purestake/moonbase-parachain-testnet:latest

# Start a dev node
docker run --rm --network host purestake/moonbase /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 Development 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 pallets from substrate, frontier, cumulus, and pallets/.

From substrate:

  • Balances: Tracks GLMR token balances
  • Sudo: Allows a privileged account to make arbitrary runtime changes - will be removed before launch
  • Timestamp: On-Chain notion of time
  • Transaction Payment: Transaction payment (fee) management
  • Randomness Collective Flip: A (mock) onchain randomness beacon. Will be replaced by parachain randomness by mainnet.

From frontier:

  • EVM: Encapsulates execution logic for an Ethereum Virtual Machine
  • Ethereum: Ethereum-style data encoding and access for the EVM.

From cumulus:

  • ParachainUpgrade: A helper to perform runtime upgrades on parachains
  • ParachainInfo: A place to store parachain-relevant constants like parachain id

The following pallets are stored in pallets/. They are designed for Moonbeam's specific requirements:

  • Ethereum Chain Id: A place to store the chain id for each Moonbeam network
  • Author Inherent: Allows block authors to include their identity in a block via an inherent
  • Stake: Minimal staking pallet that implements ordered validator selection by total amount at stake

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

4meta5 avatar albertov19 avatar crystalin avatar dependabot[bot] avatar dtyoo avatar girazoki avatar joelamouche avatar joshorndorff avatar mario-sangar avatar nanocryk avatar notlesh avatar tgmichel avatar thequantumphysicist 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.