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

Improve Build Docs and Agile Coretime - Coreify The Build Section #5811

Merged
merged 21 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
280 changes: 127 additions & 153 deletions docs/build/build-guide.md

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions docs/build/build-guides-coretime-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
id: build-guides-coretime-start
title: Getting Started - Intro to the Polkadot SDK
sidebar_label: Intro to the Polkadot SDK
description: Introduction to the Polkadot SDK
keywords: [coretime, blockspace, parathread, parachain, cores]
slug: ../build-guides-coretime-start
---

:::warning This section is under construction!

:::

:::warning Only for Kusama and testnets!

Agile coretime is only for the Kusama and testnet networks at the moment, and is not yet deployed on
Polkadot.

:::

## Polkadot SDK

At first glance, the Polkadot SDK can be rather overwhelming, and in a way it is - it packs a lot of
tech into one place. The Polkadot SDK used to be overarching **three** respositories:

- **Polkadot** - Which for a time, included both the client implementation and runtime, until the
runtime was moved to the Polkadot Fellows organization.
- **Substrate** - The underlying, core primitives and libraries for building blockchains (any
blockchain, not just one for Polkadot). Much of Polkadot is built with Substrate!
- **Cumulus** - A set of libraries and tools which pertain specifically with connecting blockchains
to Polkadot, known as parachains.

> For an in-depth dive into the monorepo, I highly recommend you look into the
> [Polkadot SDK Docs, which explains everything.](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/index.html)

## Deploying on a Core

