Skip to content

Commit

Permalink
Overhaul README (paritytech#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshOrndorff authored Mar 28, 2021
1 parent e6f98b5 commit 5f7e770
Showing 1 changed file with 59 additions and 51 deletions.
110 changes: 59 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,43 @@
# ![moonbeam](media/moonbeam-cover.jpg)
# ![Moonbeam](media/moonbeam-cover.jpg)

![Tests](https://github.com/PureStake/moonbeam/workflows/Release/badge.svg)

Run an Ethereum compatible ~~parachain~~ (and blockchain for now, until parachains are more stable)
based on Substrate.
An Ethereum compatible ~~[Parachain](https://polkadot.network/technology/)~~ built with [Substrate](https://substrate.dev)

_See [moonbeam.network](https://moonbeam.network) for the moonbeam blockchain description._
_See [www.substrate.io](https://www.substrate.io/) for substrate information._
_Discover the Moonbeam project at [moonbeam.network](https://moonbeam.network)._
_Learn to [use the Moonbeam network](https://docs.moonbeam.network/) with our technical docs._
_Reference our [crate-level docs (rustdocs)](https://purestake.github.io) to contribute._

## Install (linux)
## Run an alphanet node with Docker

### Get the code

Get the tutorial specific tag of the PureStake/Moonbeam repo:
Docker images are published for every tagged release. Learn more with `moonbeam --help`.

```bash
git clone -b tutorial-v3 https://github.com/PureStake/moonbeam
cd moonbeam
# Join the public testnet
docker run --network="host" purestake/moonbeam:v0.6.1 --chain alphanet
```

### Setting up enviroment

Install Substrate pre-requisites (including Rust):

```bash
curl https://getsubstrate.io -sSf | bash -s -- --fast
```
## Run a local development node with Docker

Run the initialization script, which checks the correct rust nightly version and adds the
`wasm32-unknown-unknown` target to that specific version:
Developers who are building dApps to run on moonbeam, may want a lightweight node to work with
locally. You can quickly spin up a single node with no relay chain backing it using the development
service.

```bash
./scripts/init.sh
# Run a dev service node.
docker run --network="host" purestake/moonbeam:v0.6.1 --dev
```

## Build the Moonbeam Node
### Sealing options

Build the corresponding binary file:
The command above will start the node in instant seal mode. It creates a block when a transaction arrives, similar to Ganache's auto-mine. You can also choose to author blocks at a regular interval, or control authoring manually through the RPC.

```bash
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):
>
> ```bash
> source $HOME/.cargo/env
> ```
# Author a block every 6 seconds.
docker run --network="host" purestake/moonbeam:v0.6.1 --dev --sealing 3000

## 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.
```bash
./target/release/moonbase-standalone --dev
# Manually control the block authorship and finality
docker run --network="host" purestake/moonbeam:v0.6.1 --dev --sealing manual
```

### Dev Addresses
Expand Down Expand Up @@ -103,17 +80,45 @@ the canonical mnemonic: "bottom drive obey lake curtain smoke basket hold race l
- Address:0x7BF369283338E12C90514468aa3868A551AB2929
- PrivKey:0x96b8a38e12e1a31dee1eab2fffdf9d9990045f5b37e44d8cc27766ef294acf18

### Docker image
## Build the Moonbeam Node

To build Moonbeam, you will need a proper Substrate development environment. If you've never worked
with a Substrate-based blockchain before, you should probably try the [Setting Up a Moonbeam Node]
(https://docs.moonbeam.network/getting-started/local-node/setting-up-a-node/) docs first. If you
need a refresher setting up your Substrate environment, see [Substrate's Getting Started Guide]
(https://substrate.dev/docs/en/knowledgebase/getting-started/).

```bash
# Fetch the code
git clone https://github.com/PureStake/moonbeam
cd moonbeam

# Optional: Ensure you have the exact nightly toolchain used by Moonbeam's CI
./scripts/init.sh

# Build the node (The first build will be long (~30min))
cargo build --release
```

## Run tests

Moonbeam has Rust unit tests as well as typescript integration tests.

An alternative to building locally is to use docker to run a pre-build binary.
The only requirement is to have Docker installed.
```bash
# Run the Rust unit tests
cargo test
```

```bash
# Pull the docker image
docker pull purestake/moonbase-parachain-testnet:latest
# Install dependencies for integration tests
cd moonbeam-types-bundle
npm i

# Start a dev node
docker run --rm --network host purestake/moonbase /moonbase/moonbase-standalone --dev
cd ../tests
npm i

# Run integration tests
npm test
```

## Chain IDs
Expand Down Expand Up @@ -177,6 +182,9 @@ This github repository is also linked to Gitlab CI

## Contribute

Moonbeam is open source under the terms of the GPL3. We welcome contributions. You can explore our
crate-level documentation at https://purestake.github.io/moonbeam

### Code style

Moonbeam is following the
Expand Down

0 comments on commit 5f7e770

Please sign in to comment.