diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index adae15b29..01a2b998e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,6 +19,9 @@ jobs: fetch-depth: 0 - name: Publish + env: + ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} + ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} run: | git config --global user.email "w3fdeply@users.noreply.github.com" git config --global user.name "w3fdeploy" diff --git a/docs/AtoZ/launch.md b/docs/AtoZ/launch.md index 112851c8e..6eec50004 100644 --- a/docs/AtoZ/launch.md +++ b/docs/AtoZ/launch.md @@ -22,7 +22,7 @@ The Polkadot network started as a Proof of Authority network, a consensus mechan small number of validators complete control over the network. It was maintained by six validators that Web3 Foundation controlled. With the power of Sudo (a Substrate functionality that allows for a single account to do anything to the chain using root, though a bit technical, you can learn more -about it [here](https://paritytech.github.io/substrate/master/pallet_sudo/index.html) and +about it [here](https://paritytech.github.io/polkadot-sdk/master/pallet_sudo/index.html) and [here](https://www.shawntabrizi.com/substrate/the-sudo-story-in-substrate/)), the Foundation closely nourished the early stages of the network. Users were allowed to claim their DOT tokens and stake them. However, during this phase, users' staking only meant **signaling their intention** to be a diff --git a/docs/Parachain/beginner/assets/collation_occuring.png b/docs/Parachain/beginner/assets/collation_occuring.png new file mode 100644 index 000000000..12d689d50 Binary files /dev/null and b/docs/Parachain/beginner/assets/collation_occuring.png differ diff --git a/docs/Parachain/beginner/assets/developer_sudo.png b/docs/Parachain/beginner/assets/developer_sudo.png new file mode 100644 index 000000000..3ffb2c6b5 Binary files /dev/null and b/docs/Parachain/beginner/assets/developer_sudo.png differ diff --git a/docs/Parachain/beginner/assets/paras_sudo_wrapper.png b/docs/Parachain/beginner/assets/paras_sudo_wrapper.png new file mode 100644 index 000000000..481e43550 Binary files /dev/null and b/docs/Parachain/beginner/assets/paras_sudo_wrapper.png differ diff --git a/docs/Parachain/beginner/assets/register_paraid.png b/docs/Parachain/beginner/assets/register_paraid.png new file mode 100644 index 000000000..a7fc983b6 Binary files /dev/null and b/docs/Parachain/beginner/assets/register_paraid.png differ diff --git a/docs/Parachain/beginner/assets/successful_pvf.png b/docs/Parachain/beginner/assets/successful_pvf.png new file mode 100644 index 000000000..45ca40889 Binary files /dev/null and b/docs/Parachain/beginner/assets/successful_pvf.png differ diff --git a/docs/Parachain/beginner/assets/sudo_schedule.png b/docs/Parachain/beginner/assets/sudo_schedule.png new file mode 100644 index 000000000..90ee10fe7 Binary files /dev/null and b/docs/Parachain/beginner/assets/sudo_schedule.png differ diff --git a/docs/Parachain/beginner/assets/sudo_schedule_filled.png b/docs/Parachain/beginner/assets/sudo_schedule_filled.png new file mode 100644 index 000000000..9bd0c79f7 Binary files /dev/null and b/docs/Parachain/beginner/assets/sudo_schedule_filled.png differ diff --git a/docs/Parachain/beginner/section2/install-binary.md b/docs/Parachain/beginner/section2/install-binary.md index ac698e4bd..3aac17a21 100644 --- a/docs/Parachain/beginner/section2/install-binary.md +++ b/docs/Parachain/beginner/section2/install-binary.md @@ -5,7 +5,7 @@ sidebar_label: Install Local Binaries description: Install the necessary Polkadot binaries onto your local machine. --- -This page will focus on installing the dependencies you need to run a local relay chain. You will: +This page will focus on installing the dependencies you need to run a local relay chain. You will: - Install `polkadot` - Configure a valid chain specification for your relay chain @@ -19,62 +19,63 @@ Before starting, you should have the following already on your system: For more information, view the **General Prerequisites** page. -For the best experience in following this guide, consider also cloning this repository: [`parachain-guide-resources`](https://github.com/CrackTheCode016/parachain-guide-resources) +For the best experience in following this guide, consider also cloning this repository: +[`parachain-guide-resources`](https://github.com/CrackTheCode016/parachain-guide-resources) ## Installing `polkadot` -For this guide, we will ensure a consistent environment by installing Polkadot. This is how we will provision and start our relay chain instance: - +For this guide, we will ensure a consistent environment by installing Polkadot. This is how we will +provision and start our relay chain instance: ### Option 1: Manual Compilation (Recommended) If you are on macOS, below is the current best way to install `polkadot`: 1. Clone the latest, stable branch of Polkadot (1.0.0 at the time of this writing): - - ```bash - git clone --branch release-v1.0.0 https://github.com/paritytech/polkadot.git - ``` + ```bash + git clone --branch release-v1.0.0 https://github.com/paritytech/polkadot.git + ``` 2. Use `cargo` to build the binary - ```bash - cargo build --release - ``` + ```bash + cargo build --release + ``` - :::caution ⌛ This will take some time + :::caution ⌛ This will take some time - Depending on your machine, this may take 45-60 minutes. + Depending on your machine, this may take 45-60 minutes. - ::: + ::: 3. Once compiled, ensure it runs: - ```bash - ./target/release/polkadot --help - ``` + ```bash + ./target/release/polkadot --help + ``` :::tip Create a symlink to easily run your Polkadot binary. -For ease of use, consider adding the target executable to your local path or creating a symlink. There are three binaries that need to be linked if you choose to do this: +For ease of use, consider adding the target executable to your local path or creating a symlink. +There are three binaries that need to be linked if you choose to do this: - `polkadot` - `polkadot-execute-worker` - `polkadot-prepare-worker` - + ```bash # Replace with the path to your cloned polkadot repo -# The last line may need to be replaced! +# The last line may need to be replaced! # Polkadot -ln -s /target/release/polkadot /usr/local/bin/polkadot +ln -s /target/release/polkadot /usr/local/bin/polkadot # Polkadot Prepare Worker -ln -s /target/release/polkadot-prepare-worker /usr/local/bin/polkadot-prepare-worker +ln -s /target/release/polkadot-prepare-worker /usr/local/bin/polkadot-prepare-worker # Polkadot Execute Worker -ln -s /target/release/polkadot-execute-worker /usr/local/bin/polkadot-execute-worker +ln -s /target/release/polkadot-execute-worker /usr/local/bin/polkadot-execute-worker # Use directly in path! @@ -103,26 +104,36 @@ apt install polkadot ## Chain Specification -Once Polkadot is compiled, we must ensure we have a valid `chain_spec` file to launch our local relay chain. +Once Polkadot is compiled, we must ensure we have a valid `chain_spec` file to launch our local +relay chain. -For the purposes of this guide, you can use the one located here with your cloned repository at `relaychain/relaychain_chain_spec.json` and `relaychain/relaychain_chain_spec_raw.json` and. Keep this at hand, as this will be used to run your relay chain. +For the purposes of this guide, you can use the one located here with your cloned repository at +`relaychain/relaychain_chain_spec.json` and `relaychain/relaychain_chain_spec_raw.json` and. Keep +this at hand, as this will be used to run your relay chain. ### Optional: Generating a Custom Chain Specification -It is possible to also generate your own, custom chain specification. This is usually done after changing the `polkadot` source code, as the `code` field within the chain spec would need to be updated. Once you modify the chain spec, you can run the following command to generate it: +It is possible to also generate your own, custom chain specification. This is usually done after +changing the `polkadot` source code, as the `code` field within the chain spec would need to be +updated. Once you modify the chain spec, you can run the following command to generate it: ```bash # Run from locally compiled repository -./polkadot/target/release/polkadot build-spec > /tmp/chain-spec-plain.json +./polkadot/target/release/polkadot build-spec > ./relaychain/relaychain_spec.json # or, with symlink -polkadot build-spec > /tmp/chain-spec-plain.json +polkadot build-spec > ./relaychain/relaychain_spec.json ``` Once this is built, also build the **raw**, SCALE-encoded file: ```bash # Run from locally compiled repository -./polkadot/target/release/polkadot build-spec > /tmp/chain-spec-plain.json +./polkadot/target/release/polkadot build-spec \ + --chain ./relaychain/relaychain_spec.json \ + --raw > ./relaychain/relaychain_spec_raw.json + # or, with symlink -polkadot build-spec > /tmp/chain-spec-plain.json +polkadot build-spec \ + --chain ./relaychain/relaychain_spec.json \ + --raw > ./relaychain/relaychain_spec_raw.json ``` diff --git a/docs/Parachain/beginner/section2/install-template.md b/docs/Parachain/beginner/section2/install-template.md index 437aee505..969196536 100644 --- a/docs/Parachain/beginner/section2/install-template.md +++ b/docs/Parachain/beginner/section2/install-template.md @@ -5,60 +5,67 @@ sidebar_label: Install the Cumulus Parachain Template description: Install the Cumulus Parachain Template --- -With our relay chain ready to be launched, we now need to ensure we have a parachain that meets the aforementioned requirements. +With our relay chain ready to be launched, we now need to ensure we have a parachain that meets the +aforementioned requirements. In this page, you will: - Install and compile the `substrate-parachain-template` - Configure the ParaID & Chain Spec - Generate your parachain's runtime and genesis state (Wasm) -- If you don't wish to customize or go through this process, refer to the `parachain-guide-resources` repository - - +- If you don't wish to customize or go through this process, refer to the + `parachain-guide-resources` repository ## Install the `substrate-parachain-template` -The `substrate-parachain-template` is a Cumulus ready node template. If you have taken the previous Intro to Substrate course, you may have used a similar template. That template was a standalone chain - this template contains the requirements that a parachain needs to fulfill. +The `substrate-parachain-template` is a Cumulus ready node template. If you have taken the previous +[Intro to Substrate course](../../../introsubstrate.md), you may have used a similar template. That +template was a standalone chain - this template contains the requirements that a parachain needs to +fulfill in order to connect to the relay chain and follow the +[Parachains Protocol](https://wiki.polkadot.network/docs/learn-parachains-protocol). 1. Start by cloning the repository with the **same version as the relay chain**: - ```bash - git clone --depth 1 --branch polkadot-v1.0.0 https://github.com/substrate-developer-hub/substrate-parachain-template.git - ``` + ```bash + git clone --depth 1 --branch polkadot-v1.0.0 https://github.com/substrate-developer-hub/substrate-parachain-template.git + ``` 2. Ensure we're on our own branch, and now build - :::caution ⌛ This will take some time + :::caution ⌛ This will take some time - Depending on your machine, this may take 45-60 minutes. + Depending on your machine, this may take 45-60 minutes. - ::: + ::: - ```bash - cd substrate-parachain-template - git switch -c my-branch-v1.0.0 - # Build - cargo build --release - ``` + ```bash + cd substrate-parachain-template + git switch -c my-branch-v1.0.0 + # Build + cargo build --release + ``` -Once your parachain is compiled, the process of altering it (if required) and recompiling will be trivial. +Once your parachain is compiled, the process of altering it (if required) and recompiling will be +trivial. :::tip Create a symlink to easily run your parachain binary. For ease of use, consider adding the target executable to your local path or creating a symlink: - + ```bash # Replace with the path to your cloned substrate-parachain-template repo -# The last line may need to be replaced! -ln -s /target/release/substrate-parachain-template /usr/local/bin/substrate-parachain-template +# The last line may need to be replaced! +ln -s /target/release/parachain-template-node /usr/local/bin/parachain-template-node # Use directly in path! -substrate-parachain-template --help +parachain-template-node --help ``` ::: -:::tip If you don't wish to customize or go through this process, refer to the [`parachain-guide-resources`](https://github.com/CrackTheCode016/parachain-guide-resources) repository +:::tip If you don't wish to customize or go through this process, refer to the +[`parachain-guide-resources`](https://github.com/CrackTheCode016/parachain-guide-resources) +repository The repository has everything required to proceed to running your chains. @@ -66,56 +73,74 @@ The repository has everything required to proceed to running your chains. ## Parachain Chain Specification -Just as the relay chain had a chain spec, the parachain must have one as well. It is generated in the same way: - +Just as the relay chain had a chain spec, the parachain must have one as well. It is generated in +the same way: 1. Firstly, generate the JSON file: - ```bash - # Run from locally compiled repository - ./target/release/substrate-parachain-template build-spec > /tmp/parachain_chain_spec.json - # or, with symlink: - substrate-parachain-template build-spec > /tmp/parachain_chain_spec.json - ``` + ```bash + # Run from locally compiled repository + ./substrate-parachain-template/target/target/release/parachain-template-node build-spec > ./parachain/parachain_chain_spec.json + ``` 2. Once this is built, also build the **raw**, SCALE-encoded file: - ```bash - # Run from locally compiled repository - ./target/release/substrate-parachain-template build-spec > /tmp/parachain_chain_spec.json - # or, with symlink: - substrate-parachain-template build-spec > /tmp/parachain_chain_spec.json - ``` + ```bash + # Run from locally compiled repository + ./substrate-parachain-template/target/release/parachain-template-node build-spec \ + --chain ./parachain/parachain_chain_spec.json \ + --disable-default-bootnode --raw > raw-parachain-chainspec.json + ``` + + If this succeeded, you will see the following output: + ```bash + 2023-09-13 13:25:01 Building chain spec + 2023-09-13 13:25:01 assembling new collators for new session 0 at #0 + 2023-09-13 13:25:01 assembling new collators for new session 1 at #0 + ``` ## Parachain Genesis & Runtime State -If you recall, the runtime of every Substrate-based chain is compiled down to Web Assembly (Wasm). This enables the runtime to be portable and stored on the relay chain, which is used for the purpose of validating state transitions from the parachain's collator. +If you recall, the runtime of every Substrate-based chain is compiled down to Web Assembly (Wasm). +This enables the runtime to be portable and stored on the relay chain, which is used for the purpose +of validating state transitions from the parachain's collator. -The genesis configuration must also be configured, as the relay chain will require it when registering it in the next section. These both depend on the `parachain_chain_spec.json` which we previously generated. +The genesis configuration must also be configured, as the relay chain will require it when +registering it in the next section. These both depend on the `parachain_chain_spec.json` which we +previously generated. -As always, these are already available within +As always, these are already available within the `parachain-guide-resources` repository. ### Optional: Generating The Runtime Wasm Bundle - ```bash - ./substrate-parachain-template/target/target/release/parachain-template-node export-genesis-wasm --chain ./parachain/parachain_chain_spec_raw.json parachain-wasm - # or, with symlink: - parachain-template-node export-genesis-wasm --chain ./parachain/parachain_chain_spec_raw.json parachain-wasm - ``` +```bash +./substrate-parachain-template/target/target/release/parachain-template-node export-genesis-wasm \ +--chain ./parachain/parachain_chain_spec_raw.json ./parachain/parachain-wasm -### Optional: Generating the Genesis Wasm Bundle +# or, with symlink: +parachain-template-node export-genesis-wasm \ +--chain ./parachain/parachain_chain_spec_raw.json parachain-wasm +``` + +### Optional: Generating the Genesis State Bundle - ```bash - ./substrate-parachain-template/target/target/release/parachain-template-node export-genesis-state --chain ./parachain/parachain_chain_spec_raw.json ./parachain/parachain-genesis-state - # or, with symlink: - parachain-template-node export-genesis-state --chain ./parachain/parachain_chain_spec_raw.json ./parachain/parachain-genesis-state - ``` +```bash +./substrate-parachain-template/target/target/release/parachain-template-node export-genesis-state \ +--chain ./parachain/parachain_chain_spec_raw.json ./parachain/parachain-genesis-state + +# or, with symlink: +parachain-template-node export-genesis-state \ +--chain ./parachain/parachain_chain_spec_raw.json ./parachain/parachain-genesis-state +``` -By now, you should have three total files generated and/or available: +By now, you should have three total files generated and/or available under the `parachains/` +directory: - **Parachain Runtime**: `parachain-wasm` - **Genesis State**: `parachain-genesis-state` +- **JSON Chain Spec**: `parachain_chain_spec.json` - **Raw Chain Spec**: `parachain_chain_spec_raw.json` -With these, we are now able to run our relay chain validators, run our parachain collator, and finally register our parachain. +With these, we are now able to run our relay chain validators, run our parachain collator, and +finally register our parachain. diff --git a/docs/Parachain/beginner/section2/running-chains.md b/docs/Parachain/beginner/section2/running-chains.md index c70bb4cbb..e3516da53 100644 --- a/docs/Parachain/beginner/section2/running-chains.md +++ b/docs/Parachain/beginner/section2/running-chains.md @@ -11,41 +11,42 @@ In this final page, we will do the following: - Run **one** parachain collator to supply block data to our relay chain. - Observe the state changing on both chains, and what they mean. -:::note All commands are in the context of the `parachain-guide-resources` repository -::: +:::note All commands are in the context of the `parachain-guide-resources` repository ::: ## Launching the Relay Chain -Our relay chain needs two validators to build blocks. We can use the `alice` and `bob` development presets to launch our testnet validation nodes using the `polkadot` binary: +Our relay chain needs two validators to build blocks. We can use the `alice` and `bob` development +presets to launch our testnet validation nodes using the `polkadot` binary: :::tip Use the `symlink`! -If you followed the steps to add a `symlink`, you may replace the preceded: `./target/release/polkadot` with just: `polkadot` +If you followed the steps to add a `symlink`, you may replace the preceded: +`./target/release/polkadot` with just: `polkadot` ::: -- Launch Alice: - ```bash - ./polkadot/target/release/polkadot \ - --alice \ - --validator \ - --base-path /tmp/relay/alice \ - --chain ./relaychain/relaychain_spec_raw.json \ - --port 30333 \ - --rpc-port 9944 \ - --disable-worker-version-check - ``` +- Launch Alice: + ```bash + ./polkadot/target/release/polkadot \ + --alice \ + --validator \ + --base-path /tmp/relay/alice \ + --chain ./relaychain/relaychain_spec_raw.json \ + --port 30333 \ + --rpc-port 9944 \ + --disable-worker-version-check + ``` - Launch Bob: - ```bash - ./polkadot/target/release/polkadot \ - --bob \ - --validator \ - --base-path /tmp/relay/bob \ - --chain ./relaychain/relaychain_spec_raw.json \ - --port 30334 \ - --rpc-port 9945 \ - --disable-worker-version-check - ``` + ```bash + ./polkadot/target/release/polkadot \ + --bob \ + --validator \ + --base-path /tmp/relay/bob \ + --chain ./relaychain/relaychain_spec_raw.json \ + --port 30334 \ + --rpc-port 9945 \ + --disable-worker-version-check + ``` Once they are both running, you should see output similar to the following (for `bob`): @@ -89,7 +90,8 @@ If Bob and Alice are not syncing, you may run `bob` with this command: ::: -If both nodes are syncing, you should be seeing the block count increase and new consensus sessions being started: +If both nodes are syncing, you should be seeing the block count increase and new consensus sessions +being started: ```bash 2023-08-11 10:58:18 🙌 Starting consensus session on top of parent 0x7389b78dbb3a94bf09aa53802c338131e242b78678f5959f170e4902ccf24422 @@ -106,26 +108,28 @@ Congratulations, your relay chain is up and running! ## Launching the Parachain -With the relay chain actively producing blocks, we now need to launch a **collator** for our parachain: +With the relay chain actively producing blocks, we now need to launch a **collator** for our +parachain: - Launch a collator - ```bash - ./substrate-parachain-template/target/release/parachain-template-node \ - --alice \ - --collator \ - --force-authoring \ - --chain ./parachain/parachain_chain_spec_raw.json \ - --base-path /tmp/parachain/alice \ - --port 40333 \ - --rpc-port 8844 \ - -- \ - --execution wasm \ - --chain ./relaychain/relaychain_spec_raw.json \ - --port 30343 \ - --rpc-port 9977 - ``` - -With the output looking like: + + ```bash + ./substrate-parachain-template/target/release/parachain-template-node \ + --alice \ + --collator \ + --force-authoring \ + --chain ./parachain/parachain_chain_spec_raw.json \ + --base-path /tmp/parachain/alice \ + --port 40333 \ + --rpc-port 8844 \ + -- \ + --execution wasm \ + --chain ./relaychain/relaychain_spec_raw.json \ + --port 30343 \ + --rpc-port 9977 + ``` + +With the output looking like: ```bash 2023-08-11 10:52:44 Parachain Collator Template @@ -145,7 +149,8 @@ CLI parameter `--execution` has no effect anymore and will be removed in the fut 2023-08-11 10:52:48 [Relaychain] 🏷 Local node identity is: 12D3KooWKdqvh5Lzt1p8Rm54QNC1UwWtBabyBPUYtkdAt1SKkYpG ``` -Your parachain should be syncing with the relay chain, and will look similar to the below. Notice the blocks being imported and matching the height of the relay chain: +Your parachain should be syncing with the relay chain, and will look similar to the below. Notice +the blocks being imported and matching the height of the relay chain: ```bash 2023-08-11 11:22:04 [Relaychain] 💤 Idle (2 peers), best: #237 (0x3069…400d), finalized #235 (0xa85b…c64c), ⬇ 48.2kiB/s ⬆ 1.9kiB/s @@ -168,10 +173,12 @@ Your parachain should be syncing with the relay chain, and will look similar to 2023-08-11 11:22:20 [Parachain] 💤 Idle (0 peers), best: #0 (0x2717…55b5), finalized #0 (0x2717…55b5), ⬇ 0 ⬆ 0 ``` -It's possible you may also need to specify a bootnode for the parachain as well. +It's possible you may also need to specify a bootnode for the parachain as well. -Our parachain is not making any blocks; and that is normal, as we still need to register it onto the relay chain. +Our parachain is not making any blocks; and that is normal, as we still need to register it onto the +relay chain. ## Observing State & Verifying Orchestration -The most user-friendly way to verify and validate the state of both the relay chain and parachain is **Polkadot.js**. +The most user-friendly way to verify and validate the state of both the relay chain and parachain is +**Polkadot.js**. diff --git a/docs/Parachain/beginner/section3/creating-auction.md b/docs/Parachain/beginner/section3/creating-auction.md deleted file mode 100644 index 7982c2b52..000000000 --- a/docs/Parachain/beginner/section3/creating-auction.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -id: creating-auction -title: Creating a fast-tracked auction -sidebar_label: Creating a fast-tracked auction -description: Creating and registering your parathread via auction. ---- diff --git a/docs/Parachain/beginner/section3/creating-parathread.md b/docs/Parachain/beginner/section3/creating-parathread.md index fcea62e5e..5147ede83 100644 --- a/docs/Parachain/beginner/section3/creating-parathread.md +++ b/docs/Parachain/beginner/section3/creating-parathread.md @@ -4,3 +4,24 @@ title: Reserve your parathread sidebar_label: Reserve your parathread description: Reserve your parathread and para ID. --- + +Before registering and uploading your parachain's runtime, you must register a `ParaId`. Each parachain has a unique ID on the relay chain. + +:::info Different RPC Ports for the Relay and Parachain + +To connect to Polkadot.js, you will need to use the following URLs: + +- Relay Chain on [Port 9944](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer) +- Parachain Collator on [Port 8844](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8844#/explorer) + +::: + +## Reserving a ParaID + +Navigate to the [Polkadot.js Developer Console](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer), select the "Network" dropdown, and select "Parachains": + +Select the "Parathreads" tab. Per our chain spec, our parachain indicates the ID is `2000`. Luckily, the default starting `ParaId` is 2000, as stated below: + +![](../assets/register_paraid.png) + +Select `Alice` as per above, and send the extrinsic. Your parachain can now be registered using that `ParaId` once the extrinsic is confirmed. \ No newline at end of file diff --git a/docs/Parachain/beginner/section3/developing-parachain.md b/docs/Parachain/beginner/section3/developing-parachain.md index b33f55865..b4b2be4f1 100644 --- a/docs/Parachain/beginner/section3/developing-parachain.md +++ b/docs/Parachain/beginner/section3/developing-parachain.md @@ -4,3 +4,21 @@ title: Developing your parachain with FRAME sidebar_label: Developing your parachain with FRAME description: Configure and customize your parachain before registering it on the relay chain. --- + +Congratulations, you have successfully registered a parachain to your local relay chain! + +Now, you have a couple of options: + +1. Modify your existing parachain and upgrade its runtime. +2. Add more parachains with domain-specific functionality. +3. Change the relay chain's core configuration and functionality. + +Both options will require changes to the code base(s), and for the binaries to be re-compiled. In the case of the parachain, the parachain must be upgraded to utilize the new runtime. + +## How to approach customizing your parachain + +As the parachain template provided is mostly a Substrate node that uses FRAME, one can add or develop new pallets for their runtime. For an example of developing a pallet from scratch, check out our [Intro to Substrate course](../../../introsubstrate.md). + +## Register a second, custom parachain + +Another, more advanced option would be to provision another parachain. It would follow the same process as described, only you could challenge yourself by adding an XCM config to enable cross-consensus messaging within your network. Another option would be to configure it as a system parachain, which is a parachain that fulfills a specific role and uses the relay chain as a form of economic security. \ No newline at end of file diff --git a/docs/Parachain/beginner/section3/index.md b/docs/Parachain/beginner/section3/index.md index 76d917727..b06f16ba6 100644 --- a/docs/Parachain/beginner/section3/index.md +++ b/docs/Parachain/beginner/section3/index.md @@ -2,6 +2,13 @@ title: Creating & Registering Parachain --- +In this section, we will take the last steps in allowing our parachain to begin syncing with the relay chain. + +- You need the setup from the [last section running](../section2/running-chains.md), so be sure your relay and parachain are running! +- We will register a ParaID for our parachain. +- We will use `sudo` to register our parachain, allowing it to sync with the relay chain. +- Learn the primary or next steps to customizing your parachain's source code. + import DocCardList from '@theme/DocCardList'; diff --git a/docs/Parachain/beginner/section3/sudo-register.md b/docs/Parachain/beginner/section3/sudo-register.md new file mode 100644 index 000000000..1a5dba550 --- /dev/null +++ b/docs/Parachain/beginner/section3/sudo-register.md @@ -0,0 +1,64 @@ +--- +id: sudo-register +title: Using Sudo to register your parachain +sidebar_label: Using Sudo to register your parachain +description: Creating and registering your parathread via sudo. +--- + +Typically, a parachain slot auction would have to take place to achieve a connection with the relay chain. These auctions can take some time - usually one week, with multiple parachains competing for a slot in the relay chain. + +One possibility is to modify our relay chain's code to lower auction times. However, this still is unideal for development purposes. + +A significant side effect of running our local relay chain includes bypassing that process via our type of governance - `sudo`. + +## A Brief Introduction to the Sudo Pallet + +The [`sudo`](https://paritytech.github.io/polkadot-sdk/master/pallet_sudo/index.html) pallet executes calls that require `Root` origin with any keys that are declared as "sudo". In most development environments, `Alice` is one of these keys. Adding more keys if needed via the `set_key` extrinsic is also possible. + +It primarily acts as a wrapper for other calls. It is not meant to be used in pallets directly but rather merely execute privileged calls that require the `Root` origin. + +## Using Sudo as Governance in Polkadot.js + +Using the `sudo` pallet, we can bypass the auction process and register the parachain directly. + +:::caution Make sure your collator is running! + +To register our parachain, we need both our relay chain creating blocks and our parachain's collator running. + +::: + +Navigate to the [Polkadot.js Developer Console](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer), and select the `Sudo` tab: + + +Once here, select the `parasSudoWrapper` in the dropdown: + +![](../assets/paras_sudo_wrapper.png) + +Upload the genesis (`parachain-genesis-state`) and runtime (`parachain-wasm`) from the `parachain-guide-resources` repository: + +![](../assets/sudo_schedule_filled.png) + +In the "Events" tab in the explorer, you should see two events - `sudo.Sudid` and `paras.PvfCheckAccepted`. These should indicate that the parachain's runtime has been successfully registered, and the collator will start syncing with the relay chain. + +![](../assets/successful_pvf.png) + +## Ensuring Collation + +Your collator should have output similar to the following: + +```sh +2023-09-13 13:03:48 [Parachain] 🙌 Starting consensus session on top of parent 0x8d239901c4ee0eca7b10f97744bd2812e2682cd92a3e15c254931fb631af6289 +2023-09-13 13:03:48 [Parachain] 🎁 Prepared block for proposing at 198 (1 ms) [hash: 0xd5ab5c88bbc45c00500059d001303961fc43c2821f21c9939b44be5ec983dfb9; parent_hash: 0x8d23…6289; extrinsics (2): [0xc24e…cf43, 0xc8c9…86a5] +2023-09-13 13:03:48 [Parachain] 🔖 Pre-sealed block for proposal at 198. Hash now 0x17eb48b6a0cca5cabfa3651961732b4095fa9a7edc77066ba310d3243342fba2, previously 0xd5ab5c88bbc45c00500059d001303961fc43c2821f21c9939b44be5ec983dfb9. +2023-09-13 13:03:48 [Parachain] ✨ Imported #198 (0x17eb…fba2) +2023-09-13 13:03:48 [Parachain] PoV size { header: 0.21875kb, extrinsics: 3.1298828125kb, storage_proof: 3.2939453125kb } +2023-09-13 13:03:48 [Parachain] Compressed PoV size: 6.048828125kb +2023-09-13 13:03:48 [Parachain] Produced proof-of-validity candidate. block_hash=0x17eb48b6a0cca5cabfa3651961732b4095fa9a7edc77066ba310d3243342fba2 +``` + +In Polkadot.js, you should also see block production occurring on both the relay and parachain: + +![](../assets/collation_occuring.png) + +If not, you may have forgotten to specify a bootnode. You may restart your collator and specify a relay chain validator using the `--bootnodes` flag. + diff --git a/docs/Rust/section3/borrowing.md b/docs/Rust/section3/borrowing.md index 8e1aa8892..f65c559cf 100644 --- a/docs/Rust/section3/borrowing.md +++ b/docs/Rust/section3/borrowing.md @@ -12,6 +12,8 @@ compile time). While ownership does ensure that all memory will be allocated appropriately/deallocated, it does introduce some complexity that references and borrowing solve. + + ## Problem: Heap-stored Values Data types that aren't fixed size and have the potential to grow in size during runtime are stored diff --git a/docs/Rust/section3/ownership.md b/docs/Rust/section3/ownership.md index 3ad893802..c7e05f429 100644 --- a/docs/Rust/section3/ownership.md +++ b/docs/Rust/section3/ownership.md @@ -13,6 +13,8 @@ does not affect performance - as ownership checks happen at compile time. While these rules may seem prohibitive, they sometimes ensure entirely memory-safe code. + + :::note If you aren't familiar with the stack and heap, make sure you diff --git a/docs/Rust/section3/slices.md b/docs/Rust/section3/slices.md index b31d2edef..2f3c72cc1 100644 --- a/docs/Rust/section3/slices.md +++ b/docs/Rust/section3/slices.md @@ -12,6 +12,8 @@ Instead of handling an entire collection, which could be costly performance-wise to handle a _reference_ to those items. These slices can be modified in place or returned as immutable as part of a function. + + ## String slices Working with string and byte slices is one of the most common tasks when working with Rust, diff --git a/docs/Rust/section4/enums.md b/docs/Rust/section4/enums.md index e2ad3a4f1..39b5c7e5e 100644 --- a/docs/Rust/section4/enums.md +++ b/docs/Rust/section4/enums.md @@ -8,6 +8,8 @@ description: Learn what enums are and how to use them in Rust. Enumerations, or **enums** are data structures that allow for a list of pre-defined options in Rust. They are useful for pattern matching, defining expected conditions, errors, and more. + + An example of enums in use would be defining different types of animal classes. An enum's values are called _variants_: diff --git a/docs/Rust/section4/error-handling.md b/docs/Rust/section4/error-handling.md index 507f263d6..83c17cc17 100644 --- a/docs/Rust/section4/error-handling.md +++ b/docs/Rust/section4/error-handling.md @@ -12,6 +12,8 @@ necessary. Rust includes two commonly used _enums_ that help ensure data is vali Both types ensure invalid data and errors are handled adequately and do not cause the program to panic. + + ## Using Option Option is an enum that contains two variants - `None` and `Some`: diff --git a/docs/Rust/section4/panic.md b/docs/Rust/section4/panic.md index 97c022db0..370d4927d 100644 --- a/docs/Rust/section4/panic.md +++ b/docs/Rust/section4/panic.md @@ -29,6 +29,8 @@ thread 'main' panicked at 'explicit panic', src/main.rs:3:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` + + There are a few methods that could cause a panic, namely within using `Result`. Methods such as `unwrap()` and `expect()` can cause a panic if the `Result` is `None`, as the error is not being handled. As a result, the program simply panics and closes to prevent any further unwanted behavior. diff --git a/docs/Rust/section5/collections.md b/docs/Rust/section5/collections.md index 9a578136e..63d3410fd 100644 --- a/docs/Rust/section5/collections.md +++ b/docs/Rust/section5/collections.md @@ -19,6 +19,8 @@ There are three commonly used collections in Rust: - Hashmaps - key-value data structures that store a **map** of information. - Strings - a collection of characters that are stored on the heap. + + ## Vectors The official type declaration of a vector is `Vec`, which represents a list of any generic type diff --git a/docs/Rust/section5/struct-methods.md b/docs/Rust/section5/struct-methods.md index 25af25c07..d9a389c5b 100644 --- a/docs/Rust/section5/struct-methods.md +++ b/docs/Rust/section5/struct-methods.md @@ -9,6 +9,8 @@ description: Learn how to define methods for structs in Rust. applied to structs. They breathe life into structs by providing associated logic that often utilizes its inner fields and represents an instance of that struct. + + The syntax is nearly identical to a function, with the exception that its part of the **implementation** of the struct: diff --git a/docs/Rust/section5/structs.md b/docs/Rust/section5/structs.md index 9ba7e93ee..a217ee9eb 100644 --- a/docs/Rust/section5/structs.md +++ b/docs/Rust/section5/structs.md @@ -10,6 +10,8 @@ data type. It's similar to tuples in concept but provides several ways to expand struct behavior. Structs, like any other type, abide by Rust's strict typing system and allow for a plethora of expansion when it comes to programming in Rust. + + ## Creating Structs The `struct` keyword is used to instantiate struct, followed by the name, then a series of fields diff --git a/docs/Rust/section5/vectors-vs-strings.md b/docs/Rust/section5/vectors-vs-strings.md index e1417f62f..a20072985 100644 --- a/docs/Rust/section5/vectors-vs-strings.md +++ b/docs/Rust/section5/vectors-vs-strings.md @@ -20,6 +20,8 @@ To summarize: - A `Vec` is a data structure that is more generic in nature, as it allows for _any_ data type to be passed in to form a managed list. + + ## When to use a string slice versus a String? Remember, slices are **"view-only", immutable references**. `String` should be used when you require diff --git a/docs/Rust/section6/associated-generics.md b/docs/Rust/section6/associated-generics.md index 681699ed1..2e2775021 100644 --- a/docs/Rust/section6/associated-generics.md +++ b/docs/Rust/section6/associated-generics.md @@ -7,6 +7,8 @@ description: Learn the difference between associated types vs generic types. Associated types are an abstract way to define a name for what a type should be. + + In the [Generics](./generics.md) section, we encountered an associated type when we defined the `Mul` trait as a bound: diff --git a/docs/Rust/section6/generics.md b/docs/Rust/section6/generics.md index 8c319c6ae..45ff9b8ff 100644 --- a/docs/Rust/section6/generics.md +++ b/docs/Rust/section6/generics.md @@ -12,6 +12,8 @@ define a set of expectations while still being abstract and generic. Generics can be used in traits, methods, functions, enums, and structs. + + ## Scenario: Why Generic Code is Useful Let's assume that I wish to have a simple function that is meant to square two numbers, as we've diff --git a/docs/Rust/section6/lifetimes.md b/docs/Rust/section6/lifetimes.md index c070a249d..af09fdeff 100644 --- a/docs/Rust/section6/lifetimes.md +++ b/docs/Rust/section6/lifetimes.md @@ -9,6 +9,8 @@ If you recall, in the Ownership section of this course, a value in Rust is only scope. Once it is out of scope, it is out of memory and disregarded. This concept is called a **lifetime**. Every reference in Rust has a **lifetime**, although they are mostly inferred. + + ## When to Declare Explicit Lifetimes Lifetimes are also generic, and are used to **validate** references. In essence, the lifetime is diff --git a/docs/Rust/section6/traits.md b/docs/Rust/section6/traits.md index 1149cef66..685e760ed 100644 --- a/docs/Rust/section6/traits.md +++ b/docs/Rust/section6/traits.md @@ -9,6 +9,8 @@ There is no genuine concept of object-oriented-style inheritance in Rust. **Trai notion of defining shared behavior for data structures. A trait defines a set of shared functions, expectations, and behavior that can be used for an indefinite number of types. + + ## Creating a Trait Defining a trait utilizes the `trait` keyword, followed by the name of the trait. In this example, diff --git a/docs/Rust/section7/closures.md b/docs/Rust/section7/closures.md index f11804e24..5476fcff8 100644 --- a/docs/Rust/section7/closures.md +++ b/docs/Rust/section7/closures.md @@ -9,6 +9,8 @@ Closures are one of Rust's functional programming-esque features that can create functions**. Closures, like functions, execute blocks of logic within. They are fundamentally different in how they operate and handle ownership. + + They may even be used as a return type, as shown in examples such as `unwrap_or_else()`: ```rust diff --git a/docs/Rust/section7/iterators.md b/docs/Rust/section7/iterators.md index 4e0fa5bd6..38d1473e2 100644 --- a/docs/Rust/section7/iterators.md +++ b/docs/Rust/section7/iterators.md @@ -9,6 +9,8 @@ Iterators in Rust allow you to perform tasks sequentially on a series of items w of the sequence. `Iterator` is a trait that, once implemented, handles many of the nuances of safely looping through collections. Iterators are **lazy**, meaning they are only used when called upon. + + ## Creating an Iterator Most collections we discussed earlier have the `Iterator` trait already implemented. The most common diff --git a/docs/Rust/section7/macros.md b/docs/Rust/section7/macros.md index 566dd009d..4a474a9b4 100644 --- a/docs/Rust/section7/macros.md +++ b/docs/Rust/section7/macros.md @@ -9,6 +9,9 @@ Macros in Rust is, in the most basic sense, "code that writes code", also known _metaprogramming_. By now, you have seen the `println!()` macro many times, and it illustrates how useful macros may be in everyday coding. + + + Another prime example that you have seen is the use of the `#[derive]` macro, which can implement traits on types automatically: diff --git a/docs/Rust/section8/defining-cargo-config.md b/docs/Rust/section8/defining-cargo-config.md index ab28a6e3e..bee3daf09 100644 --- a/docs/Rust/section8/defining-cargo-config.md +++ b/docs/Rust/section8/defining-cargo-config.md @@ -8,6 +8,8 @@ description: Understand how to utilize cargo. If Rust is installed on your system, then `cargo` by default is installed. `cargo` is Rust's package management system and can be called from the command line. + + ## Creating a new project with Cargo Create a new project using `cargo` using the `cargo new` command. You will need to have your command diff --git a/docs/Rust/section8/defining-crate-features.md b/docs/Rust/section8/defining-crate-features.md index d209ab518..2216acdb5 100644 --- a/docs/Rust/section8/defining-crate-features.md +++ b/docs/Rust/section8/defining-crate-features.md @@ -16,6 +16,8 @@ There are also other cases where `std` may not be available. For this reason, so option of a `no-std` implementation which does not use the Rust Standard Library and can run in these resource-constrained environments. + + ## Specifying features A **feature** in the context of Rust crates refers to the ability to conditionally/optionally diff --git a/docs/Rust/section8/installing-crate.md b/docs/Rust/section8/installing-crate.md index 2ace10d44..9df0943bf 100644 --- a/docs/Rust/section8/installing-crate.md +++ b/docs/Rust/section8/installing-crate.md @@ -10,6 +10,8 @@ run it. This section will focus on the `[dependencies]` section of your `Cargo.t bring in external crates for usage within your project. Crates are other Rust packages with publicly exposed types and functionality for usage in `Cargo` projects. + + ## Adding a new crate Two primary methods of declaring an external crate in Rust are directly putting it in `Cargo.toml` diff --git a/docs/Rust/section8/unit-tests.md b/docs/Rust/section8/unit-tests.md index 14e56ed81..af33c2bbd 100644 --- a/docs/Rust/section8/unit-tests.md +++ b/docs/Rust/section8/unit-tests.md @@ -12,6 +12,8 @@ structure a basic testing structure for your Cargo project. Be sure to open your project, `first-cargo`, as that is the repo we will be testing. + + ## Putting tests below the main function Tests are defined using the `#[test]` macro and are usually either in their separate directory on diff --git a/docs/Substrate/section1/capstone.md b/docs/Substrate/section1/capstone.md index c6b9ba9bd..a8466b755 100644 --- a/docs/Substrate/section1/capstone.md +++ b/docs/Substrate/section1/capstone.md @@ -9,7 +9,7 @@ The purpose of this capstone project is to bring something both engaging and inf student. You, the student, should be able to build a Substrate pallet in the Substrate Node Template, run it, and modify and view its state in real time. -An honorable mention and inspiration behind this project are +An honorable mention and inspiration behind this project is [Substrate Kitties](https://www.shawntabrizi.com/substrate-collectables-workshop/) by Shawn Tabrizi. ## Required Functionality - What You Will Build @@ -29,7 +29,7 @@ The following will be created as a result of this project: 1. A runtime pallet, which the student can publish and modify as they will. 2. An instance of the node template with this pallet integrated. -3. A simple front end to display all profiles on a network. +3. A simple front end to display all profiles on a network. (optional) ## Student Objectives @@ -53,7 +53,7 @@ The following Substrate topics and nuances will be covered as a result of this p discussed. - Going over the Rust language for each pallet concept. - Creating any storage mappings or associations for storing data in the chain -- Learn how to utilize BoundedVec and the importance of bounded data in general in blockchain +- Learn how to utilize `BoundedVec` and the importance of bounded data in general in blockchain development. - Learning safe math via the Like or Dislike mechanism to prevent integer overflows. Explain the importance of safe math in the runtime. diff --git a/docs/Substrate/section1/substrate-design.md b/docs/Substrate/section1/substrate-design.md index 3d98e37b7..0074b7c04 100644 --- a/docs/Substrate/section1/substrate-design.md +++ b/docs/Substrate/section1/substrate-design.md @@ -15,8 +15,8 @@ adaptable comes from its heavy use of ## What is a generic code base? At a basic level, a generic code base represents a way to define very reusable code. The Substrate -libraries use this design pattern to optionally leave some of the definitions of primitives up to -the developer. +libraries use this design pattern to optionally leave some definitions of primitives up to the +developer. Blockchains often have standard 'primitives': Polkadot, Bitcoin, or Ethereum all have concepts and primitives that are commonplace, i.e., transactions, blocks, storage, and hashing algorithms. diff --git a/docs/Substrate/section1/substrate-history.md b/docs/Substrate/section1/substrate-history.md index 2fc3c34fb..bf11165d6 100644 --- a/docs/Substrate/section1/substrate-history.md +++ b/docs/Substrate/section1/substrate-history.md @@ -15,3 +15,9 @@ that uses Substrate libraries and FRAME. Substrate is a blockchain developer fra the creation of solo chains or parachains. Initially, much of what was Substrate came from Polkadot due to necessity. The reasoning behind this choice was if parachains were to be built, it would be sensible to make all standard blockchain protocols and primitives available to parachain developers. + +## The Polkadot SDK + +As of August 25th, 2023, Substrate, Polkadot, and Cumulus were merged under a +[single monorepo](https://github.com/paritytech/polkadot-sdk) after being in three separate +repositories. diff --git a/docs/Substrate/section1/what-is-substrate.md b/docs/Substrate/section1/what-is-substrate.md index 07ec7119f..c2c1ee2f1 100644 --- a/docs/Substrate/section1/what-is-substrate.md +++ b/docs/Substrate/section1/what-is-substrate.md @@ -5,22 +5,36 @@ sidebar_label: What is Substrate and FRAME? description: Learn what Substrate it is, and why it's the future of building infrastructure in web3. --- -Substrate is a modular framework that enables you to create domain-specific blockchains by composing -custom or pre-built components. The _Framework for Runtime Aggregation of Modularized Entities -(**FRAME**)_ is a set of modules and support libraries that simplify runtime development. In -Substrate, these modules are called **pallets**, each hosting domain-specific logic to include in a -chain's runtime. +[Substrate](https://paritytech.github.io/substrate/master/substrate/index.html) is a modular +framework that enables you to create domain-specific blockchains by composing custom or pre-built +components. It is part of the [Polkadot SDK](https://github.com/paritytech/polkadot-sdk), and is +responsible for providing the tools needed to build blockchain **runtimes**. + + + +:::info Substrate is part of the Polkadot SDK (monorepo) + +As of August, 2023, the **Polkadot**, **Substrate**, and **Cumulus** codebases were merged into one +monorepo. Now referred to as the [**Polkadot SDK**](https://github.com/paritytech/polkadot-sdk), +this monorepo represents all the primary tools needed to build blockchains using Substrate. + +::: + +The _Framework for Runtime Aggregation of Modularized Entities (**FRAME**)_ is a set of modules and +support libraries that simplify runtime development within Substrate. In Substrate, these modules +are called **pallets**, each hosting domain-specific logic to include in a chain's runtime. Substrate may be utilized to create a solo chain or a parachain for a relay chain like Polkadot or -Kusama. At its core, it is a set of Rust crates that provide the most basic primitives and protocols -to implement a distributed state machine, such as a blockchain. +Kusama. At its core, it is a set of Rust libraries that provide the most basic primitives and +protocols to implement a distributed, peer-to-peer state machine, such as a blockchain. :::info An analogy: React, the library for web and native user interfaces -Another way to think about Substrate is similar to how a web developer may use/think about React. -Where React provides core libraries for manipulating the elements of the DOM via developer-defined -components, Substrate also provides the base libraries and primitives needed to create a blockchain. -It was designed to not be opinionated via a highly generic codebase, enabling high customizability. +Another way to think about Substrate is similar to how a web developer may use/think about +**React**. Where React provides core libraries for manipulating the elements of the DOM via +developer-defined components, Substrate also provides the base libraries and primitives needed to +create a blockchain. It was designed to not be opinionated via a highly generic codebase, enabling +high customizability. ::: @@ -38,14 +52,22 @@ runtime-related primitives. A few significant crates that you will encounter are: -- [`sp_runtime`](https://crates.parity.io/sp_runtime/index.html) - Runtime modules shared primitive - types -- [`sp_core`](https://crates.parity.io/sp_core/index.html) - Shareable Substrate types -- [`sp_io`](https://crates.parity.io/sp_io/index.html) - I/O host interface for substrate runtime. - Substrate runtime standard library as compiled when linked with Rust’s standard library. - -These, along with many more, all pertain to building certain aspects of a particular distributed -system. +- [`sp_runtime`](https://paritytech.github.io/substrate/master/sp_runtime/index.html) - Runtime + modules shared primitive types +- [`sp_core`](https://paritytech.github.io/substrate/master/sp_core/index.html) - Shareable + Substrate types +- [`sp_io`](https://paritytech.github.io/substrate/master/sp_io/index.html) - I/O host interface for + substrate runtime. Substrate runtime standard library as compiled when linked with Rust’s standard + library. + +These, along with many more, all pertain to building certain aspects of distributed systems, +including but not limited to: + +- Consensus mechanisms +- Peer-to-peer networking +- Fork-choice rules +- Block authoring +- State management ## A Brief Introduction to FRAME (Framework for Runtime Aggregation of Modularized Entities) diff --git a/docs/Substrate/section2/substrate-pallets.md b/docs/Substrate/section2/substrate-pallets.md index ded485e78..608ae9822 100644 --- a/docs/Substrate/section2/substrate-pallets.md +++ b/docs/Substrate/section2/substrate-pallets.md @@ -34,7 +34,7 @@ a few standard pallets that you might often encounter as a developer: [OpenGov - the next generation of decentralized on-chain governance](https://wiki.polkadot.network/docs/learn-polkadot-opengov). To view all pallets included with FRAME, look at the -[repository on GitHub](https://github.com/paritytech/substrate/tree/master/frame). +[repository on GitHub](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame). ## Our Pallet: pallet_connect diff --git a/docs/Substrate/section8/origins-calls.md b/docs/Substrate/section8/origins-calls.md index e16231a75..cdc028eb7 100644 --- a/docs/Substrate/section8/origins-calls.md +++ b/docs/Substrate/section8/origins-calls.md @@ -39,6 +39,6 @@ Custom origins allow a developer to define a stringent set of requirements for w contain to be valid for that specific use case. For example, the `pallet_collectives` defines custom origins that represent a -[`Member(AccountId)`](https://github.com/paritytech/substrate/blob/master/frame/collective/src/lib.rs#L139) +[`Member(AccountId)`](https://github.com/paritytech/polkadot-sdk/blob/2c8021f998a4b3f3e9c0416c7886ef05803aba9d/substrate/frame/collective/src/lib.rs#L141) of a particular collective. In the pallet's context, a call containing this origin would imply that a member of that collective condoned that action. diff --git a/docs/Substrate/section8/pallet-coupling.md b/docs/Substrate/section8/pallet-coupling.md index 3529b04d3..cc1dd9e65 100644 --- a/docs/Substrate/section8/pallet-coupling.md +++ b/docs/Substrate/section8/pallet-coupling.md @@ -40,8 +40,9 @@ pub trait Config: frame_system::Config { **Tight** coupling a pallet involves explicitly declaring an entire, **specific** pallet as a dependency. This would also mean that this pallet has to be within your pallet's `Cargo.toml` file, precisely just that specific pallet's instance. An example of this is the Bounties pallet, which -tightly couples the [Treasury](https://github.com/paritytech/substrate/tree/master/frame/treasury) -pallet to it: +tightly couples the +[Treasury](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/treasury) pallet +to it: ```rust /// Notice the use of the '+' operator to tightly couple the Config of pallet_treasury @@ -50,9 +51,10 @@ pub trait Config: frame_system::Config + pallet_treasury::Confi Tightly coupling two pallets in this manner is helpful when they share very similar goals and objectives and for pallets that are simple enough. Because the -[Bounties](https://github.com/paritytech/substrate/tree/master/frame/bounties) pallet solely depends -on the [Treasury](https://github.com/paritytech/substrate/tree/master/frame/treasury) pallet for -payouts (and its subsequent types), it is sensible to couple it tightly. +[Bounties](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/bounties) pallet +solely depends on the +[Treasury](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/treasury) pallet +for payouts (and its subsequent types), it is sensible to couple it tightly. ## Which to use? diff --git a/docs/introsubstrate.md b/docs/introsubstrate.md index 7d45acb3b..fad63e458 100644 --- a/docs/introsubstrate.md +++ b/docs/introsubstrate.md @@ -3,7 +3,7 @@ id: introsubstrate sidebar_position: 1 --- -# Introduction to Substrate & FRAME +# Introduction to Polkadot SDK - Substrate & FRAME Developed by the Technical Education team at the Web3 Foundation, this course provides a comprehensive overview of the Substrate blockchain framework and building blockchains. diff --git a/docusaurus.config.js b/docusaurus.config.js index 56b8673a7..69fb60268 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -23,12 +23,30 @@ module.exports = { additionalLanguages: ["rust"], theme: require("prism-react-renderer/themes/dracula"), }, - mermaid: { - theme: { light: "neutral", dark: "neutral" }, + algolia: { + appId: process.env.ALGOLIA_APP_ID, + apiKey: process.env.ALGOLIA_API_KEY, + indexName: "education-web3", + contextualSearch: true, }, + mermaid: { + theme: { light: 'base', dark: 'base' }, + options: { + themeVariables: { + fontFamily: 'Unbounded', + primaryColor: '#E6007A', + primaryBorderColor: '#E6007A', + lineColor: '#140523', + secondaryColor: '#552BBF', + tertiaryColor: '#fff', + titleColor: '#000', + nodeTextColor: '#fff' + } + }, + }, colorMode: { defaultMode: "light", - disableSwitch: true, + disableSwitch: false, }, navbar: { title: "Technical Education", diff --git a/package.json b/package.json index ce299d202..c8c4e5b78 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@docusaurus/core": "^2.4.1", "@docusaurus/preset-classic": "^2.4.1", "@docusaurus/theme-mermaid": "^2.4.1", + "@docusaurus/theme-search-algolia": "^2.4.1", "@mdx-js/react": "^1.6.21", "@svgr/webpack": "^5.5.0", "clsx": "^1.1.1", diff --git a/sidebars.js b/sidebars.js index 8ef6a30f7..ba3a196ee 100644 --- a/sidebars.js +++ b/sidebars.js @@ -402,9 +402,9 @@ module.exports = { label: "Creating & Registering Parachain", link: { type: "doc", id: "Parachain/beginner/section3/index" }, items: [ - "Parachain/beginner/section3/creating-auction", - "Parachain/beginner/section3/creating-parathread", - "Parachain/beginner/section3/developing-parachain", + 'Parachain/beginner/section3/creating-parathread', + 'Parachain/beginner/section3/sudo-register', + 'Parachain/beginner/section3/developing-parachain', ], }, { diff --git a/src/components/HomepageFeatures/index.tsx b/src/components/HomepageFeatures/index.tsx index e654f3aa5..110c6cfd4 100644 --- a/src/components/HomepageFeatures/index.tsx +++ b/src/components/HomepageFeatures/index.tsx @@ -3,10 +3,10 @@ import clsx from "clsx"; import styles from "./styles.module.css"; import useBaseUrl from "@docusaurus/useBaseUrl"; -const FeatureList = [ +const MainFeatureList = [ { image: "/img/courses.webp", - title: "Blockchain and Web3 Courses", + title: "edX Blockchain and Web3 Courses", link: "https://www.edx.org/school/web3x", }, { @@ -16,11 +16,29 @@ const FeatureList = [ }, { image: "/img/tutorials.webp", - title: "Our Tutorials", + title: "Technical Explainers", link: "https://www.youtube.com/playlist?list=PLOyWqupZ-WGuAuS00rK-pebTMAOxW41W8", }, ]; +const CoursesFeatureList = [ + { + image: "/img/tutorials.webp", + title: "Polkadot-SDK & FRAME Development Course", + link: "/docs/introsubstrate", + }, + { + image: "/img/tutorials.webp", + title: "Introduction to Rust in Substrate", + link: "/docs/introrust", + }, + { + image: "/img/tutorials.webp", + title: "Introduction to Parachain Development", + link: "/docs/introparachain", + }, +]; + function Feature({ image, title, link }) { return (
window.open(link, "_self")} className={clsx("col col--4 feature-item")}> @@ -47,9 +65,20 @@ export default function HomepageFeatures() { return (
-

Overview

+

Overview - Learn Polkadot

+
+
+ {MainFeatureList.map((props, idx) => ( + + ))} +
+
+ +
+

Overview - Learn Core Development

+
- {FeatureList.map((props, idx) => ( + {CoursesFeatureList.map((props, idx) => ( ))}
diff --git a/src/components/HomepageFeatures/styles.module.css b/src/components/HomepageFeatures/styles.module.css index 52f88111c..1f82354a5 100644 --- a/src/components/HomepageFeatures/styles.module.css +++ b/src/components/HomepageFeatures/styles.module.css @@ -1,12 +1,26 @@ .features { display: flex; + flex-direction: column; align-items: center; padding: 2rem 0; width: 100%; - background-color: var(--ifm-color-secondary); + /* background-color: var(--ifm-color-secondary); */ +} + +html[data-theme="dark"] .features { + color: #fff; +} + +.col.col--4.feature-item { + background-color: #000; } .featureSvg { height: 200px; width: 200px; } + +hr { + width: 15%; + height: 5px; +} \ No newline at end of file diff --git a/src/css/custom.css b/src/css/custom.css index d809e5a4c..f4cf99a80 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -6,7 +6,7 @@ */ /* You can override the default Infima variables here. */ -:root { +/* :root { --ifm-color-primary: #000000; --ifm-color-primary-dark: rgb(33, 175, 144); --ifm-color-primary-darker: rgb(31, 165, 136); @@ -19,7 +19,7 @@ --ifm-color-black: #fff; --ifm-code-font-size: 95%; font-family: SuisseIntl, sans-serif; -} +} */ .hero__title { font-size: 4rem; @@ -55,10 +55,15 @@ html[data-theme="dark"] .docusaurus-highlight-code-line { } .hero--primary { - --ifm-hero-background-color: #fff; + --ifm-hero-background-color: #f9f9f9; --ifm-hero-text-color: #000; } +html[data-theme="dark"] .hero--primary { + --ifm-hero-background-color: #1d1d1d; + --ifm-hero-text-color: #fff; +} + .footer--dark { --ifm-footer-background-color: #000; background-image: url("https://web3.foundation/static/fa2e2556a97b02fb8186cceaa6999d78/24754/research-large.avif"); @@ -114,7 +119,6 @@ a:hover.navbar__item { /* Feature items*/ .col.col--4.feature-item { - background-color: white; padding: 0; margin: 1.5em; max-width: 28%; @@ -157,6 +161,10 @@ a:hover.navbar__item { transition: transform 0.2s ease-in-out; } +html[data-theme="dark"] .feature-link-arrow { + filter: invert(1); +} + .feature-item:hover .feature-link-arrow { transform: translateX(+50%); } @@ -278,4 +286,21 @@ a:hover.navbar__item { .docusaurus-mermaid-container { text-align: center; margin: 20px; + background-color: #fff; + fill: #000; +} + +.edgeLabel { + display: block; + border-radius: 4px; + padding-left: 4px; + word-wrap: break-word; +} + +.markdown a { + color: #38aa69; +} + +.markdown a:hover { + color: #4eeb92; } diff --git a/yarn.lock b/yarn.lock index 1ce9bff10..32fbcdef4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1609,7 +1609,7 @@ mermaid "^9.2.2" tslib "^2.4.0" -"@docusaurus/theme-search-algolia@2.4.1": +"@docusaurus/theme-search-algolia@2.4.1", "@docusaurus/theme-search-algolia@^2.4.1": version "2.4.1" resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-2.4.1.tgz#906bd2cca3fced0241985ef502c892f58ff380fc" integrity sha512-6BcqW2lnLhZCXuMAvPRezFs1DpmEKzXFKlYjruuas+Xy3AQeFzDJKTJFIm49N77WFCTyxff8d3E4Q9pi/+5McQ== @@ -7039,9 +7039,9 @@ postcss-zindex@^5.1.0: integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A== postcss@^8.3.11, postcss@^8.4.14, postcss@^8.4.17, postcss@^8.4.21: - version "8.4.24" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.24.tgz#f714dba9b2284be3cc07dbd2fc57ee4dc972d2df" - integrity sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg== + version "8.4.31" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== dependencies: nanoid "^3.3.6" picocolors "^1.0.0"