Once you have your runtime and pallets developed, you will be able to deploy it on a
[core](../learn/learn-agile-coretime.md#core), which is how one utilizes the shared security of the
{{ polkadot: Polkadot :polkadot }}{{ kusama: Kusama :kusama }} network. One does so by:

1. **Reserving** a [`ParaId`](../general/glossary.md#paraid), where you will upload your runtime and
genesis state.
2. **Compiling** the runtime (written in Rust) to a WebAssembly blob, thereby defining how your
state transitions from one state to the next. This runtime is created using the Polkadot SDK. 2a.
**Ensure** your chain spec is viable and ready to be deployed as a live, working parachain.
3. **Generating** your genesis state and wasm.
4. **Obtaining** a core, most likely through a
[Coretime marketplace](../learn/learn-guides-coretime-marketplaces.md).
5. **Assigning** that core to your[ `ParaId`](../general/glossary.md#paraid).
6. **Ensuring** you have at least one honest, synced collator for your task

:::info What is a task?

You might see the term "task" referenced quite a bit, but in most cases, it refers to a process
utilizing Polkadot's compute. This could be a parachain or any other computational process, provided
that it adheres to the Polkadot protocol.

The full definition can be found here.

:::
140 changes: 140 additions & 0 deletions docs/build/build-guides-install-linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
id: build-guides-install-linux
title: Linux
sidebar_label: Linux
description: Install dependencies for Linux
keywords: [coretime, blockspace, parathread, parachain, cores]
slug: ../build-guides-install-linux
---

Rust supports most Linux distributions. Depending on the specific distribution and version of the
operating system you use, you might need to add some software dependencies to your environment. In
general, your development environment should include a linker or C-compatible compiler such as
`clang` and an appropriate integrated development environment (IDE).

## Before you begin

Check the documentation for your operating system for information about the packages that are
installed and how to download and install any additional packages you might need. For example, if
you use Ubuntu, you can use the Ubuntu Advanced Packaging Tool (`apt`) to install the
`build-essential` package:

```bash
sudo apt install build-essential
```

At a minimum, you need the following packages before you install Rust:

```text
clang curl git make
```

Because the blockchain requires standard cryptography to support the generation of public/private
key pairs and the validation of transaction signatures, you must also have a package that provides
cryptography, such as `libssl-dev` or `openssl-devel`.

## Install required packages and Rust

To install the Rust toolchain on Linux:

1. Log on to your computer and open a terminal shell.

2. Check the packages you have installed on the local computer by running an appropriate package
management command for your Linux distribution.

3. Add any package dependencies you are missing to your local development environment by running an
appropriate package management command for your Linux distribution.

For example, on Ubuntu Desktop or Ubuntu Server, you might run a command similar to the
following:

```bash
sudo apt install --assume-yes git clang curl libssl-dev protobuf-compiler
```

Click the tab titles to see examples for other Linux operating systems:

<figure class='tabbed'>

[[tabbedCode]] |```Debian | sudo apt install --assume-yes git clang curl libssl-dev llvm
libudev-dev make protobuf-compiler

[[tabbedCode]] |```Arch | pacman -Syu --needed --noconfirm curl git clang make protobuf

[[tabbedCode]] | ```fedora | sudo dnf update | sudo dnf install clang curl git openssl-devel make
protobuf-compiler

[[tabbedCode]] | ```opensuse | sudo zypper install clang curl git openssl-devel llvm-devel
libudev-devel make protobuf

</figure>

Remember that different distributions might use different package managers and bundle packages in
different ways. For example, depending on your installation selections, Ubuntu Desktop and Ubuntu
Server might have different packages and different requirements. However, the packages listed in
the command-line examples are applicable for many common Linux distributions, including Debian,
Linux Mint, MX Linux, and Elementary OS.

4. Download the `rustup` installation program and use it to install Rust by running the following
command:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

5. Follow the prompts displayed to proceed with a default installation.

6. Update your current shell to include Cargo by running the following command:

```bash
source $HOME/.cargo/env
```

7. Verify your installation by running the following command:

```bash
rustc --version
```

8. Configure the Rust toolchain to default to the latest stable version by running the following
commands:

```bash
rustup default stable
rustup update
```

9. Add the `nightly` release and the `nightly` WebAssembly (wasm) targets to your development
environment by running the following commands:

```bash
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
```

10. Verify the configuration of your development environment by running the following command:

```bash
rustup show
rustup +nightly show
```

The command displays output similar to the following:

```bash
# rustup show

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.62.1 (e092d0b6b 2022-07-16)

# rustup +nightly show

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (overridden by +toolchain on the command line)
rustc 1.65.0-nightly (34a6cae28 2022-08-09)
```
152 changes: 152 additions & 0 deletions docs/build/build-guides-install-macos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
id: build-guides-install-macos
title: macOS
sidebar_label: macOS
description: Install dependencies for macOS
keywords: [coretime, blockspace, parathread, parachain, cores]
slug: ../build-guides-install-macos
---

You can install Rust and set up a Substrate development environment on Apple macOS computers with
either Intel or an Apple M1 processors.

## Before you begin

Before you install Rust and set up your development environment on macOS, verify that your computer
meets the following basic requirements:

- Operating system version is 10.7 Lion, or later.
- Processor speed of at least 2Ghz, 3Ghz recommended.
- Memory of at least 8 GB RAM, 16 GB recommended.
- Storage of at 10 GB available space.
- Broadband Internet connection.

### Support for Apple Silicon

Protobuf must be installed before the build process can begin. To install it, run the following
command:

`brew install protobuf`

### Install Homebrew

In most cases, you should use Homebrew to install and manage packages on macOS computers. If you
don't already have Homebrew installed on your local computer, you should download and install it
before continuing.

To install Homebrew:

1. Open the Terminal application.

2. Download and install Homebrew by running the following command:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```

3. Verify Homebrew has been successfully installed by running the following command:

```bash
brew --version
```

The command displays output similar to the following:

```bash
Homebrew 3.3.1
Homebrew/homebrew-core (git revision c6c488fbc0f; last commit 2021-10-30)
Homebrew/homebrew-cask (git revision 66bab33b26; last commit 2021-10-30)
```

## Installation

Because the blockchain requires standard cryptography to support the generation of public/private
key pairs and the validation of transaction signatures, you must also have a package that provides
cryptography, such as `openssl`.

To install `openssl` and the Rust toolchain on macOS:

1. Open the Terminal application.

2. Ensure you have an updated version of Homebrew by running the following command:

```bash
brew update
```

3. Install the `openssl` package by running the following command:

```bash
brew install openssl
```

4. Download the `rustup` installation program and use it to install Rust by running the following
command:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

5. Follow the prompts displayed to proceed with a default installation.

6. Update your current shell to include Cargo by running the following command:

```bash
source ~/.cargo/env
```

7. Verify your installation by running the following command:

```bash
rustc --version
```

8. Configure the Rust toolchain to default to the latest stable version by running the following
commands:

```bash
rustup default stable
rustup update
rustup target add wasm32-unknown-unknown
```

9. Add the `nightly` release and the `nightly` WebAssembly (wasm) targets to your development
environment by running the following commands:

```bash
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
```

10. Verify the configuration of your development environment by running the following command:

```bash
rustup show
rustup +nightly show
```

The command displays output similar to the following:

```bash
# rustup show

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.61.0 (fe5b13d68 2022-05-18)

# rustup +nightly show

active toolchain
----------------

nightly-x86_64-apple-darwin (overridden by +toolchain on the command line)
rustc 1.63.0-nightly (e71440575 2022-06-02)
```

11. Install `cmake` using the following command:

```
brew install cmake
```
Loading
Loading