diff --git a/.CONTRIBUTING.md b/.CONTRIBUTING.md index fded11620..e5d820f55 100644 --- a/.CONTRIBUTING.md +++ b/.CONTRIBUTING.md @@ -1,3 +1,236 @@ # Contribute to the Polkadot Developer Docs -TODO +The documentation source files are written in [Markdown](https://daringfireball.net/projects/markdown) and generally follow the [PaperMoon style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md). If the PaperMoon style guide doesn't provide explicit guidance on a particular subject, please default to the [Google developer documentation style guide](https://developers.google.com/style). + +This guide covers how to contribute to the documentation, including serving a local version of the site, adding new pages and directories, managing images and code snippets, and a few SEO tips. + +## Contents + +- [Viewing Site Locally](#view-site-locally) + - [Clone Repositories](#clone-repositories) + - [Install Dependencies and Serve Site](#install-dependencies) +- [Adding New Pages](#adding-new-pages) + - [Creating a Subdirectory](#creating-a-subdirectory) + - [Example `.pages` File](#example-pages-file) + - [Example `index.md` File](#example-indexmd-file) + - [Adding Pages to Existing Subdirectory](#adding-pages-to-existing-subdirectory) +- [Modifying Existing Pages](#modifying-existing-pages) +- [Adding Code and Text Snippets](#adding-code-and-text-snippets) +- [Adding Images](#adding-images) +- [Optimizing for SEO](#search-enging-optimization-seo) +- [Tools for Editing](#tools-for-editing) + +## Viewing Site Locally + +You may want to spin up a local version of the documentation site to preview your changes. This guide will cover the steps needed to serve a local version. + +### Clone Repositories + +Building and serving the site requires cloning two repositories: + +- **[Polkadot MkDocs](https://github.com/papermoonio/polkadot-mkdocs)** - contains the MkDocs configuration files, theme overrides, and custom CSS for the Polkadot documentation site + +- **[Polkadot Docs](https://github.com/polkadot-developers/polkadot-docs)** - the actual content is stored in the `polkadot-docs` repository and pulled into the `polkadot-mkdocs` directory during build + +For everything to work correctly, the file structure needs to be as follows: + +```bash +polkadot-mkdocs +|--- /material-overrides/ (folder) +|--- /polkadot-docs/ (repository) +|--- mkdocs.yml +``` + +To set up the structure, follow these steps: + +1. Clone this repository: + + ```bash + git clone https://github.com/papermoonio/polkadot-mkdocs + ``` + +2. Inside the folder just created, clone the `polkadot-docs` repository: + + ```bash + cd polkadot-mkdocs + git clone https://github.com/polkadot-developers/polkadot-docs.git + ``` + +### Install Dependencies and Serve Site + +1. Now that the repositories are cloned and properly nested, use the [pip](https://pypi.org/project/pip/) package installer to install [mkdocs](https://www.mkdocs.org/) and other required dependencies by running the command: + + ```bash + pip install -r requirements.txt + ``` + + This command will install all dependencies listed in the `requirements.txt` file. + +2. In the `polkadot-mkdocs` folder (which should be the current one), you can build the site by running: + + ```bash + mkdocs serve + ``` + +After a successful build, the site should be available at http://127.0.0.1:8000. + +## Adding New Pages + +When adding new pages to the documentation site, it is important to ensure all relevant items are updated correctly to prevent broken links and unexpected behavior. This section guides you through the steps to add new documentation pages. + +### Creating a New Section + +To create a new section of pages, you will first need to create a subdirectory with the desired name of the section. The root directory, and every subdirectory, must contain the following files: + +- `.pages` - defines the structure of the documentation site +- `index.md` - a landing page which can be used to provide more context about the content in the section + +#### Example `.pages` File + +```markdown +title: Application Developers +nav: + - index.md + - 'Polkadot SDK': 'polkadot-sdk.md' + - interact + - tooling +``` + +This example would result in adding 'Application Developers' as a section with two files inside, `index.md` and `polkadot-sdk.md`, and two additional subdirectories named `interact` and `tooling`. + +Some important things to note: + +- The `title` field at the top of the page represents the display name for the section. This is displayed on the left-side navigation bar when viewing the site +- The `index.md` page should always be the first item in the `nav` list +- Files follow the convention of `'Display Name': 'file-name.md'` +- Sections are listed by their directory name in the source code. For example, the Tooling section will be added to the navigation simply by using the directory name: `tooling` + +#### Example `index.md` File + +```markdown +--- +title: Build Chains with Polkadot +description: Learn how to build and customize blockchains with Polkadot SDK. Explore flexible tools, pre-built modules, and tutorials for efficient blockchain development. +--- + + +``` + +Some important things to note: + +- The `title` represents the `` tag and is used for SEO purposes +- The `description` represents the meta-description and is also used for SEO purposes + +### Adding Pages to Existing Section + +If you are adding pages to an existing section, the steps are simplified. However, it's essential to ensure you complete these steps to display the new page and its title on the documentation site correctly: + +- Add the new markdown page to the appropriate section. Note that the filename becomes part of the URL for this page. See the [style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md#naming-conventions) for additional guidance on naming conventions. +- Ensure the new content page includes the following: + - **`title`** - represents the `<title>` tag and is used for SEO purposes (not displayed on the published site) Titles have a maximum length of 45 characters. + - **`description`** - represents the meta-description and is also used for SEO purposes (not displayed on the published site). Descriptions should be 120-160 characters and should provide a preview into the page topic. + - **Page title** - an H1 heading title to be displayed at the top of the page + + - **`## Checking Prerequisites` section** - if the guide requires the user to have specific developer tools installed, for example, Docker or MetaMask, it should be listed here + +- Add the 'Display Name': 'file-name.md' for the new page to the `.pages` folder in the same subdirectory where you added the new page + +An example new content page might look like: + +```md +--- +title: Title for SEO purposes +description: Description for SEO purposes. This should be a sentence or two that is between 120-160 characters long. +--- + +# Page Title + +## Introduction + +Write 2-3 paragraphs to serve as the introduction here. + +... +``` + +More resources for [SEO Optimization](#search-engine-optimization-seo) of titles and descriptions. + +## Modifying Existing Pages + + To modify existing pages: + +1. Ensure you are in the `polkadot-docs` directory, then create a new branch for your content: + + ```bash + git checkout -b INSERT_NEW_BRANCH_NAME + ``` + +2. Modify content as desired. Remember to place images and code snippets in the appropriate folders (see the following sections for details) +3. Review the [style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md) to ensure your new content meets the guidelines +3. Once you commit and push all of your changes, open a pull request for the new content branch against the `main` branch +4. Monitor notifications and pull requests for feedback from code owners. At least one approval is required before merging content + +If your additions or modifications are limited to content on an existing page, there is no need to worry about the [`.pages`](#example-pages-file) or [`index.md`](#example-indexmd-file) files, as changes to page content don't affect these files. + +## Adding Code and Text Snippets + +Snippets are used to manage reusable lines of code or text. They are organized to mirror the structure of the docs site and stored under the root-level `.snippets` directory. For example, to add a code snippet to the page `develop/application-devs/tooling/chopsticks/overview.md`, you would place the code snippet in the folder `.snippets/code/application-devs/tooling/chopsticks/overview`. + +Text snippets are useful for pieces of copy you find the need to reuse often, such as disclaimers. Code snippets allow you to reuse pieces of code throughout a document while maintaining a single place to update that code when needed. + +To link to a snippet, you can use the following syntax in the Markdown file: + +```markdown +--8<-- 'code/<subdirectory>/<snippet-file-name>.js' +``` + +Text snippets are written in Markdown, as `.md` files, while code snippets should be written in their individual programming languages, for example, `.py` for Python or `.js` for JavaScript. + +Learn more about the effective use of [snippets](https://facelessuser.github.io/pymdown-extensions/extensions/snippets/). + +## Adding Images + +Images are stored in the `images` subdirectory. They are organized to mirror the structure of the docs site. For example, to add an image to the page `/develop/application-devs/tooling/chopsticks/overview.md`, you would place the image in the folder `images/application-devs/tooling/chopsticks/overview` + +All images intended for display on the website should be in `.webp` format. You can look up an image converter online to convert from `.jpeg`, `.png`, or other formats to `.webp`. + +To add an image to your page, you should have [alt text](https://developers.google.com/style/images#alt-text) and use the following syntax: + +```markdown +![Alt text goes here](/docs/images/<subdirectory>/<image-file-name>.webp) +``` + +See the [style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md#screenshots) for more tips on handling images. + +## Search Engine Optimization (SEO) + +Here are some resources to help you create good titles and descriptions for SEO: + +- [Google's recommendation on good titles](https://developers.google.com/search/docs/advanced/appearance/title-link?hl=en) +- [Google's recommendation on good descriptions](https://developers.google.com/search/docs/advanced/appearance/snippet?hl=en) + +In general, titles should be between 50 and 60 characters and descriptions should be between 120 and 160 characters. + +## Tools for Editing + +There are a few tools you may find useful for proofreading and editing your contributions: + +- **[Vale](https://vale.sh/)** - the `polkadot-mkdocs` repository contains configuration for Vale, an open source NLP-powered linter for text. The configuration is a work in progress with a growing custom dictionary tailored toward software engineering, blockchain, and Polkadot terms. Running Vale against your files locally can serve as a first round of feedback to speed up the review process + +To use Vale locally to screen your work: + +1. Visit the Vale site and follow the [installation instructions](https://vale.sh/docs/vale-cli/installation/) +2. From the `polkadot-mkdocs` directory, run the following in your terminal: + + ```bash + vale INSERT_PATH_TO_FILE + ``` + + The output will look something like: + + ![Vale sample terminal output](images/contributing/vale-output-01.webp) + +3. You can use CMD+click to open the file with the flagged items. This is especially helpful if you run Vale against a directory with multiple files + +4. Each flag tells you the line and location of the flagged item, the level of the flag (error, warning, or suggestion), and a suggestion for how to resolve the flag + +5. Once you have addressed the flagged items and made edits as needed, you can complete the normal steps to commit your changes and open a pull request to review for merge \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..b9bcc0745 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +[*.ts] +indent_style=space +indent_size=2 +max_line_length=80 +quote_type=single + +[*.js] +indent_style=space +indent_size=2 +max_line_length=80 +quote_type=single + +[*.json] +indent_style=space +indent_size=4 +max_line_length=80 +quote_type=double + +[*.html] +max_line_length=off diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit new file mode 100755 index 000000000..7d67ce521 --- /dev/null +++ b/.github/hooks/pre-commit @@ -0,0 +1,9 @@ +#!/bin/sh + +# Run Prettier on all files in snippets/code +echo "Running Prettier on the following files:" +npx prettier --write ".snippets/code/**/*.{js,ts,json,css,html}" + +# Add formatted files back to the commit +echo "Adding formatted files back to the commit..." +git add $(find .snippets/code -name "*.js" -o -name "*.ts" -o -name "*.json" -o -name "*.css" -o -name "*.html") diff --git a/.github/scripts/create_issues.py b/.github/scripts/create_issues.py index ecca598d0..10c918660 100644 --- a/.github/scripts/create_issues.py +++ b/.github/scripts/create_issues.py @@ -90,7 +90,7 @@ def main(): Please review the change log and update the documentation accordingly.""" - create_github_issue(owner, repo_name, title, body) + create_github_issue(owner, repo_name, title, body) if __name__ == "__main__": diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index abc64acae..00f436cee 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -1,16 +1,16 @@ -name: Vale Review +# name: Vale Review -on: - pull_request: - branches: master +# on: +# pull_request: +# branches: master -jobs: - vale-review-docs: - permissions: - pull-requests: write - uses: papermoonio/polkadot-mkdocs/.github/workflows/vale.yml@main - with: - repo: ${{ github.repository }} - pr_number: ${{ github.event.pull_request.number }} - secrets: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file +# jobs: +# vale-review-docs: +# permissions: +# pull-requests: write +# uses: papermoonio/polkadot-mkdocs/.github/workflows/vale.yml@main +# with: +# repo: ${{ github.repository }} +# pr_number: ${{ github.event.pull_request.number }} +# secrets: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..b512c09d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..a07e2a6aa --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,11 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +echo "Running Prettier on .snippets/code/**/*.{js,json,html}" +npx prettier --write .snippets/code/**/*.{js,json,html} + +echo "Running Taplo to format TOML files" +npx taplo fmt .snippets/code/**/*.toml + +echo "Adding formatted files back to the commit..." +git add .snippets/code/**/*.{js,json,html,toml} diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.md new file mode 100644 index 000000000..58667b413 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.md @@ -0,0 +1,24 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>ts-node localParachainTx.ts</span> + <br> + <span data-ty>Call data:</span> + <span data-ty>{</span> + <span data-ty> "origin": "moonbeam",</span> + <span data-ty> "dest": "moonbeam",</span> + <span data-ty> "direction": "local",</span> + <span data-ty> "xcmVersion": null,</span> + <span data-ty> "method": "balances::transferKeepAlive",</span> + <span data-ty> "format": "call",</span> + <span data-ty> "tx": "0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600"</span> + <span data-ty>}</span> + <span data-ty></span> + <span data-ty>Decoded tx:</span> + <span data-ty>{</span> + <span data-ty> "args": {</span> + <span data-ty> "dest": "0xF977814e90dA44bFA03b6295A0616a897441aceC",</span> + <span data-ty> "value": "1,000,000,000,000,000,000"</span> + <span data-ty> },</span> + <span data-ty> "method": "transferKeepAlive",</span> + <span data-ty> "section": "balances"</span> + <span data-ty>}</span> +</div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.ts new file mode 100644 index 000000000..a2a6453b6 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.ts @@ -0,0 +1,37 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://wss.api.moonbeam.network" + ); + const assetApi = new AssetTransferApi(api, specName, safeXcmVersion); + + let callInfo; + try { + callInfo = await assetApi.createTransferTransaction( + "2004", + "0xF977814e90dA44bFA03b6295A0616a897441aceC", + [], + ["1000000000000000000"], + { + format: "call", + keepAlive: true, + } + ); + + console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`); + } catch (e) { + console.error(e); + throw Error(e as string); + } + + const decoded = assetApi.decodeExtrinsic(callInfo.tx, "call"); + console.log(`\nDecoded tx:\n${JSON.stringify(JSON.parse(decoded), null, 4)}`); +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.md new file mode 100644 index 000000000..ff1535601 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.md @@ -0,0 +1,87 @@ +<div id='termynal' data-termynal> + <span data-ty='input'><span class='file-path'></span>ts-node paraToPara.ts</span> + + <br> + <span data-ty>Call data:</span> + <span data-ty>{</span> + <span data-ty> "origin": "moonriver",</span> + <span data-ty> "dest": "bifrost",</span> + <span data-ty> "direction": "ParaToPara",</span> + <span data-ty> "xcmVersion": 2,</span> + <span data-ty> "method": "transferMultiassets",</span> + <span data-ty> "format": "call",</span> + <span data-ty> "tx": "0x6a05010800010200451f06080101000700e40b540200010200451f0608010a0002093d000000000001010200451f0100c4db7bcb733e117c0b34ac96354b10d47e84a006b9e7e66a229d174e8ff2a06300"</span> + <span data-ty>}</span> + <span data-ty></span> + <span data-ty>Decoded tx:</span> + <span data-ty>{</span> + <span data-ty> "args": {</span> + <span data-ty> "assets": {</span> + <span data-ty> "V2": [</span> + <span data-ty> {</span> + <span data-ty> "id": {</span> + <span data-ty> "Concrete": {</span> + <span data-ty> "parents": "1",</span> + <span data-ty> "interior": {</span> + <span data-ty> "X2": [</span> + <span data-ty> {</span> + <span data-ty> "Parachain": "2,001"</span> + <span data-ty> },</span> + <span data-ty> {</span> + <span data-ty> "GeneralKey": "0x0101"</span> + <span data-ty> }</span> + <span data-ty> ]</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> "fun": {</span> + <span data-ty> "Fungible": "10,000,000,000"</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> {</span> + <span data-ty> "id": {</span> + <span data-ty> "Concrete": {</span> + <span data-ty> "parents": "1",</span> + <span data-ty> "interior": {</span> + <span data-ty> "X2": [</span> + <span data-ty> {</span> + <span data-ty> "Parachain": "2,001"</span> + <span data-ty> },</span> + <span data-ty> {</span> + <span data-ty> "GeneralKey": "0x010a"</span> + <span data-ty> }</span> + <span data-ty> ]</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> "fun": {</span> + <span data-ty> "Fungible": "1,000,000"</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> ]</span> + <span data-ty> },</span> + <span data-ty> "fee_item": "0",</span> + <span data-ty> "dest": {</span> + <span data-ty> "V2": {</span> + <span data-ty> "parents": "1",</span> + <span data-ty> "interior": {</span> + <span data-ty> "X2": [</span> + <span data-ty> {</span> + <span data-ty> "Parachain": "2,001"</span> + <span data-ty> },</span> + <span data-ty> {</span> + <span data-ty> "AccountId32": {</span> + <span data-ty> "network": "Any",</span> + <span data-ty> "id": "0xc4db7bcb733e117c0b34ac96354b10d47e84a006b9e7e66a229d174e8ff2a063"</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> ]</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> "dest_weight_limit": "Unlimited"</span> + <span data-ty> },</span> + <span data-ty> "method": "transferMultiassets",</span> + <span data-ty> "section": "xTokens"</span> + <span data-ty>}</span> +</div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.ts new file mode 100644 index 000000000..c5dbd7809 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.ts @@ -0,0 +1,36 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://moonriver.public.blastapi.io" + ); + const assetApi = new AssetTransferApi(api, specName, safeXcmVersion); + let callInfo; + try { + callInfo = await assetApi.createTransferTransaction( + "2001", + "0xc4db7bcb733e117c0b34ac96354b10d47e84a006b9e7e66a229d174e8ff2a063", + ["vMOVR", "72145018963825376852137222787619937732"], + ["1000000", "10000000000"], + { + format: "call", + xcmVersion: safeXcmVersion, + } + ); + + console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`); + } catch (e) { + console.error(e); + throw Error(e as string); + } + + const decoded = assetApi.decodeExtrinsic(callInfo.tx, "call"); + console.log(`\nDecoded tx:\n${JSON.stringify(JSON.parse(decoded), null, 4)}`); +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.md new file mode 100644 index 000000000..dea06e3b5 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.md @@ -0,0 +1,62 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>ts-node relayToSystem.ts</span> + <br> + <span data-ty>Call data:</span> + <span data-ty>{</span> + <span data-ty> "origin": "westend",</span> + <span data-ty> "dest": "westmint",</span> + <span data-ty> "direction": "RelayToSystem",</span> + <span data-ty> "xcmVersion": 3,</span> + <span data-ty> "method": "transferAssets",</span> + <span data-ty> "format": "call",</span> + <span data-ty> "tx": "0x630b03000100a10f03000101006c0c32faf970eacb2d4d8e538ac0dab3642492561a1be6f241c645876c056c1d030400000000070010a5d4e80000000000"</span> + <span data-ty>}</span> + <span data-ty></span> + <span data-ty>Decoded tx:</span> + <span data-ty>{</span> + <span data-ty> "args": {</span> + <span data-ty> "dest": {</span> + <span data-ty> "V3": {</span> + <span data-ty> "parents": "0",</span> + <span data-ty> "interior": {</span> + <span data-ty> "X1": {</span> + <span data-ty> "Parachain": "1,000"</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> "beneficiary": {</span> + <span data-ty> "V3": {</span> + <span data-ty> "parents": "0",</span> + <span data-ty> "interior": {</span> + <span data-ty> "X1": {</span> + <span data-ty> "AccountId32": {</span> + <span data-ty> "network": null,</span> + <span data-ty> "id": "0x6c0c32faf970eacb2d4d8e538ac0dab3642492561a1be6f241c645876c056c1d"</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> "assets": {</span> + <span data-ty> "V3": [</span> + <span data-ty> {</span> + <span data-ty> "id": {</span> + <span data-ty> "Concrete": {</span> + <span data-ty> "parents": "0",</span> + <span data-ty> "interior": "Here"</span> + <span data-ty> }</span> + <span data-ty> },</span> + <span data-ty> "fun": {</span> + <span data-ty> "Fungible": "1,000,000,000,000"</span> + <span data-ty> }</span> + <span data-ty> }</span> + <span data-ty> ]</span> + <span data-ty> },</span> + <span data-ty> "fee_asset_item": "0",</span> + <span data-ty> "weight_limit": "Unlimited"</span> + <span data-ty> },</span> + <span data-ty> "method": "transferAssets",</span> + <span data-ty> "section": "xcmPallet"</span> + <span data-ty>}</span> +</div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.ts new file mode 100644 index 000000000..ead3c4be5 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.ts @@ -0,0 +1,36 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://westend-rpc.polkadot.io" + ); + const assetApi = new AssetTransferApi(api, specName, safeXcmVersion); + let callInfo; + try { + callInfo = await assetApi.createTransferTransaction( + "1000", + "5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX", + ["WND"], + ["1000000000000"], + { + format: "call", + xcmVersion: safeXcmVersion, + } + ); + + console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`); + } catch (e) { + console.error(e); + throw Error(e as string); + } + + const decoded = assetApi.decodeExtrinsic(callInfo.tx, "call"); + console.log(`\nDecoded tx:\n${JSON.stringify(JSON.parse(decoded), null, 4)}`); +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/setup.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/setup.ts new file mode 100644 index 000000000..24f32ef24 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/overview/setup.ts @@ -0,0 +1,16 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "INSERT_WEBSOCKET_URL" + ); + + const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion); + + // Your code using assetsApi goes here +} + +main(); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/asset-transfer-type.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/asset-transfer-type.md new file mode 100644 index 000000000..b9029d958 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/asset-transfer-type.md @@ -0,0 +1,10 @@ +```ts +export type AssetTransferType = + | LocalReserve + | DestinationReserve + | Teleport + | RemoteReserve; +``` + +!!! note + To use the `assetTransferType` parameter, which is a string, you should use the `AssetTransferType` type as if each of its variants are strings. For example: `assetTransferType = 'LocalReserve'`. \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-request.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-request.ts new file mode 100644 index 000000000..d35427a2d --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-request.ts @@ -0,0 +1,35 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://westend-rpc.polkadot.io" + ); + const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion); + + let callInfo; + try { + callInfo = await assetsApi.claimAssets( + [ + `{"parents":"0","interior":{"X2":[{"PalletInstance":"50"},{"GeneralIndex":"1984"}]}}`, + ], + ["1000000000000"], + "0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b", + { + format: "call", + xcmVersion: 2, + } + ); + + console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`); + } catch (e) { + console.error(e); + throw Error(e as string); + } +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-response.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-response.md new file mode 100644 index 000000000..cea34c61c --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-response.md @@ -0,0 +1,12 @@ +<div id="termynal" data-termynal> + <span data-ty>Call data:</span> + <span data-ty>{</span> + <span data-ty> "origin": "0",</span> + <span data-ty> "dest": "westend",</span> + <span data-ty> "direction": "local",</span> + <span data-ty> "xcmVersion": 2,</span> + <span data-ty> "method": "claimAssets",</span> + <span data-ty> "format": "call",</span> + <span data-ty> "tx": "0x630c0104000002043205011f00070010a5d4e80100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b"</span> + <span data-ty>}</span> +<div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-fn-signature.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-fn-signature.ts new file mode 100644 index 000000000..4303c60d1 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ca-fn-signature.ts @@ -0,0 +1,6 @@ +public async claimAssets<T extends Format>( + assetIds: string[], + amounts: string[], + beneficiary: string, + opts: TransferArgsOpts<T> +): Promise<TxResult<T>>; diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/constructed-format.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/constructed-format.md new file mode 100644 index 000000000..7b610adf8 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/constructed-format.md @@ -0,0 +1,15 @@ +```ts +export type ConstructedFormat<T> = T extends 'payload' + ? GenericExtrinsicPayload + : T extends 'call' + ? `0x${string}` + : T extends 'submittable' + ? SubmittableExtrinsic<'promise', ISubmittableResult> + : never; +``` + +The `ConstructedFormat` type is a conditional type that returns a specific type based on the value of the TxResult `format` field. + +- Payload format - if the format field is set to `'payload'`, the `ConstructedFormat` type will return a [`GenericExtrinsicPayload`](https://github.com/polkadot-js/api/blob/3b7b44f048ff515579dd233ea6964acec39c0589/packages/types/src/extrinsic/ExtrinsicPayload.ts#L48){target=_blank} +- Call format - if the format field is set to `'call'`, the `ConstructedFormat` type will return a hexadecimal string (`0x${string}`). This is the encoded representation of the extrinsic call +- Submittable format - if the format field is set to `'submittable'`, the `ConstructedFormat` type will return a [`SubmittableExtrinsic`](https://github.com/polkadot-js/api/blob/3b7b44f048ff515579dd233ea6964acec39c0589/packages/api-base/src/types/submittable.ts#L56){target=_blank}. This is a Polkadot.js type that represents a transaction that can be submitted to the blockchain \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-request.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-request.ts new file mode 100644 index 000000000..4cfca7993 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-request.ts @@ -0,0 +1,34 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://wss.api.moonbeam.network" + ); + const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion); + + let callInfo; + try { + callInfo = await assetsApi.createTransferTransaction( + "2004", + "0xF977814e90dA44bFA03b6295A0616a897441aceC", + [], + ["1000000000000000000"], + { + format: "call", + keepAlive: true, + } + ); + + console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`); + } catch (e) { + console.error(e); + throw Error(e as string); + } +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-response.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-response.md new file mode 100644 index 000000000..a1bb01f6a --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-response.md @@ -0,0 +1,12 @@ +<div id="termynal" data-termynal> + <span data-ty>Call data:</span> + <span data-ty>{</span> + <span data-ty> "origin": "moonbeam",</span> + <span data-ty> "dest": "moonbeam",</span> + <span data-ty> "direction": "local",</span> + <span data-ty> "xcmVersion": null,</span> + <span data-ty> "method": "balances::transferKeepAlive",</span> + <span data-ty> "format": "call",</span> + <span data-ty> "tx": "0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600"</span> + <span data-ty>}</span> +<div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-fn-signature.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-fn-signature.ts new file mode 100644 index 000000000..0af1ef38c --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-fn-signature.ts @@ -0,0 +1,7 @@ +public async createTransferTransaction<T extends Format>( + destChainId: string, + destAddr: string, + assetIds: string[], + amounts: string[], + opts: TransferArgsOpts<T> = {} +): Promise<TxResult<T>>; diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-request.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-request.ts new file mode 100644 index 000000000..903714021 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-request.ts @@ -0,0 +1,27 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://wss.api.moonbeam.network" + ); + const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion); + + const encodedExt = "0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600"; + + try { + const decodedExt = assetsApi.decodeExtrinsic(encodedExt, "call"); + console.log( + `Decoded tx:\n ${JSON.stringify(JSON.parse(decodedExt), null, 4)}` + ); + } catch (e) { + console.error(e); + throw Error(e as string); + } +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-response.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-response.md new file mode 100644 index 000000000..3bc83e19d --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-response.md @@ -0,0 +1,11 @@ +<div id='termynal' data-termynal> + <span data-ty>Decoded tx:</span> + <span data-ty> {</span> + <span data-ty> "args": {</span> + <span data-ty> "dest": "0xF977814e90dA44bFA03b6295A0616a897441aceC",</span> + <span data-ty> "value": "100,000"</span> + <span data-ty> },</span> + <span data-ty> "method": "transferKeepAlive",</span> + <span data-ty> "section": "balances"</span> + <span data-ty>}</span> +</div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-fn-signature.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-fn-signature.ts new file mode 100644 index 000000000..197d817df --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/de-fn-signature.ts @@ -0,0 +1,4 @@ +public decodeExtrinsic<T extends Format>( + encodedTransaction: string, + format: T +): string; diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-request.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-request.ts new file mode 100644 index 000000000..6fc39c42e --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-request.ts @@ -0,0 +1,25 @@ +import { + AssetTransferApi, + constructApiPromise, +} from "@substrate/asset-transfer-api"; + +async function main() { + const { api, specName, safeXcmVersion } = await constructApiPromise( + "wss://wss.api.moonbeam.network" + ); + const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion); + + const encodedExt = "0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600"; + + try { + const decodedExt = await assetsApi.fetchFeeInfo(encodedExt, "call"); + console.log(`Fee info:\n${JSON.stringify(decodedExt, null, 4)}`); + } catch (e) { + console.error(e); + throw Error(e as string); + } +} + +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-response.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-response.md new file mode 100644 index 000000000..3f90dea38 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-response.md @@ -0,0 +1,11 @@ +<div id='termynal' data-termynal> + <span data-ty>Fee info:</span> + <span data-ty>{</span> + <span data-ty> "weight": {</span> + <span data-ty> "refTime": 163777000,</span> + <span data-ty> "proofSize": 3581</span> + <span data-ty> },</span> + <span data-ty> "class": "Normal",</span> + <span data-ty> "partialFee": 0</span> + <span data-ty>}</span> +</div> \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-fn-signature.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-fn-signature.ts new file mode 100644 index 000000000..7f87e9aa8 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-fn-signature.ts @@ -0,0 +1,4 @@ +public async fetchFeeInfo<T extends Format>( + tx: ConstructedFormat<T>, + format: T +): Promise<RuntimeDispatchInfo | RuntimeDispatchInfoV1 | null>; diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts new file mode 100644 index 000000000..7e20a0012 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts @@ -0,0 +1 @@ +export type Format = "payload" | "call" | "submittable"; diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/transfer-arg-opts.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/transfer-arg-opts.md new file mode 100644 index 000000000..e244fecbc --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/transfer-arg-opts.md @@ -0,0 +1,94 @@ +Options for customizing the claim assets transaction. These options allow you to specify the transaction format, fee payment details, weight limits, XCM versions, and more. + +??? child "Show more" + + `format` ++"T extends Format"++ + + Specifies the format for returning a transaction. + + ??? child "Type `Format`" + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts' + ``` + + --- + + `paysWithFeeOrigin` ++"string"++ + + The Asset ID to pay fees on the current common good parachain. The defaults are as follows: + + - Polkadot Asset Hub - `'DOT'` + - Kusama Asset Hub - `'KSM'` + + --- + + `paysWithFeeDest` ++"string"++ + + Asset ID to pay fees on the destination parachain. + + --- + + `weightLimit` ++"{ refTime?: string, proofSize?: string }"++ + + Custom weight limit option. If not provided, it will default to unlimited. + + --- + + `xcmVersion` ++"number"++ + + Sets the XCM version for message construction. If this is not present a supported version will be queried, and if there is no supported version a safe version will be queried. + + --- + + `keepAlive` ++"boolean"++ + + Enables `transferKeepAlive` for local asset transfers. For creating local asset transfers, if `true` this will allow for a `transferKeepAlive` as opposed to a `transfer`. + + --- + + `transferLiquidToken` ++"boolean"++ + + Declares if this will transfer liquidity tokens. Default is `false`. + + --- + + `assetTransferType` ++"string"++ + + The XCM transfer type used to transfer assets. The `AssetTransferType` type defines the possible values for this parameter. + + ??? child "Type `AssetTransferType`" + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/asset-transfer-type.md' + + --- + + `remoteReserveAssetTransferTypeLocation` ++"string"++ + + The remove reserve location for the XCM transfer. Should be provided when specifying an `assetTransferType` of `RemoteReserve`. + + --- + + `feesTransferType` ++"string"++ + + XCM TransferType used to pay fees for XCM transfer. The `AssetTransferType` type defines the possible values for this parameter. + + ??? child "Type `AssetTransferType`" + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/asset-transfer-type.md' + + --- + + `remoteReserveFeesTransferTypeLocation` ++"string"++ + + The remote reserve location for the XCM transfer fees. Should be provided when specifying a `feesTransferType` of `RemoteReserve`. + + --- + + `customXcmOnDest` ++"string"++ + + A custom XCM message to be executed on the destination chain. Should be provided if a custom XCM message is needed after transferring assets. Defaults to: + + ```bash + Xcm(vec![DepositAsset { assets: Wild(AllCounted(assets.len())), beneficiary }]) + ``` \ No newline at end of file diff --git a/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/tx-result.md b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/tx-result.md new file mode 100644 index 000000000..389d58391 --- /dev/null +++ b/.snippets/code/develop/application-devs/tooling/asset-transfer-api/reference/tx-result.md @@ -0,0 +1,148 @@ +A promise containing the result of constructing the transaction. + +??? child "Show more" + + `dest` ++"string"++ + + The destination `specName` of the transaction. + + --- + + `origin` ++"string"++ + + The origin `specName` of the transaction. + + --- + + `format` ++"Format | 'local'"++ + + The format type the transaction is outputted in. + + ??? child "Type `Format`" + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts' + ``` + + --- + + `xcmVersion` ++"number | null"++ + + The XCM version that was used to construct the transaction. + + --- + + `direction` ++"Direction | 'local'"++ + + The direction of the cross-chain transfer. + + ??? child "Enum `Direction` values" + + `Local` + + Local transaction. + + --- + + `SystemToPara` + + System parachain to parachain. + + --- + + `SystemToRelay` + + System paracahin to system relay chain. + + --- + + `SystemToSystem` + + System parachain to System parachain chain. + + --- + + `SystemToBridge` + + System parachain to an external `GlobalConsensus` chain. + + --- + + `ParaToPara` + + Parachain to Parachain. + + --- + + `ParaToRelay` + + Parachain to Relay chain. + + --- + + `ParaToSystem` + + Parachain to System parachain. + + --- + + `RelayToSystem` + + Relay to System Parachain. + + --- + + `RelayToPara` + + Relay chain to Parachain. + + --- + + `RelayToBridge` + + Relay chain to an external `GlobalConsensus` chain. + + `method` ++"Methods"++ + + The method used in the transaction. + + ??? child "Type `Methods`" + + ```ts + type Methods = + | LocalTransferTypes + | 'transferAssets' + | 'transferAssetsUsingTypeAndThen' + | 'limitedReserveTransferAssets' + | 'limitedTeleportAssets' + | 'transferMultiasset' + | 'transferMultiassets' + | 'transferMultiassetWithFee' + | 'claimAssets'; + ``` + + ??? child "Type `LocalTransferTypes`" + + ```ts + type LocalTransferTypes = + | 'assets::transfer' + | 'assets::transferKeepAlive' + | 'foreignAssets::transfer' + | 'foreignAssets::transferKeepAlive' + | 'balances::transfer' + | 'balances::transferKeepAlive' + | 'poolAssets::transfer' + | 'poolAssets::transferKeepAlive' + | 'tokens::transfer' + | 'tokens::transferKeepAlive'; + ``` + + --- + + `tx` ++"ConstructedFormat<T>"++ + + The constructed transaction. + + ??? child "Type `ConstructedFormat<T>`" + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/constructed-format.md' diff --git a/.snippets/code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-1.html b/.snippets/code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-1.html new file mode 100644 index 000000000..bb3fb9c5b --- /dev/null +++ b/.snippets/code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-1.html @@ -0,0 +1,5 @@ +<div id="termynal" data-termynal markdown> + <span data-ty="input"><span class="file-path"></span>brew --version</span> + <span data-ty>Homebrew 4.3.15</span> + <span data-ty="input"><span class="file-path"></span></span> +</div> diff --git a/.snippets/code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-2.html b/.snippets/code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-2.html new file mode 100644 index 000000000..00eee2496 --- /dev/null +++ b/.snippets/code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-2.html @@ -0,0 +1,19 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>rustup show</span> + <span data-ty>...</span> + <br /> + <span data-ty>active toolchain</span> + <span data-ty>----------------</span> + <br /> + <span data-ty>stable-x86_64-apple-darwin (default)</span> + <span data-ty>rustc 1.81.0 (eeb90cda1 2024-09-04)</span> + <br /> + <span data-ty>...</span> + <br /> + <span data-ty>active toolchain</span> + <span data-ty>----------------</span> + <br /> + <span data-ty>nightly-x86_64-apple-darwin (overridden by +toolchain on the command line)</span> + <span data-ty>rustc 1.83.0-nightly (6c6d21008 2024-09-22)</span> + <span data-ty="input"><span class="file-path"></span></span> +</div> diff --git a/.snippets/code/develop/parachain-devs/interoperability/hrmp-channels/hrmp-query-output.json b/.snippets/code/develop/parachain-devs/interoperability/hrmp-channels/hrmp-query-output.json new file mode 100644 index 000000000..8165c394f --- /dev/null +++ b/.snippets/code/develop/parachain-devs/interoperability/hrmp-channels/hrmp-query-output.json @@ -0,0 +1,38 @@ +[ + [ + [ + { + "sender": 1000, + "recipient": 2500 + } + ], + { + "maxCapacity": 8, + "maxTotalSize": 8192, + "maxMessageSize": 1048576, + "msgCount": 0, + "totalSize": 0, + "mqcHead": null, + "senderDeposit": 0, + "recipientDeposit": 0 + } + ], + [ + [ + { + "sender": 2500, + "recipient": 1000 + } + ], + { + "maxCapacity": 8, + "maxTotalSize": 8192, + "maxMessageSize": 1048576, + "msgCount": 0, + "totalSize": 0, + "mqcHead": null, + "senderDeposit": 0, + "recipientDeposit": 0 + } + ] +] diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/compilation-output.html b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/compilation-output.html index d16a0d2e6..ddd0db1a7 100644 --- a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/compilation-output.html +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/compilation-output.html @@ -1,5 +1,5 @@ <div id="termynal" data-termynal> - <span data-ty="input"><span class="file-path"></span>cargo build --release</span> - <span data-ty>Compiling solochain-template-node</span> - <span data-ty>Finished `release` profile [optimized] target(s) in 27.12s</span> -</div> \ No newline at end of file + <span data-ty="input"><span class="file-path"></span>cargo build --release</span> + <span data-ty>Compiling solochain-template-node</span> + <span data-ty>Finished `release` profile [optimized] target(s) in 27.12s</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-block-production.html b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-block-production.html index d888f06d5..5b1f8a6d7 100644 --- a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-block-production.html +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-block-production.html @@ -1,11 +1,11 @@ -<div id='termynal' data-termynal> - <span data-ty>...</span> - <span data-ty>2024-09-09 08:32:47 💤 Idle (0 peers), best: #0 (0x0eef…935d), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> - <span data-ty>...</span> - <span data-ty>2024-09-09 08:32:52 💤 Idle (0 peers), best: #1 (0xcb3d…265b), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> - <span data-ty>...</span> - <span data-ty>2024-09-09 08:32:57 💤 Idle (0 peers), best: #2 (0x16d7…083f), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> - <span data-ty>...</span> - <span data-ty>2024-09-09 08:33:02 💤 Idle (0 peers), best: #3 (0xe6a4…2cc4), finalized #1 (0xcb3d…265b), ⬇ 0 ⬆ 0</span> - <span data-ty>...</span> -</div> \ No newline at end of file +<div id="termynal" data-termynal> + <span data-ty>...</span> + <span data-ty>2024-09-09 08:32:47 💤 Idle (0 peers), best: #0 (0x0eef…935d), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> + <span data-ty>...</span> + <span data-ty>2024-09-09 08:32:52 💤 Idle (0 peers), best: #1 (0xcb3d…265b), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> + <span data-ty>...</span> + <span data-ty>2024-09-09 08:32:57 💤 Idle (0 peers), best: #2 (0x16d7…083f), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> + <span data-ty>...</span> + <span data-ty>2024-09-09 08:33:02 💤 Idle (0 peers), best: #3 (0xe6a4…2cc4), finalized #1 (0xcb3d…265b), ⬇ 0 ⬆ 0</span> + <span data-ty>...</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-output.html b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-output.html index e7f2189ae..e0819b6a5 100644 --- a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-output.html +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/build-a-local-blockchain/node-output.html @@ -1,27 +1,27 @@ -<div id='termynal' data-termynal> - <span data-ty='input'><span class='file-path'></span>./target/release/solochain-template-node --dev</span> - <br> - <span data-ty>2024-09-09 08:32:42 Substrate Node</span> - <span data-ty>2024-09-09 08:32:42 ✌️ version 0.1.0-8599efc46ae</span> - <span data-ty>2024-09-09 08:32:42 ❤️ by Parity Technologies <admin@parity.io>, 2017-2024</span> - <span data-ty>2024-09-09 08:32:42 📋 Chain specification: Development</span> - <span data-ty>2024-09-09 08:32:42 🏷 Node name: light-boundary-7850</span> - <span data-ty>2024-09-09 08:32:42 👤 Role: AUTHORITY</span> - <span data-ty>2024-09-09 08:32:42 💾 Database: RocksDb at /var/folders/x0/xl_kjddj3ql3bx7752yr09hc0000gn/T/substrate0QH9va/chains/dev/db/full</span> - <span data-ty>2024-09-09 08:32:42 🔨 Initializing Genesis block/state (state: 0xc2a0…16ba, header-hash: 0x0eef…935d)</span> - <span data-ty>2024-09-09 08:32:42 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.</span> - <span data-ty>2024-09-09 08:32:42 Using default protocol ID "sup" because none is configured in the chain specs</span> - <span data-ty>2024-09-09 08:32:42 🏷 Local node identity is: 12D3KooWPhdUzf66di1SuuRFgjkFs6X8jm3Uj2ss5ri31WuVAbgt</span> - <span data-ty>2024-09-09 08:32:42 Running libp2p network backend</span> - <span data-ty>2024-09-09 08:32:42 💻 Operating system: macos</span> - <span data-ty>2024-09-09 08:32:42 💻 CPU architecture: aarch64</span> - <span data-ty>2024-09-09 08:32:42 📦 Highest known block at #0</span> - <span data-ty>2024-09-09 08:32:42 〽️ Prometheus exporter started at 127.0.0.1:9615</span> - <span data-ty>2024-09-09 08:32:42 Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["*"]</span> - <span data-ty>2024-09-09 08:32:47 💤 Idle (0 peers), best: #0 (0x0eef…935d), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> - <span data-ty>2024-09-09 08:32:48 🙌 Starting consensus session on top of parent 0x0eef4a08ef90cc04d01864514dc5cb2bd822314309b770b49b0177f920ed935d (#0)</span> - <span data-ty>2024-09-09 08:32:48 🎁 Prepared block for proposing at 1 (1 ms) [hash: 0xc14630b76907550bef9037dcbfafa2b25c8dc763495f30d9e36ad4b93b673b36; parent_hash: 0x0eef…935d; extrinsics (1): [0xbcd8…5132]</span> - <span data-ty>2024-09-09 08:32:48 🔖 Pre-sealed block for proposal at 1. Hash now 0xcb3d2f28bc73807dac5cf19fcfb2ac6d7e922756da9d41ca0c9dadbd0e45265b, previously 0xc14630b76907550bef9037dcbfafa2b25c8dc763495f30d9e36ad4b93b673b36.</span> - <span data-ty>2024-09-09 08:32:48 🏆 Imported #1 (0x0eef…935d → 0xcb3d…265b)</span> - <span data-ty>...</span> -</div> \ No newline at end of file +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>./target/release/solochain-template-node --dev</span> + <br /> + <span data-ty>2024-09-09 08:32:42 Substrate Node</span> + <span data-ty>2024-09-09 08:32:42 ✌️ version 0.1.0-8599efc46ae</span> + <span data-ty>2024-09-09 08:32:42 ❤️ by Parity Technologies <admin@parity.io>, 2017-2024</span> + <span data-ty>2024-09-09 08:32:42 📋 Chain specification: Development</span> + <span data-ty>2024-09-09 08:32:42 🏷 Node name: light-boundary-7850</span> + <span data-ty>2024-09-09 08:32:42 👤 Role: AUTHORITY</span> + <span data-ty>2024-09-09 08:32:42 💾 Database: RocksDb at /var/folders/x0/xl_kjddj3ql3bx7752yr09hc0000gn/T/substrate0QH9va/chains/dev/db/full</span> + <span data-ty>2024-09-09 08:32:42 🔨 Initializing Genesis block/state (state: 0xc2a0…16ba, header-hash: 0x0eef…935d)</span> + <span data-ty>2024-09-09 08:32:42 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.</span> + <span data-ty>2024-09-09 08:32:42 Using default protocol ID "sup" because none is configured in the chain specs</span> + <span data-ty>2024-09-09 08:32:42 🏷 Local node identity is: 12D3KooWPhdUzf66di1SuuRFgjkFs6X8jm3Uj2ss5ri31WuVAbgt</span> + <span data-ty>2024-09-09 08:32:42 Running libp2p network backend</span> + <span data-ty>2024-09-09 08:32:42 💻 Operating system: macos</span> + <span data-ty>2024-09-09 08:32:42 💻 CPU architecture: aarch64</span> + <span data-ty>2024-09-09 08:32:42 📦 Highest known block at #0</span> + <span data-ty>2024-09-09 08:32:42 〽️ Prometheus exporter started at 127.0.0.1:9615</span> + <span data-ty>2024-09-09 08:32:42 Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["*"]</span> + <span data-ty>2024-09-09 08:32:47 💤 Idle (0 peers), best: #0 (0x0eef…935d), finalized #0 (0x0eef…935d), ⬇ 0 ⬆ 0</span> + <span data-ty>2024-09-09 08:32:48 🙌 Starting consensus session on top of parent 0x0eef4a08ef90cc04d01864514dc5cb2bd822314309b770b49b0177f920ed935d (#0)</span> + <span data-ty>2024-09-09 08:32:48 🎁 Prepared block for proposing at 1 (1 ms) [hash: 0xc14630b76907550bef9037dcbfafa2b25c8dc763495f30d9e36ad4b93b673b36; parent_hash: 0x0eef…935d; extrinsics (1): [0xbcd8…5132]</span> + <span data-ty>2024-09-09 08:32:48 🔖 Pre-sealed block for proposal at 1. Hash now 0xcb3d2f28bc73807dac5cf19fcfb2ac6d7e922756da9d41ca0c9dadbd0e45265b, previously 0xc14630b76907550bef9037dcbfafa2b25c8dc763495f30d9e36ad4b93b673b36.</span> + <span data-ty>2024-09-09 08:32:48 🏆 Imported #1 (0x0eef…935d → 0xcb3d…265b)</span> + <span data-ty>...</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output-1.html b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output-1.html index 52441a04e..bb4550546 100644 --- a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output-1.html +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output-1.html @@ -1,19 +1,19 @@ -<div id='termynal' data-termynal> - <data-ty>...</span> - <span data-ty>2024-09-10 09:04:57 discovered: 12D3KooWHdiAxVd8uMQR1hGWXccidmfCwLqcMpGwR6QcTP6QRMuD /ip4/192.168.1.4/tcp/30334</span> - <span data-ty>2024-09-10 09:04:58 💤 Idle (0 peers), best: #0 (0x850f…951f), finalized #0 (0x850f…951f), ⬇ 0.3kiB/s ⬆ 0.3kiB/s</span> - <span data-ty>2024-09-10 09:05:00 🙌 Starting consensus session on top of parent 0x850ffab4827cb0297316cbf01fc7c2afb954c5124f366f25ea88bfd19ede951f (#0)</span> - <span data-ty>2024-09-10 09:05:00 🎁 Prepared block for proposing at 1 (2 ms) [hash: 0xe21a305e6647b0b0c6c73ba31a49ae422809611387fadb7785f68d0a1db0b52d; parent_hash: 0x850f…951f; extrinsics (1): [0x0c18…08d8]</span> - <span data-ty>2024-09-10 09:05:00 🔖 Pre-sealed block for proposal at 1. Hash now 0x75bbb026db82a4d6ff88b96f952a29e15dac2b7df24d4cb95510945e2bede82d, previously 0xe21a305e6647b0b0c6c73ba31a49ae422809611387fadb7785f68d0a1db0b52d.</span> - <span data-ty>2024-09-10 09:05:00 🏆 Imported #1 (0x850f…951f → 0x75bb…e82d)</span> - <span data-ty>2024-09-10 09:05:03 💤 Idle (1 peers), best: #1 (0x75bb…e82d), finalized #0 (0x850f…951f), ⬇ 0.7kiB/s ⬆ 0.8kiB/s</span> - <span data-ty>2024-09-10 09:05:06 🏆 Imported #2 (0x75bb…e82d → 0x774d…a176)</span> - <span data-ty>2024-09-10 09:05:08 💤 Idle (1 peers), best: #2 (0x774d…a176), finalized #0 (0x850f…951f), ⬇ 0.6kiB/s ⬆ 0.5kiB/s</span> - <span data-ty>2024-09-10 09:05:12 🙌 Starting consensus session on top of parent 0x774dec6bff7a27c38e21106a5a7428ae5d50b991f39cda7c0aa3c0c9322da176 (#2)</span> - <span data-ty>2024-09-10 09:05:12 🎁 Prepared block for proposing at 3 (0 ms) [hash: 0x10bb4589a7a13bac657219a9ff06dcef8d55e46a4275aa287a966b5648a6d486; parent_hash: 0x774d…a176; extrinsics (1): [0xdcd4…b5ec]</span> - <span data-ty>2024-09-10 09:05:12 🔖 Pre-sealed block for proposal at 3. Hash now 0x01e080f4b8421c95d0033aac7310b36972fdeef7c6025f8a153c436c1bb214ee, previously 0x10bb4589a7a13bac657219a9ff06dcef8d55e46a4275aa287a966b5648a6d486.</span> - <span data-ty>2024-09-10 09:05:12 🏆 Imported #3 (0x774d…a176 → 0x01e0…14ee)</span> - <span data-ty>2024-09-10 09:05:13 💤 Idle (1 peers), best: #3 (0x01e0…14ee), finalized #0 (0x850f…951f), ⬇ 0.6kiB/s ⬆ 0.6kiB/s</span> - <span data-ty>2024-09-10 09:05:18 🏆 Imported #4 (0x01e0…14ee → 0xe176…0430)</span> - <span data-ty>2024-09-10 09:05:18 💤 Idle (1 peers), best: #4 (0xe176…0430), finalized #1 (0x75bb…e82d), ⬇ 0.6kiB/s ⬆ 0.6kiB/s</span> -</div> \ No newline at end of file +<div id="termynal" data-termynal> + <span data-ty>...</span> + <span data-ty>2024-09-10 09:04:57 discovered: 12D3KooWHdiAxVd8uMQR1hGWXccidmfCwLqcMpGwR6QcTP6QRMuD /ip4/192.168.1.4/tcp/30334</span> + <span data-ty>2024-09-10 09:04:58 💤 Idle (0 peers), best: #0 (0x850f…951f), finalized #0 (0x850f…951f), ⬇ 0.3kiB/s ⬆ 0.3kiB/s</span> + <span data-ty>2024-09-10 09:05:00 🙌 Starting consensus session on top of parent 0x850ffab4827cb0297316cbf01fc7c2afb954c5124f366f25ea88bfd19ede951f (#0)</span> + <span data-ty>2024-09-10 09:05:00 🎁 Prepared block for proposing at 1 (2 ms) [hash: 0xe21a305e6647b0b0c6c73ba31a49ae422809611387fadb7785f68d0a1db0b52d; parent_hash: 0x850f…951f; extrinsics (1): [0x0c18…08d8]</span> + <span data-ty>2024-09-10 09:05:00 🔖 Pre-sealed block for proposal at 1. Hash now 0x75bbb026db82a4d6ff88b96f952a29e15dac2b7df24d4cb95510945e2bede82d, previously 0xe21a305e6647b0b0c6c73ba31a49ae422809611387fadb7785f68d0a1db0b52d.</span> + <span data-ty>2024-09-10 09:05:00 🏆 Imported #1 (0x850f…951f → 0x75bb…e82d)</span> + <span data-ty>2024-09-10 09:05:03 💤 Idle (1 peers), best: #1 (0x75bb…e82d), finalized #0 (0x850f…951f), ⬇ 0.7kiB/s ⬆ 0.8kiB/s</span> + <span data-ty>2024-09-10 09:05:06 🏆 Imported #2 (0x75bb…e82d → 0x774d…a176)</span> + <span data-ty>2024-09-10 09:05:08 💤 Idle (1 peers), best: #2 (0x774d…a176), finalized #0 (0x850f…951f), ⬇ 0.6kiB/s ⬆ 0.5kiB/s</span> + <span data-ty>2024-09-10 09:05:12 🙌 Starting consensus session on top of parent 0x774dec6bff7a27c38e21106a5a7428ae5d50b991f39cda7c0aa3c0c9322da176 (#2)</span> + <span data-ty>2024-09-10 09:05:12 🎁 Prepared block for proposing at 3 (0 ms) [hash: 0x10bb4589a7a13bac657219a9ff06dcef8d55e46a4275aa287a966b5648a6d486; parent_hash: 0x774d…a176; extrinsics (1): [0xdcd4…b5ec]</span> + <span data-ty>2024-09-10 09:05:12 🔖 Pre-sealed block for proposal at 3. Hash now 0x01e080f4b8421c95d0033aac7310b36972fdeef7c6025f8a153c436c1bb214ee, previously 0x10bb4589a7a13bac657219a9ff06dcef8d55e46a4275aa287a966b5648a6d486.</span> + <span data-ty>2024-09-10 09:05:12 🏆 Imported #3 (0x774d…a176 → 0x01e0…14ee)</span> + <span data-ty>2024-09-10 09:05:13 💤 Idle (1 peers), best: #3 (0x01e0…14ee), finalized #0 (0x850f…951f), ⬇ 0.6kiB/s ⬆ 0.6kiB/s</span> + <span data-ty>2024-09-10 09:05:18 🏆 Imported #4 (0x01e0…14ee → 0xe176…0430)</span> + <span data-ty>2024-09-10 09:05:18 💤 Idle (1 peers), best: #4 (0xe176…0430), finalized #1 (0x75bb…e82d), ⬇ 0.6kiB/s ⬆ 0.6kiB/s</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output.html b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output.html index 3015ba3fe..4307d2c07 100644 --- a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output.html +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-output.html @@ -1,29 +1,21 @@ -<div id='termynal' data-termynal> - <span data-ty="input"><span class="file-path"></span>./target/release/solochain-template-node \ ---base-path /tmp/alice \ ---chain local \ ---alice \ ---port 30333 \ ---rpc-port 9945 \ ---node-key 0000000000000000000000000000000000000000000000000000000000000001 \ ---validator - </span> - <span data-ty>2024-09-10 08:35:43 Substrate Node</span> - <span data-ty>2024-09-10 08:35:43 ✌️ version 0.1.0-8599efc46ae</span> - <span data-ty>2024-09-10 08:35:43 ❤️ by Parity Technologies <admin@parity.io>, 2017-2024</span> - <span data-ty>2024-09-10 08:35:43 📋 Chain specification: Local Testnet</span> - <span data-ty>2024-09-10 08:35:43 🏷 Node name: Alice</span> - <span data-ty>2024-09-10 08:35:43 👤 Role: AUTHORITY</span> - <span data-ty>2024-09-10 08:35:43 💾 Database: RocksDb at /tmp/alice/chains/local_testnet/db/full</span> - <span data-ty>2024-09-10 08:35:43 🔨 Initializing Genesis block/state (state: 0x074c…27bd, header-hash: 0x850f…951f)</span> - <span data-ty>2024-09-10 08:35:43 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.</span> - <span data-ty>2024-09-10 08:35:43 Using default protocol ID "sup" because none is configured in the chain specs</span> - <span data-ty>2024-09-10 08:35:43 🏷 Local node identity is: 12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp</span> - <span data-ty>2024-09-10 08:35:43 Running libp2p network backend</span> - <span data-ty>2024-09-10 08:35:43 💻 Operating system: macos</span> - <span data-ty>2024-09-10 08:35:43 💻 CPU architecture: aarch64</span> - <span data-ty>2024-09-10 08:35:43 📦 Highest known block at #0</span> - <span data-ty>2024-09-10 08:35:43 〽️ Prometheus exporter started at 127.0.0.1:9615</span> - <span data-ty>2024-09-10 08:35:43 Running JSON-RPC server: addr=127.0.0.1:9945, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]</span> - <span data-ty>2024-09-10 08:35:48 💤 Idle (0 peers), best: #0 (0x850f…951f), finalized #0 (0x850f…951f), ⬇ 0 ⬆ 0</span> -</div> \ No newline at end of file +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>./target/release/solochain-template-node \ --base-path /tmp/alice \ --chain local \ --alice \ --port 30333 \ --rpc-port 9945 \ --node-key 0000000000000000000000000000000000000000000000000000000000000001 \ --validator </span> + <span data-ty>2024-09-10 08:35:43 Substrate Node</span> + <span data-ty>2024-09-10 08:35:43 ✌️ version 0.1.0-8599efc46ae</span> + <span data-ty>2024-09-10 08:35:43 ❤️ by Parity Technologies <admin@parity.io>, 2017-2024</span> + <span data-ty>2024-09-10 08:35:43 📋 Chain specification: Local Testnet</span> + <span data-ty>2024-09-10 08:35:43 🏷 Node name: Alice</span> + <span data-ty>2024-09-10 08:35:43 👤 Role: AUTHORITY</span> + <span data-ty>2024-09-10 08:35:43 💾 Database: RocksDb at /tmp/alice/chains/local_testnet/db/full</span> + <span data-ty>2024-09-10 08:35:43 🔨 Initializing Genesis block/state (state: 0x074c…27bd, header-hash: 0x850f…951f)</span> + <span data-ty>2024-09-10 08:35:43 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.</span> + <span data-ty>2024-09-10 08:35:43 Using default protocol ID "sup" because none is configured in the chain specs</span> + <span data-ty>2024-09-10 08:35:43 🏷 Local node identity is: 12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp</span> + <span data-ty>2024-09-10 08:35:43 Running libp2p network backend</span> + <span data-ty>2024-09-10 08:35:43 💻 Operating system: macos</span> + <span data-ty>2024-09-10 08:35:43 💻 CPU architecture: aarch64</span> + <span data-ty>2024-09-10 08:35:43 📦 Highest known block at #0</span> + <span data-ty>2024-09-10 08:35:43 〽️ Prometheus exporter started at 127.0.0.1:9615</span> + <span data-ty>2024-09-10 08:35:43 Running JSON-RPC server: addr=127.0.0.1:9945, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]</span> + <span data-ty>2024-09-10 08:35:48 💤 Idle (0 peers), best: #0 (0x850f…951f), finalized #0 (0x850f…951f), ⬇ 0 ⬆ 0</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-shutdown.html b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-shutdown.html index f020f8bf2..6500822f7 100644 --- a/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-shutdown.html +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-blockchain/simulate-a-network/node-shutdown.html @@ -1,4 +1,4 @@ -<div id='termynal' data-termynal> - <span data-ty>2024-09-10 09:10:03 💤 Idle (1 peers), best: #51 (0x0dd6…e763), finalized #49 (0xb70a…1fc0), ⬇ 0.7kiB/s ⬆ 0.6kiB/s</span> - <span data-ty>2024-09-10 09:10:08 💤 Idle (0 peers), best: #52 (0x2c40…a50e), finalized #49 (0xb70a…1fc0), ⬇ 0.3kiB/s ⬆ 0.3kiB/s</span> -</div> \ No newline at end of file +<div id="termynal" data-termynal> + <span data-ty>2024-09-10 09:10:03 💤 Idle (1 peers), best: #51 (0x0dd6…e763), finalized #49 (0xb70a…1fc0), ⬇ 0.7kiB/s ⬆ 0.6kiB/s</span> + <span data-ty>2024-09-10 09:10:08 💤 Idle (0 peers), best: #52 (0x2c40…a50e), finalized #49 (0xb70a…1fc0), ⬇ 0.3kiB/s ⬆ 0.3kiB/s</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/genesis-state.md b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/genesis-state.md new file mode 100644 index 000000000..e1feb2742 --- /dev/null +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/genesis-state.md @@ -0,0 +1,5 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>./target/release/parachain-template-node export-genesis-state --chain raw-parachain-chainspec.json para-2000-genesis-state</span> + <span data-ty="progress">2024-09-10 14:41:13 🔨 Initializing Genesis block/state (state: 0xb089…1830, header-hash: 0x6b0b…bd69)</span> + <span data-ty="input"><span class="file-path"></span></span> +</div> \ No newline at end of file diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/parachain-running.md b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/parachain-running.md new file mode 100644 index 000000000..b6011ab9a --- /dev/null +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/parachain-running.md @@ -0,0 +1,14 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>...</span> + <span data-ty>[Relaychain] 💤 Idle (2 peers), best: #90 (0x5f73…1ccf), finalized #87 (0xeb50…68ea), ⬇ 1.4kiB/s ⬆ 1.1kiB/s</span> + <span data-ty>[Parachain] 💤 Idle (0 peers), best: #0 (0x3626…fef3), finalized #0 (0x3626…fef3), ⬇ 1.2kiB/s ⬆ 0.7kiB/s</span> + <span data-ty>[Relaychain] 💤 Idle (2 peers), best: #90 (0x5f73…1ccf), finalized #88 (0xd43c…c3e6), ⬇ 0.7kiB/s ⬆ 0.5kiB/s</span> + <span data-ty>[Parachain] 💤 Idle (0 peers), best: #0 (0x3626…fef3), finalized #0 (0x3626…fef3), ⬇ 1.0kiB/s ⬆ 0.6kiB/s</span> + <span data-ty>[Relaychain] 👶 New epoch 9 launching at block 0x1c93…4aa9 (block slot 281848325 >= start slot 281848325)</span> + <span data-ty>[Relaychain] 👶 Next epoch starts at slot 281848335</span> + <span data-ty>[Relaychain] ✨ Imported #91 (0x1c93…4aa9)</span> + <span data-ty>[Parachain] Starting collation. relay_parent=0x1c936289cfe15fabaa369f7ae5d73050581cb12b75209c11976afcf07f6a4aa9 at=0x36261113c31019d4b2a1e27d062e186f46da0e8f6786177dc7b35959688ffef3</span> + <span data-ty>[Relaychain] 💤 Idle (2 peers), best: #91 (0x1c93…4aa9), finalized #88 (0xd43c…c3e6), ⬇ 1.2kiB/s ⬆ 0.7kiB/s</span> + <span data-ty>[Parachain] 💤 Idle (0 peers), best: #0 (0x3626…fef3), finalized #0 (0x3626…fef3), ⬇ 0.2kiB/s ⬆ 37 B/s</span> + <span data-ty="input"><span class="file-path"></span></span> +</div> \ No newline at end of file diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/raw-chain-spec-terminal.md b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/raw-chain-spec-terminal.md new file mode 100644 index 000000000..d5aecbdec --- /dev/null +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/raw-chain-spec-terminal.md @@ -0,0 +1,7 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>./target/release/parachain-template-node build-spec --chain plain-parachain-chainspec.json --disable-default-bootnode --raw > raw-parachain-chainspec.json</span> + <span data-ty="progress">2024-09-10 14:34:58 Building chain spec</span> + <span data-ty="progress">2024-09-10 14:34:59 assembling new collators for new session 0 at #0</span> + <span data-ty="progress">2024-09-10 14:34:59 assembling new collators for new session 1 at #0</span> + <span data-ty="input"><span class="file-path"></span></span> +</div> \ No newline at end of file diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/start-collator-node.md b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/start-collator-node.md new file mode 100644 index 000000000..09ed9e063 --- /dev/null +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/start-collator-node.md @@ -0,0 +1,19 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>./target/release/parachain-template-node \ + --charlie \ + --collator \ + --force-authoring \ + --chain raw-parachain-chainspec.json \ + --base-path /tmp/charlie-parachain/ \ + --unsafe-force-node-key-generation \ + --port 40333 \ + --rpc-port 8844 \ + -- \ + --chain INSERT_RELAY_CHAIN_PATH/local-raw-spec.json \ + --port 30333 \ + --rpc-port 9946</span> + <span data-ty>2024-09-10 16:26:30 [Parachain] PoV size { header: 0.21875kb, extrinsics: 3.6103515625kb, storage_proof: 3.150390625kb }</span> + <span data-ty>2024-09-10 16:26:30 [Parachain] Compressed PoV size: 6.150390625kb</span> + <span data-ty>2024-09-10 16:26:33 [Relaychain] 💤 Idle (2 peers), best: #1729 (0x3aa4…cb6b), finalized #1726 (0xff7a…4352), ⬇ 9.1kiB/s ⬆ 3.8kiB/s</span> + <span data-ty="input"><span class="file-path"></span></span> +</div> \ No newline at end of file diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-bootstraping-logs.html b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-bootstraping-logs.html new file mode 100644 index 000000000..601dd4443 --- /dev/null +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-bootstraping-logs.html @@ -0,0 +1,21 @@ +<div id="termynal" data-termynal> + <span>2024-09-09 13:49:58 Parity Polkadot</span> + <br /> + <span>2024-09-09 13:49:58 ✌️ version 1.15.2-d6f482d5593</span> + <br /> + <span>2024-09-09 13:49:58 ❤️ by Parity Technologies <admin@parity.io>, 2017-2024</span> + <br /> + <span>2024-09-09 13:49:58 📋 Chain specification: Rococo Local Testnet</span> + <br /> + <span>2024-09-09 13:49:58 🏷 Node name: Alice</span> + <br /> + <span>2024-09-09 13:49:58 👤 Role: AUTHORITY</span> + <br /> + <span>2024-09-09 13:49:58 💾 Database: RocksDb at /tmp/relay/alice/chains/rococo_local_testnet/db/full</span> + <br /> + <span>2024-09-09 13:49:59 🏷 Local node identity is: 12D3KooWG393uX82rR3QgDkZpb7U8StzuRx9BQUXCvWsP1ctgygp</span> + <br /> + <span>2024-09-09 13:49:59 Running libp2p network backend</span> + <br /> + <span>...</span> +</div> diff --git a/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-running-logs.html b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-running-logs.html new file mode 100644 index 000000000..982b8b333 --- /dev/null +++ b/.snippets/code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-running-logs.html @@ -0,0 +1,9 @@ +<div id="termynal" data-termynal> + <span>...</span> + <br /> + <span>2024-09-10 13:29:38 🏆 Imported #55 (0xad6a…567c → 0xecae…ad12)</span> + <br /> + <span>2024-09-10 13:29:38 💤 Idle (1 peers), best: #55 (0xecae…ad12), finalized #0 (0x1cac…618d), ⬇ 2.0kiB/s ⬆ 1.6kiB/s</span> + <br /> + <span>...</span> +</div> diff --git a/.snippets/code/tutorials/tooling/chopsticks/overview/replay-block.json b/.snippets/code/tutorials/tooling/chopsticks/overview/replay-block.json index 21230a01f..3360f1c42 100644 --- a/.snippets/code/tutorials/tooling/chopsticks/overview/replay-block.json +++ b/.snippets/code/tutorials/tooling/chopsticks/overview/replay-block.json @@ -74,10 +74,7 @@ "0x2b06af9719ac64d755623cda8ddd9b94b1c371ded9e9c565e89ba783c4d5f5f9b4def25cfda6ef3a000000006f3d6b177c8acbd8dc9974cdb3cebfac4d31333c30865ff66c35c1bf898df5c5dd2924d3280e7201", "0x9b000000" ], - [ - "0x3a65787472696e7369635f696e646578", - null - ], + ["0x3a65787472696e7369635f696e646578", null], [ "0x3f1467a096bcd71a5b6a0c8155e208103f2edf3bdf381debe331ab7446addfdc", "0x550057381efedcffffffffffffffffff" @@ -146,4 +143,4 @@ "offchainStorageDiff": [], "runtimeLogs": [] } -} \ No newline at end of file +} diff --git a/.snippets/code/tutorials/tooling/chopsticks/overview/terminal/fork-output.html b/.snippets/code/tutorials/tooling/chopsticks/overview/terminal/fork-output.html new file mode 100644 index 000000000..ba045ad8d --- /dev/null +++ b/.snippets/code/tutorials/tooling/chopsticks/overview/terminal/fork-output.html @@ -0,0 +1,29 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>npx @acala-network/chopsticks xcm \</span> + <span data-ty>--r polkadot \</span> + <span data-ty>--p moonbeam \</span> + <span data-ty>--p astar</span> + <br /> + <span data-ty>[13:46:07.901] INFO: Loading config file https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/moonbeam.yml</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty>[13:46:12.631] INFO: Moonbeam RPC listening on port 8000</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty>[13:46:12.632] INFO: Loading config file https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/astar.yml</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty> chopsticks::executor TRACE: Calling Metadata_metadata</span> + <span data-ty> chopsticks::executor TRACE: Completed Metadata_metadata</span> + <span data-ty>[13:46:23.669] INFO: Astar RPC listening on port 8001</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty>[13:46:25.144] INFO (xcm): Connected parachains [2004,2006]</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty>[13:46:25.144] INFO: Loading config file https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/polkadot.yml</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty> chopsticks::executor TRACE: Calling Metadata_metadata</span> + <span data-ty> chopsticks::executor TRACE: Completed Metadata_metadata</span> + <span data-ty>[13:46:53.320] INFO: Polkadot RPC listening on port 8002</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty>[13:46:54.038] INFO (xcm): Connected relaychain 'Polkadot' with parachain 'Moonbeam'</span> + <span data-ty> app: "chopsticks"</span> + <span data-ty>[13:46:55.028] INFO (xcm): Connected relaychain 'Polkadot' with parachain 'Astar'</span> + <span data-ty> app: "chopsticks"</span> +</div> diff --git a/.snippets/code/tutorials/tooling/chopsticks/overview/terminal/fork-output.md b/.snippets/code/tutorials/tooling/chopsticks/overview/terminal/fork-output.md deleted file mode 100644 index 1b14cce7f..000000000 --- a/.snippets/code/tutorials/tooling/chopsticks/overview/terminal/fork-output.md +++ /dev/null @@ -1,29 +0,0 @@ -<div id="termynal" data-termynal> - <span data-ty="input"><span class="file-path"></span>npx @acala-network/chopsticks xcm \ ---r polkadot \ ---p moonbeam \ ---p astar</span> - <br> - <span data-ty>[13:46:07.901] INFO: Loading config file https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/moonbeam.yml</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty>[13:46:12.631] INFO: Moonbeam RPC listening on port 8000</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty>[13:46:12.632] INFO: Loading config file https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/astar.yml</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty> chopsticks::executor TRACE: Calling Metadata_metadata</span> - <span data-ty> chopsticks::executor TRACE: Completed Metadata_metadata</span> - <span data-ty>[13:46:23.669] INFO: Astar RPC listening on port 8001</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty>[13:46:25.144] INFO (xcm): Connected parachains [2004,2006]</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty>[13:46:25.144] INFO: Loading config file https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/polkadot.yml</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty> chopsticks::executor TRACE: Calling Metadata_metadata</span> - <span data-ty> chopsticks::executor TRACE: Completed Metadata_metadata</span> - <span data-ty>[13:46:53.320] INFO: Polkadot RPC listening on port 8002</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty>[13:46:54.038] INFO (xcm): Connected relaychain 'Polkadot' with parachain 'Moonbeam'</span> - <span data-ty> app: "chopsticks"</span> - <span data-ty>[13:46:55.028] INFO (xcm): Connected relaychain 'Polkadot' with parachain 'Astar'</span> - <span data-ty> app: "chopsticks"</span> -</div> \ No newline at end of file diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/base-example.json b/.snippets/code/tutorials/tooling/zombienet/overview/base-example.json index ca336a2c1..306fb2162 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/base-example.json +++ b/.snippets/code/tutorials/tooling/zombienet/overview/base-example.json @@ -4,7 +4,7 @@ "bootnode": false, "provider": "kubernetes", "backchannel": false, - ... + "...": {} }, - ... + "...": {} } diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/base-example.toml b/.snippets/code/tutorials/tooling/zombienet/overview/base-example.toml index fff1b657a..b9d669a28 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/base-example.toml +++ b/.snippets/code/tutorials/tooling/zombienet/overview/base-example.toml @@ -3,6 +3,4 @@ timeout = 1000 bootnode = false provider = "kubernetes" backchannel = false -... - - +# ... diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.json b/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.json index 1547a6791..a0baec8e7 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.json +++ b/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.json @@ -1,18 +1,18 @@ { "parachain": { - "id": 100, - "add_to_genesis": true, - "cumulus_based": true, - "genesis_wasm_path": "/path/to/wasm", - "genesis_state_path": "/path/to/state", - "collators": [ - { - "name": "alice", - "image": "polkadot-parachain", - "command": "polkadot-parachain", - ... - }, - ], + "id": 100, + "add_to_genesis": true, + "cumulus_based": true, + "genesis_wasm_path": "/path/to/wasm", + "genesis_state_path": "/path/to/state", + "collators": [ + { + "name": "alice", + "image": "polkadot-parachain", + "command": "polkadot-parachain", + "...": {} + } + ] }, - ... - } \ No newline at end of file + "...": {} +} diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.toml b/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.toml index 6da7fdc67..efdf82897 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.toml +++ b/.snippets/code/tutorials/tooling/zombienet/overview/collator-example.toml @@ -9,4 +9,4 @@ genesis_state_path = "/path/to/state" name = "alice" image = "polkadot-parachain" command = "polkadot-parachain" -... \ No newline at end of file +# ... diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.json b/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.json index 48aef41b6..598487102 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.json +++ b/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.json @@ -11,9 +11,9 @@ "count": 2, "image": "polkadot-parachain", "command": "polkadot-parachain", - ... - }, - ], + "...": {} + } + ] }, - ... -} \ No newline at end of file + "...": {} +} diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.toml b/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.toml index 01965c726..09a27e87d 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.toml +++ b/.snippets/code/tutorials/tooling/zombienet/overview/collator-groups-example.toml @@ -10,4 +10,4 @@ name = "group-1" count = 2 image = "polkadot-parachain" command = "polkadot-parachain" -... \ No newline at end of file +# ... diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.json b/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.json index 156cc1626..8f7510400 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.json +++ b/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.json @@ -1,11 +1,11 @@ { "parachain": { - "id": 100, - "add_to_genesis": true, - "cumulus_based": true, - "genesis_wasm_path": "/path/to/wasm", - "genesis_state_path": "/path/to/state", - ... + "id": 100, + "add_to_genesis": true, + "cumulus_based": true, + "genesis_wasm_path": "/path/to/wasm", + "genesis_state_path": "/path/to/state", + "...": {} }, - ... -} \ No newline at end of file + "...": {} +} diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.toml b/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.toml index cb96b3579..7858c54c4 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.toml +++ b/.snippets/code/tutorials/tooling/zombienet/overview/parachain-example.toml @@ -4,4 +4,4 @@ add_to_genesis = true cumulus_based = true genesis_wasm_path = "/path/to/wasm" genesis_state_path = "/path/to/state" -... \ No newline at end of file +# ... diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.json b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.json index b9921be50..5b6f5e928 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.json +++ b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.json @@ -1,5 +1,4 @@ { - ..., "relaychain": { "default_command": "polkadot", "default_image": "polkadot-debug:master", @@ -15,7 +14,7 @@ "args": ["--chain", "rococo-local"] } ], - ... + "...": {} }, - ... -} \ No newline at end of file + "...": {} +} diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.toml b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.toml index 04169f5e0..03dd7a9f3 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.toml +++ b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-node-groups.toml @@ -11,4 +11,4 @@ count = 2 image = "polkadot-debug:master" command = "polkadot" args = ["--chain", "rococo-local"] -... \ No newline at end of file +# ... diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.json b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.json index f8cbc14fa..9b3357303 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.json +++ b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.json @@ -1,5 +1,4 @@ { - ..., "relaychain": { "default_command": "polkadot", "default_image": "polkadot-debug:master", @@ -17,8 +16,6 @@ "validator": true, "balance": 1000000000000 } - ], - ... - }, - ... -} \ No newline at end of file + ] + } +} diff --git a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.toml b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.toml index 396668a6a..30e19d435 100644 --- a/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.toml +++ b/.snippets/code/tutorials/tooling/zombienet/overview/relaychain-example-nodes.toml @@ -14,4 +14,4 @@ balance = 1000000000000 name = "bob" validator = true balance = 1000000000000 -... \ No newline at end of file +# ... diff --git a/.snippets/code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/alice-logs.html b/.snippets/code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/alice-logs.html new file mode 100644 index 000000000..9c50e5d1b --- /dev/null +++ b/.snippets/code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/alice-logs.html @@ -0,0 +1,26 @@ +<div id="termynal" data-termynal> + <span data-ty="input"><span class="file-path"></span>tail -f /var/folders/f4/7rdt2m9d7j361dm453cpggbm0000gn/T/zombie-75a01b93c92d571f6198a67bcb380fcd_21724-SEzfCidQ1za4/alice.log </span> + <br /> + <span data-ty>2024-08-29 16:03:54 🙌 Starting consensus session on top of parent 0x81bfcf7de46ca0f5c0eca78639dbfa67afa0a22c7f1a98dfc5778449cb0a82f9</span> + <span data-ty>2024-08-29 16:03:54 🎁 Prepared block for proposing at 11 (1 ms) [hash: 0x4ae2c654439a9be25cedd03fb9a091a5be7b53eae82276850e8c7061cb656d26; parent_hash: 0x81bf…82f9; extrinsics (2): [0x469d…d7d3, 0x8dd2…66e8]</span> + <span data-ty>2024-08-29 16:03:54 🔖 Pre-sealed block for proposal at 11. Hash now 0xb74014d0fcd6df55fbe42848e21ddb556aa5f7358c66795e9a5131f0a666dbbc, previously 0x4ae2c654439a9be25cedd03fb9a091a5be7b53eae82276850e8c7061cb656d26.</span> + <span data-ty>2024-08-29 16:03:54 👶 New epoch 1 launching at block 0xb740…dbbc (block slot 287493039 >= start slot 287493039).</span> + <span data-ty>2024-08-29 16:03:54 👶 Next epoch starts at slot 287493049</span> + <span data-ty>2024-08-29 16:03:54 🏆 Imported #11 (0x81bf…82f9 → 0xb740…dbbc)</span> + <span data-ty>2024-08-29 16:03:54 Node uses the following topology indices index_in_gossip_topology=Some(ValidatorIndex(0)) index_in_parachain_authorities=Some(Active(ValidatorIndex(0)))</span> + <span data-ty>2024-08-29 16:03:57 💤 Idle (2 peers), best: #11 (0xb740…dbbc), finalized #8 (0x2282…6f0d), ⬇ 2.7kiB/s ⬆ 2.1kiB/s</span> + <span data-ty>2024-08-29 16:04:00 🏆 Imported #12 (0xb740…dbbc → 0x49f4…fbd8)</span> + <span data-ty>2024-08-29 16:04:02 💤 Idle (2 peers), best: #12 (0x49f4…fbd8), finalized #9 (0x470a…9184), ⬇ 2.4kiB/s ⬆ 2.1kiB/s</span> + <span data-ty>2024-08-29 16:04:06 🙌 Starting consensus session on top of parent 0x49f420d6d1d84031712f8b7535fdcd73fda740e7a1db6c61c4cf35d8aef9fbd8</span> + <span data-ty>2024-08-29 16:04:06 🎁 Prepared block for proposing at 13 (5 ms) [hash: 0xd5cb11f7ebc5ece3f9a6c304ab5f6209f1ba148c334efc0844e76dd0815b4ff9; parent_hash: 0x49f4…fbd8; extrinsics (2): [0x9e7c…30ff, 0x7e55…1806]</span> + <span data-ty>2024-08-29 16:04:06 🔖 Pre-sealed block for proposal at 13. Hash now 0xa5022ff182095544d5db8714b2c10d81c75d8aff53c53515f22fcd7220ce97d5, previously 0xd5cb11f7ebc5ece3f9a6c304ab5f6209f1ba148c334efc0844e76dd0815b4ff9.</span> + <span data-ty>2024-08-29 16:04:06 🏆 Imported #13 (0x49f4…fbd8 → 0xa502…97d5)</span> + <span data-ty>2024-08-29 16:04:06 ♻️ Reorg on #13,0xa502…97d5 to #13,0xb6c8…5c34, common ancestor #12,0x49f4…fbd8</span> + <span data-ty>2024-08-29 16:04:06 🏆 Imported #13 (0x49f4…fbd8 → 0xb6c8…5c34)</span> + <span data-ty>2024-08-29 16:04:07 💤 Idle (2 peers), best: #13 (0xb6c8…5c34), finalized #10 (0x81bf…82f9), ⬇ 4.0kiB/s ⬆ 4.0kiB/s</span> + <span data-ty>2024-08-29 16:04:11 🥩 New Rounds for validator set id: 1 with session_start 11</span> + <span data-ty>2024-08-29 16:04:11 🥩 Concluded mandatory round #11</span> + <span data-ty>2024-08-29 16:04:12 🏆 Imported #14 (0xb6c8…5c34 → 0xb51a…f125)</span> + <span data-ty>2024-08-29 16:04:12 💤 Idle (2 peers), best: #14 (0xb51a…f125), finalized #11 (0xb740…dbbc), ⬇ 2.8kiB/s ⬆ 3.5kiB/s</span> + ... +</div> diff --git a/.snippets/code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/spawn-a-basic-network-test-output.html b/.snippets/code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/spawn-a-basic-network-test-output.html new file mode 100644 index 000000000..9c0852051 --- /dev/null +++ b/.snippets/code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/spawn-a-basic-network-test-output.html @@ -0,0 +1,74 @@ +<div id="test-results" data-termynal> + <table> + <tr> + <td colspan="2">🛎️ Tests are currently running. Results will appear at the end</td> + </tr> + <tr> + <th colspan="2">Test Results</th> + </tr> + <tr> + <td>8/29/2024, 4:34:53 PM</td> + <td>✅ alice: is up (104ms)</td> + </tr> + <tr> + <td colspan="2">2024-08-29 16:34:54 API/INIT: RPC methods not decorated: chainHead_v1_body, chainHead_v1_call, chainHead_v1_continue, chainHead_v1_follow, chainHead_v1_header, chainHead_v1_stopOperation, chainHead_v1_storage, chainHead_v1_unfollow, chainHead_v1_unpin, chainSpec_v1_chainName, chainSpec_v1_genesisHash, chainSpec_v1_properties, transactionWatch_v1_submitAndWatch, transactionWatch_v1_unwatch, transaction_v1_broadcast, transaction_v1_stop</td> + </tr> + <tr> + <td colspan="2">2024-08-29 16:34:54 API/INIT: rococo/1014000: Not decorating unknown runtime apis: 0x6ff52ee858e6c5bd/1, 0x91b1c8b16328eb92/1, 0x9ffb505aa738d69c/1</td> + </tr> + <tr> + <td>8/29/2024, 4:34:56 PM</td> + <td>✅ alice: parachain 100 is registered within 225 seconds (2362ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:34:58 PM</td> + <td>✅ alice: parachain 100 block height is at least 10 within 250 seconds (2037ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:34:58 PM</td> + <td>✅ bob: is up (43ms)</td> + </tr> + <tr> + <td colspan="2">2024-08-29 16:34:58 API/INIT: RPC methods not decorated: chainHead_v1_body, chainHead_v1_call, chainHead_v1_continue, chainHead_v1_follow, chainHead_v1_header, chainHead_v1_stopOperation, chainHead_v1_storage, chainHead_v1_unfollow, chainHead_v1_unpin, chainSpec_v1_chainName, chainSpec_v1_genesisHash, chainSpec_v1_properties, transactionWatch_v1_submitAndWatch, transactionWatch_v1_unwatch, transaction_v1_broadcast, transaction_v1_stop</td> + </tr> + <tr> + <td colspan="2">2024-08-29 16:34:58 API/INIT: rococo/1014000: Not decorating unknown runtime apis: 0x6ff52ee858e6c5bd/1, 0x91b1c8b16328eb92/1, 0x9ffb505aa738d69c/1</td> + </tr> + <tr> + <td>8/29/2024, 4:35:00 PM</td> + <td>✅ bob: parachain 100 is registered within 225 seconds (2206ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:35:02 PM</td> + <td>✅ bob: parachain 100 block height is at least 10 within 250 seconds (2037ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:35:02 PM</td> + <td>✅ alice: reports node_roles is 4 (0ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:35:02 PM</td> + <td>✅ alice: reports sub_libp2p_is_major_syncing is 0 (0ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:35:02 PM</td> + <td>✅ bob: reports node_roles is 4 (1ms)</td> + </tr> + <tr> + <td>8/29/2024, 4:35:02 PM</td> + <td>✅ collator01: reports node_roles is 4 (22ms)</td> + </tr> + <tr> + <td colspan="2">📓 To see the full logs of the nodes please go to:</td> + </tr> + <tr> + <td colspan="2">/var/folders/f4/7rdt2m9d7j361dm453cpggbm0000gn/T/zombie-68b7ea2539c6ce9ad6350d8a88674147_-90400-wSMnGnsj9Gnu/logs</td> + </tr> + <tr> + <th colspan="2">Result: 10/10</th> + </tr> + <tr> + <td colspan="2">exit code 0</td> + </tr> + </table> +</div> diff --git a/develop/application-devs/interact/.pages b/develop/application-devs/interact/.pages index 0dbe45da2..b0d6c6ac4 100644 --- a/develop/application-devs/interact/.pages +++ b/develop/application-devs/interact/.pages @@ -1,3 +1,4 @@ title: Interact with the Network nav: - index.md + - 'Using Light Clients': 'light-clients.md' diff --git a/develop/application-devs/interact/light-clients.md b/develop/application-devs/interact/light-clients.md new file mode 100644 index 000000000..5fb24c053 --- /dev/null +++ b/develop/application-devs/interact/light-clients.md @@ -0,0 +1,50 @@ +--- +title: Using Light Clients +description: Information about light client options available in the Polkadot ecosystem and how they simplify interactions with the network. +--- +# Using Light Clients + +## Introduction + +Conventionally, applications use a JSON-RPC protocol for communication between a user interface (UI) and a Polkadot SDK-built node with one of the following approaches: + +- **User controlled nodes** - the UI connects to a node client the user has installed on their machine. These nodes are secure, but installation and maintenance of these nodes tend to be an inconvenience + +- **Publicly accessible nodes** - the UI connects to a third-party-owned publicly accessible node client. While these nodes are more prevalent in their usage as they are convenient to use, they are centralized and insecure + +With the advent of light clients, applications no longer have to rely on RPC nodes. Light clients don't sync entire blocks. Instead, they merely verify the finalized network headers. This option provides a cryptographically robust and less resource-intensive way to interact with and ensure the state of the network. Light clients are also available locally and embedded as part of the application, enabling a trustless solution versus running an RPC node. + +<!-- TODO: add link to chain specification when glossary is merged --> +You can use a light client implementation to connect to a Polkadot SDK-based network, both in and outside the browser, as long as a [chain specification]() for that network is available. + +## Light Client Options + +Popular options for Polkadot ecosystem light clients include: + +- The [Polkadot API (PAPI)](https://papi.how/){target=\_blank} integrates [`smoldot`](https://github.com/smol-dot/smoldot){target=\_blank} as a choice of light client for both browser and server-based implementations + +- [Substrate Connect](https://github.com/paritytech/substrate-connect){target=\_blank} is a browser extension and JavaScript library that enables developers to build application-specific light clients for Polkadot SDK chains + +## Light Client Benefits + +A light client allows for all essential features of the chain, such as fetching data and transferring tokens, but it doesn't store a copy of the entire blockchain or require the trust of remote peers. Light clients fetch the needed data from a node with an associated proof to validate the data. + +=== "Full RPC Node" + + - Complete verification of all blocks of the chain + - Holds all the previous block data and the chain's storage in database + - Installation, maintenance, and execution tend to be exhaustive and require system administration expertise + + +=== "Light Client" + + - Only verifies the authenticity of blocks of the chain + - No database + - No need to provision servers or other DevOps-related maintenance, singificantly reducing initialization time from startup + + +## Resources + +Learn more about light clients and how they help you develop on Polkadot: + +- [What is a light client and why you should care?](https://medium.com/paritytech/what-is-a-light-client-and-why-you-should-care-75f813ae2670){target=\_blank} \ No newline at end of file diff --git a/develop/application-devs/tooling/.pages b/develop/application-devs/tooling/.pages index 19e5de2ad..873708359 100644 --- a/develop/application-devs/tooling/.pages +++ b/develop/application-devs/tooling/.pages @@ -3,3 +3,4 @@ nav: - index.md - chopsticks - zombienet + - asset-transfer-api diff --git a/develop/application-devs/tooling/asset-transfer-api/.pages b/develop/application-devs/tooling/asset-transfer-api/.pages new file mode 100644 index 000000000..cb23f4fbd --- /dev/null +++ b/develop/application-devs/tooling/asset-transfer-api/.pages @@ -0,0 +1,6 @@ +title: Asset Transfer API +hide: false +nav: + - index.md + - 'Overview': 'overview.md' + - 'API Reference': 'reference.md' diff --git a/develop/application-devs/tooling/asset-transfer-api/index.md b/develop/application-devs/tooling/asset-transfer-api/index.md new file mode 100644 index 000000000..836f37f56 --- /dev/null +++ b/develop/application-devs/tooling/asset-transfer-api/index.md @@ -0,0 +1,7 @@ +--- +title: Asset Transfer API +description: Asset Transfer API is a library that simplifies the transfer of assets for Substrate based chains. It provides methods for cross-chain and local transfers. +template: subsection-index-page.html +hide: + - feedback +--- diff --git a/develop/application-devs/tooling/asset-transfer-api/overview.md b/develop/application-devs/tooling/asset-transfer-api/overview.md new file mode 100644 index 000000000..9f0d54667 --- /dev/null +++ b/develop/application-devs/tooling/asset-transfer-api/overview.md @@ -0,0 +1,130 @@ +--- +title: Asset Transfer API +description: Asset Transfer API is a library that simplifies the transfer of assets for Substrate-based chains. It provides methods for cross-chain and local transfers. +--- + +# Asset Transfer API + +## Introduction + +[Asset Transfer API](https://github.com/paritytech/asset-transfer-api){target=_blank}, a tool developed and maintained by [Parity](https://www.parity.io/){target=_blank}, is a specialized library designed to streamline asset transfers for Substrate-based blockchains. This API provides a simplified set of methods for users to: + +- Execute asset transfers to other parachains or locally within the same chain +- Facilitate transactions involving system parachains like Asset Hub (Polkadot and Kusama) + +Using this API, developers can manage asset transfers more efficiently, reducing the complexity of cross-chain transactions and enabling smoother operations within the ecosystem. + +For additional support and information, please reach out through [GitHub Issues](https://github.com/paritytech/asset-transfer-api/issues){target=_blank}. + +## Prerequisites + +Before you begin, ensure you have the following installed: + +- [Node.js](https://nodejs.org/en/){target=_blank} (recommended version 21 or greater) +- Package manager - [npm](https://www.npmjs.com/){target=_blank} should be installed with Node.js by default. Alternatively, you can use other package managers like [Yarn](https://yarnpkg.com/){target=_blank} + +## Install Asset Transfer API + +To use `asset-transfer-api`, you need a TypeScript project. If you don't have one, you can create a new one: + +1. Create a new directory for your project: + + ```bash + mkdir my-asset-transfer-project \ + && cd my-asset-transfer-project + ``` + +2. Initialize a new TypeScript project: + + ```bash + npm init -y \ + && npm install typescript ts-node @types/node --save-dev \ + && npx tsc --init + ``` + +Once you have a project set up, you can install the `asset-transfer-api` package: + +```bash +npm install @substrate/asset-transfer-api@{{dependencies.asset_transfer_api.version}} +``` + +!!!note + This documentation covers version `{{dependencies.asset_transfer_api.version}}` of Asset Transfer API. + +## Set Up Asset Transfer API + +To initialize the Asset Transfer API, you need three key components: + +- A Polkadot.js API instance +- The `specName` of the chain +- The XCM version to use + +<!-- You can set up the API in two ways. Choose the option that best fits your project's structure and requirements. Both methods will result in a fully initialized AssetTransferApi instance ready for use: + +### Using an Existing Polkadot.js API + +If you already have an initialized Polkadot.js API instance, you can use it to set up the Asset Transfer API: + +```ts +// Assuming 'api' is your initialized Polkadot.js API instance +const { specName } = await api.rpc.state.getRuntimeVersion(); +const safeXcmVersion = await fetchSafeXcmVersion(api); + +const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion); +``` +--> + +### Using Helper Function from Library + +For a simpler setup process, you can leverage the `constructApiPromise` helper function provided by the library. It not only constructs a Polkadot.js `ApiPromise` but also automatically retrieves the chain's `specName` and fetches a safe XCM version. By using this function, developers can significantly reduce boilerplate code and potential configuration errors, making the initial setup both quicker and more robust. + +<!-- This method automatically initializes the Polkadot.js API, retrieves the specName, and determines the safe XCM version. --> + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/setup.ts' +``` + +!!!note + The code examples are enclosed in an async main function to provide the necessary asynchronous context. However, you can use the code directly if you're already working within an async environment. The key is to ensure you're in an async context when working with these asynchronous operations, regardless of your specific setup. + +## Asset Transfer API Reference + +For detailed information on the Asset Transfer API, including available methods, data types, and functionalities, refer to the [Asset Transfer API Reference](/develop/application-devs/tooling/asset-transfer-api/reference) section. This resource provides in-depth explanations and technical specifications to help you integrate and utilize the API effectively. + +## Examples + +### Relay to System Parachain Transfer + +This example demonstrates how to initiate a cross-chain token transfer from a relay chain to a system parachain. Specifically, 1 WND will be transferred from a Westend (relay chain) account to a Westmint (system parachain) account. + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.ts' +``` + +After running the script, you'll see the following output in the terminal, which shows the call data for the cross-chain transfer and its decoded extrinsic details: + +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/relayToSystem.md' + +### Local Parachain Transfer + +The following example demonstrates a local GLMR transfer within Moonbeam, using the `balances` pallet. It transfers 1 GLMR token from one account to another account, where both the sender and recipient accounts are located on the same parachain. + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.ts' +``` + +Upon executing this script, the terminal will display the following output, illustrating the encoded extrinsic for the cross-chain message and its corresponding decoded format: + +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/localParachainTx.md' + +### Parachain to Parachain Transfer + +This example demonstrates creating a cross-chain asset transfer between two parachains. It shows how to send vMOVR and vBNC from a Moonriver account to a Bifrost Kusama account using the safe XCM version. It connects to Moonriver, initializes the API, and uses the `createTransferTransaction` method to prepare a transaction. + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.ts' +``` + +After running this script, you'll see the following output in your terminal. This output presents the encoded extrinsic for the cross-chain message, along with its decoded format, providing a clear view of the transaction details. + +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/overview/paraToPara.md' \ No newline at end of file diff --git a/develop/application-devs/tooling/asset-transfer-api/reference.md b/develop/application-devs/tooling/asset-transfer-api/reference.md new file mode 100644 index 000000000..5ba57557c --- /dev/null +++ b/develop/application-devs/tooling/asset-transfer-api/reference.md @@ -0,0 +1,266 @@ +--- +title: Asset Transfer API Reference +description: Explore the Asset Transfer API Reference for comprehensive details on methods, data types, and functionalities. Essential for cross-chain asset transfers. +--- + +# Asset Transfer API Reference + +<br> +<div class="grid cards" markdown> +- :octicons-download-16:{ .lg .middle } __Install the Asset Transfer API__ + + --- + + Learn how to install [`asset-transfer-api`](https://github.com/paritytech/asset-transfer-api){target=\_blank} into a new or existing project. + + <br> + [:octicons-arrow-right-24: Get started](../asset-transfer-api/overview.md) + +- :octicons-code-16:{ .lg .middle } __Dive in with a tutorial__ + + --- + + Ready to start coding? Follow along with a step-by-step tutorial. + + <br> + [:octicons-arrow-right-24: How to use the Asset Transfer API](../asset-transfer-api/overview.md/#examples) +</div> +<br> + + +## Asset Transfer API Class + +Holds open an API connection to a specified chain within the `ApiPromise` to help construct transactions for assets and estimate fees. + +For a more in-depth explanation of the Asset Transfer API class structure, check the [source code](https://github.com/paritytech/asset-transfer-api/blob/f2aa50db83882f23492f975221dd5501c35a26d5/src/AssetTransferApi.ts#L106){target=_blank}. + +### Methods + +#### Create Transfer Transaction + +Generates an XCM transaction for transferring assets between chains. It simplifies the process by inferring what type of transaction is required given the inputs, ensuring that the assets are valid, and that the transaction details are correctly formatted. + +After obtaining the transaction, you must handle the signing and submission process separately. + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-fn-signature.ts' +``` + +??? interface "Request parameters" + + `destChainId` ++"string"++ <span class="required" markdown>++"required"++</span> + + ID of the destination chain (`'0'` for relay chain, other values for parachains). + + --- + + `destAddr` ++"string"++ <span class="required" markdown>++"required"++</span> + + Address of the recipient account on the destination chain. + + --- + + `assetIds` ++"string[]"++ <span class="required" markdown>++"required"++</span> + + Array of asset IDs to be transferred. + + When asset IDs are provided, the API dynamically selects the appropriate pallet for the current chain to handle these specific assets. If the array is empty, the API defaults to using the `balances` pallet. + + --- + + `amounts` ++"string[]"++ <span class="required" markdown>++"required"++</span> + + Array of amounts corresponding to each asset in `assetIds`. + + --- + + `opts` ++"TransferArgsOpts<T>"++ + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/transfer-arg-opts.md' + +??? interface "Response parameters" + + ++"Promise<TxResult<T>>"++ + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/tx-result.md' + +??? interface "Example" + + ***Request*** + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-request.ts' + ``` + + ***Response*** + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ctt-example-response.md' + +#### Claim Assets + +Creates a local XCM transaction to retrieve trapped assets. This function can be used to claim assets either locally on a system parachain, on the relay chain, or on any chain that supports the `claimAssets` runtime call. + + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ca-fn-signature.ts' +``` + +??? interface "Request parameters" + + `assetIds` ++"string[]"++ <span class="required" markdown>++"required"++</span> + + Array of asset IDs to be claimed from the `AssetTrap`. + + --- + + `amounts` ++"string[]"++ <span class="required" markdown>++"required"++</span> + + Array of amounts corresponding to each asset in `assetIds`. + + --- + + `beneficiary` ++"string"++ <span class="required" markdown>++"required"++</span> + + Address of the account to receive the trapped assets. + + --- + + `opts` ++"TransferArgsOpts<T>"++ + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/transfer-arg-opts.md' + +??? interface "Response parameters" + + ++"Promise<TxResult<T>>"++ + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/tx-result.md' + +??? interface "Example" + + ***Request*** + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-request.ts' + ``` + + ***Response*** + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ca-example-response.md' + + +#### Decode Extrinsic + +Decodes the hex of an extrinsic into a string readable format. + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/de-fn-signature.ts' +``` + +??? interface "Request parameters" + + `encodedTransaction` ++"string"++ <span class="required" markdown>++"required"++</span> + + A hex encoded extrinsic. + + --- + + `format` ++"T extends Format"++ <span class="required" markdown>++"required"++</span> + + Specifies the format for returning a transaction. + + ??? child "Type `Format`" + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts' + ``` + +??? interface "Response parameters" + + ++"string"++ + + Decoded extrinsic in string readable format. + +??? interface "Example" + + ***Request*** + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-request.ts' + ``` + + ***Response*** + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/de-example-response.md' + +#### Fetch Fee Info + +Fetch estimated fee information for an extrinsic. + +```ts +--8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-fn-signature.ts' +``` + +??? interface "Request parameters" + + `tx` ++"ConstructedFormat<T>"++ <span class="required" markdown>++"required"++</span> + + The constructed transaction. + + ??? child "Type `ConstructedFormat<T>`" + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/constructed-format.md' + + --- + + `format` ++"T extends Format"++ <span class="required" markdown>++"required"++</span> + + Specifies the format for returning a transaction. + + ??? child "Type `Format`" + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/format.ts' + ``` + +??? interface "Response parameters" + + ++"Promise<RuntimeDispatchInfo | RuntimeDispatchInfoV1 | null>"++ + + A promise containing the estimated fee information for the provided extrinsic. + + ??? child "Type `RuntimeDispatchInfo`" + + ```ts + export interface RuntimeDispatchInfo extends Struct { + readonly weight: Weight; + readonly class: DispatchClass; + readonly partialFee: Balance; + } + ``` + + For more information on the underlying types and fields of `RuntimeDispatchInfo`, check the [RuntimeDispatchInfo](https://github.com/polkadot-js/api/blob/2329af239eaf194696daeaa58ebf89f0080a5e0d/packages/types/src/interfaces/payment/types.ts#L21){target=_blank} source code. + + + ??? child "Type `RuntimeDispatchInfoV1`" + + ```ts + export interface RuntimeDispatchInfoV1 extends Struct { + readonly weight: WeightV1; + readonly class: DispatchClass; + readonly partialFee: Balance; + } + ``` + + For more information on the underlying types and fields of `RuntimeDispatchInfoV1`, check the [RuntimeDispatchInfoV1](https://github.com/polkadot-js/api/blob/2329af239eaf194696daeaa58ebf89f0080a5e0d/packages/types/src/interfaces/payment/types.ts#L28){target=_blank} source code. + +??? interface "Example" + + ***Request*** + + ```ts + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-request.ts' + ``` + + ***Response*** + + --8<-- 'code/develop/application-devs/tooling/asset-transfer-api/reference/ffi-example-response.md' \ No newline at end of file diff --git a/develop/application-devs/tooling/chopsticks/overview.md b/develop/application-devs/tooling/chopsticks/overview.md index 7280f860a..a2f5fdd03 100644 --- a/develop/application-devs/tooling/chopsticks/overview.md +++ b/develop/application-devs/tooling/chopsticks/overview.md @@ -226,7 +226,7 @@ npx @acala-network/chopsticks xcm \ After running it, you should see output similar to the following: ---8<-- 'code/tutorials/tooling/chopsticks/overview/terminal/fork-output.md' +--8<-- 'code/tutorials/tooling/chopsticks/overview/terminal/fork-output.html' Now you can interact with your forked chains using the ports specified in the output. diff --git a/develop/application-devs/tooling/zombienet/tutorials/spawn-a-basic-network.md b/develop/application-devs/tooling/zombienet/tutorials/spawn-a-basic-network.md index b9d77f4b4..90c2bc91b 100644 --- a/develop/application-devs/tooling/zombienet/tutorials/spawn-a-basic-network.md +++ b/develop/application-devs/tooling/zombienet/tutorials/spawn-a-basic-network.md @@ -191,7 +191,11 @@ To check the nodes’ logs, you can use the provided command listed by the outpu tail -f /var/folders/f4/7rdt2m9d7j361dm453cpggbm0000gn/T/zombie-75a01b93c92d571f6198a67bcb380fcd_21724-SEzfCidQ1za4/alice.log ``` -After running this command, you will see the logs of the `alice` node in real-time, which can be useful for debugging purposes. The logs of the `bob` and `collator01` nodes can be checked similarly. +After running this command, you will see the logs of the `alice` node in real-time, which can be useful for debugging purposes. The logs will be displayed in the terminal in the following format: + +--8<-- 'code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/alice-logs.html' + +The logs of the `bob` and `collator01` nodes can be checked similarly. ## Running a Test @@ -234,4 +238,6 @@ To run the test, execute the following command: zombienet -p native test spawn-a-basic-network-test.zndsl ``` -This command will execute the test scenario defined in the `spawn-a-basic-network-test.zndsl` file on the network. If successful, the terminal will display the test output, indicating whether the test passed or failed. \ No newline at end of file +This command will execute the test scenario defined in the `spawn-a-basic-network-test.zndsl` file on the network. If successful, the terminal will display the test output, indicating whether the test passed or failed. For example, the following output shows the test results for the basic network: + +--8<-- 'code/tutorials/tooling/zombienet/tutorials/spawn-a-basic-network/spawn-a-basic-network-test-output.html' \ No newline at end of file diff --git a/develop/parachain-devs/get-started/polkadot-sdk/.pages b/develop/parachain-devs/get-started/polkadot-sdk/.pages index 7ad7de401..b49cc167c 100644 --- a/develop/parachain-devs/get-started/polkadot-sdk/.pages +++ b/develop/parachain-devs/get-started/polkadot-sdk/.pages @@ -1,3 +1,4 @@ title: Polkadot SDK nav: - index.md + - 'Install Polkadot SDK Dependencies': install-deps.md diff --git a/develop/parachain-devs/get-started/polkadot-sdk/install-deps.md b/develop/parachain-devs/get-started/polkadot-sdk/install-deps.md new file mode 100644 index 000000000..620c3865f --- /dev/null +++ b/develop/parachain-devs/get-started/polkadot-sdk/install-deps.md @@ -0,0 +1,336 @@ +--- +title: Install Polkadot SDK Dependencies +description: Install everything you need to begin working with Substrated-based blockchains and the Polkadot SDK, the framework for building blockchains. +--- + +# Install Dependencies for the Polkadot SDK + +This guide provides step-by-step instructions for installing the dependencies you need to work with the Polkadot SDK and Substrate-based chains and their required dependencies on macOS, Linux, and Windows. Follow the appropriate section for your operating system to ensure all necessary tools are installed and configured properly. + +## macOS + +You can install Rust and set up a Substrate development environment on Apple macOS computers with Intel or 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 2 GHz. Note that 3 GHz is recommended +- Memory of at least 8 GB RAM. Note that 16 GB is recommended +- Storage of at least 10 GB of available space +- Broadband Internet connection + +#### 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: + + --8<-- 'code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-1.html' + +#### Support for Apple Silicon + +Protobuf must be installed before the build process can begin. To install it, run the following command: + +```bash +brew install protobuf +``` + +### Install Required Packages and Rust + +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. 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 + ``` + +8. Add the `nightly` release and the `nightly` Wasm targets to your development + environment by running the following commands: + + ```bash + rustup update nightly + rustup target add wasm32-unknown-unknown --toolchain nightly + ``` + +9. [Verify your installation](#verifying-installation) + +10. Install `cmake` using the following command: + + ```bash + brew install cmake + ``` + +## 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 {: #before-you-begin-linux } + +Check the documentation for your operating system for information about the installed packages 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 {: #install-required-packages-and-rust-linux } + +To install the Rust toolchain on Linux: + +1. 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 the appropriate package management command for your Linux distribution: + + === "Ubuntu" + + ```bash + sudo apt install --assume-yes git clang curl libssl-dev protobuf-compiler + ``` + + === "Debian" + + ```sh + sudo apt install --assume-yes git clang curl libssl-dev llvm libudev-dev make protobuf-compiler + ``` + + === "Arch" + + ```sh + pacman -Syu --needed --noconfirm curl git clang make protobuf + ``` + + === "Fedora" + + ```sh + sudo dnf update + sudo dnf install clang curl git openssl-devel make protobuf-compiler + ``` + + === "OpenSUSE" + + ```sh + sudo zypper install clang curl git openssl-devel llvm-devel libudev-devel make protobuf + ``` + + 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` 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 your installation](#verifying-installation) + +## Windows (WSL) + +In general, UNIX-based operating systems—like macOS or Linux—provide a better development environment for building Substrate-based blockchains. + +However, suppose your local computer uses Microsoft Windows instead of a UNIX-based operating system. In that case, you can configure it with additional software to make it a suitable development environment for building Substrate-based blockchains. To prepare a development environment on a Microsoft Windows computer, you can use Windows Subsystem for Linux (WSL) to emulate a UNIX operating environment. + +### Before You Begin {: #before-you-begin-windows } + +Before installing on Microsoft Windows, verify the following basic requirements: + +- You have a computer running a supported Microsoft Windows operating system: + - **For Windows desktop** - you must be running Microsoft Windows 10, version 2004 or later, or Microsoft Windows 11 to install WSL + - **For Windows server** - you must be running Microsoft Windows Server 2019, or later, to install WSL on a server operating system +- You have good internet connection and access to a shell terminal on your local computer + +### Set Up Windows Subsystem for Linux + +WSL enables you to emulate a Linux environment on a computer that uses the Windows operating system. The primary advantage of this approach for Substrate development is that you can use all of the code and command-line examples as described in the Substrate documentation. For example, you can run common commands—such as `ls` and `ps`—unmodified. By using WSL, you can avoid configuring a virtual machine image or a dual-boot operating system. + +To prepare a development environment using WSL: + +1. Check your Windows version and build number to see if WSL is enabled by default. + + If you have Microsoft Windows 10, version 2004 (Build 19041 and higher), or Microsoft Windows 11, WSL is available by default and you can continue to the next step. + + If you have an older version of Microsoft Windows installed, see the [WSL manual installation steps for older versions](https://docs.microsoft.com/en-us/windows/wsl/install-manual){target=\_blank}. If you are installing on an older version of Microsoft Windows, you can download and install WLS 2 if your computer has Windows 10, version 1903 or higher + +2. Select **Windows PowerShell** or **Command Prompt** from the **Start** menu, right-click, then **Run as administrator** + +3. In the PowerShell or Command Prompt terminal, run the following command: + + ```bash + wsl --install + ``` + + This command enables the required WSL 2 components that are part of the Windows operating system, downloads the latest Linux kernel, and installs the Ubuntu Linux distribution by default. + + If you want to review the other Linux distributions available, run the following command: + + ```bash + wsl --list --online + ``` + +4. After the distribution is downloaded, close the terminal + +5. Click the **Start** menu, select **Shut down or sign out**, then click **Restart** to restart the + computer. + + Restarting the computer is required to start the installation of the Linux distribution. It can take a few minutes for the installation to complete after you restart. + + For more information about setting up WSL as a development environment, see the [Set up a WSL development environment](https://docs.microsoft.com/en-us/windows/wsl/setup/environment){target=\_blank} docs + +### Install Required Packages and Rust {: #install-required-packages-and-rust-windows } + +To install the Rust toolchain on WSL: + +1. Click the **Start** menu, then select **Ubuntu** + +2. Type a UNIX user name to create user account + +3. Type a password for your UNIX user, then retype the password to confirm it + +4. Download the latest updates for the Ubuntu distribution using the Ubuntu Advanced Packaging Tool (`apt`) by running the following command: + + ```bash + sudo apt update + ``` + +5. Add the required packages for the Ubuntu distribution by running the following command: + + ```bash + sudo apt install --assume-yes git clang curl libssl-dev llvm libudev-dev make protobuf-compiler + ``` + +6. Download the `rustup` installation program and use it to install Rust for the Ubuntu distribution by running the following command: + + ```bash + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + ``` + +7. Follow the prompts displayed to proceed with a default installation + +8. Update your current shell to include Cargo by running the following command: + + ```bash + source ~/.cargo/env + ``` + +9. Verify your installation by running the following command: + + ```bash + rustc --version + ``` + +10. Configure the Rust toolchain to use the latest stable version as the default toolchain by running the following commands: + + ```bash + rustup default stable + rustup update + ``` + +11. Add the `nightly` version of the toolchain and the `nightly` Wasm target to your development environment by running the following commands: + + ```bash + rustup update nightly + rustup target add wasm32-unknown-unknown --toolchain nightly + ``` + +12. [Verify your installation](#verifying-installation) + +## Verifying Installation + +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: + +--8<-- 'code/develop/parachain-devs/get-started/polkadot-sdk/install-deps/termynal-2.html' diff --git a/develop/parachain-devs/interoperability/.pages b/develop/parachain-devs/interoperability/.pages index 8da1565aa..9061876c1 100644 --- a/develop/parachain-devs/interoperability/.pages +++ b/develop/parachain-devs/interoperability/.pages @@ -2,3 +2,4 @@ title: Interoperability nav: - index.md - 'Transfer Assets with XCM': transfer-assets-with-xcm.md + - hrmp-channels diff --git a/develop/parachain-devs/interoperability/hrmp-channels/.pages b/develop/parachain-devs/interoperability/hrmp-channels/.pages new file mode 100644 index 000000000..05df7ec31 --- /dev/null +++ b/develop/parachain-devs/interoperability/hrmp-channels/.pages @@ -0,0 +1,7 @@ +title: HRMP Channels +hide: false +nav: + - index.md + - 'Overview': 'overview.md' + - 'Opening HRMP Channels Between Parachains': 'para-to-para.md' + - 'Opening HRMP Channels with System Parachains': 'para-to-system.md' diff --git a/develop/parachain-devs/interoperability/hrmp-channels/index.md b/develop/parachain-devs/interoperability/hrmp-channels/index.md new file mode 100644 index 000000000..836c4f0f1 --- /dev/null +++ b/develop/parachain-devs/interoperability/hrmp-channels/index.md @@ -0,0 +1,7 @@ +--- +title: HRMP Channels +description: HRMP channels enable cross-chain communication in Polkadot, a temporary solution before the more efficient XCMP protocol is implemented. +template: subsection-index-page.html +hide: + - feedback +--- diff --git a/develop/parachain-devs/interoperability/hrmp-channels/overview.md b/develop/parachain-devs/interoperability/hrmp-channels/overview.md new file mode 100644 index 000000000..26c92d413 --- /dev/null +++ b/develop/parachain-devs/interoperability/hrmp-channels/overview.md @@ -0,0 +1,57 @@ +--- +title: HRMP Channels +description: Discover Horizontal Relay-routed Message Passing (HRMP) channels in Polkadot. Learn how parachains establish and use these channels for interoperability. +--- + +# HRMP Channels + +## Introduction + +Polkadot is designed to enable seamless interoperability between its connected parachains. At the core of this interoperability is the [Cross-Consensus Message Format (XCM)](https://wiki.polkadot.network/docs/learn-xcm), a standard language that allows parachains to communicate and interact with each other. + +The network-layer protocol responsible for delivering XCM-formatted messages between parachains is the Cross-Chain Message Passing (XCMP) protocol. XCMP maintains messaging queues on the relay chain, serving as a bridge to facilitate cross-chain interactions. + +As XCMP is still under development, Polkadot has implemented a temporary alternative called Horizontal Relay-routed Message Passing (HRMP). HRMP offers the same interface and functionality as the planned XCMP but it has a crucial difference, it stores all messages directly in the relay chain’s storage, which is more resource-intensive. + +Once XCMP is fully implemented, HRMP will be deprecated in favor of the native XCMP protocol. XCMP will offer a more efficient and scalable solution for cross-chain message passing, as it will not require the relay chain to store all the messages. + +## Establishing HRMP Channels + +To enable communication between parachains using the HRMP protocol, the parachains must explicitly establish communication channels by registering them on the relay chain. + +Downward and upward channels from and to the relay chain are implicitly available, meaning they do not need to be explicitly opened. + +Opening an HRMP channel requires the parachains involved to make a deposit on the relay chain. This deposit serves a specific purpose, it covers the costs associated with using the relay chain's storage for the message queues linked to the channel. The amount of this deposit varies based on parameters defined by the specific relay chain being used. + +### Relay Chain Parameters + +Each Polkadot relay chain has a set of configurable parameters that control the behavior of the message channels between parachains. These parameters include `hrmpSenderDeposit`, `hrmpRecipientDeposit`, `hrmpChannelMaxMessageSize`, `hrmpChannelMaxCapacity`, and more. + +When a parachain wants to open a new channel, it must consider these parameter values to ensure the channel is configured correctly. + +To view the current values of these parameters in the Polkadot network: + +1. Visit [Polkadot.js Apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot.api.onfinality.io%2Fpublic-ws#/explorer), navigate to the **Developer** dropdown and select the **Chain state** option + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-1.webp) + polkadot-docs/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-1.webp + +2. Query the chain configuration parameters. The result will display the current settings for all the Polkadot network parameters, including the HRMP channel settings + 1. Select **configuration** + 2. Choose the **activeConfig()** call + 3. Click the **+** button to execute the query + 4. Check the chain configuration + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-2.webp) + +### Dispatching Extrinsics + +Establishing new HRMP channels between parachains requires dispatching specific extrinsic calls on the Polkadot relay chain from the parachain's origin. + +The most straightforward approach is to implement the channel opening logic off-chain, then use the XCM pallet's `send` extrinsic to submit the necessary instructions to the relay chain. However, the ability to send arbitrary programs through the `Transact` instruction in XCM is typically restricted to privileged origins, such as the `sudo` pallet or governance mechanisms. + +Parachain developers have a few options for triggering the required extrinsic calls from their parachain's origin, depending on the configuration and access controls defined: + +- **Sudo** - if the parachain has a `sudo` pallet configured, the sudo key holder can use the sudo extrinsic to dispatch the necessary channel opening calls +- **Governance** - the parachain's governance system, such as a council or OpenGov, can be used to authorize the channel opening calls +- **Privileged Accounts** - the parachain may have other designated privileged accounts that are allowed to dispatch the HRMP channel opening extrinsics \ No newline at end of file diff --git a/develop/parachain-devs/interoperability/hrmp-channels/para-to-para.md b/develop/parachain-devs/interoperability/hrmp-channels/para-to-para.md new file mode 100644 index 000000000..e73e1858a --- /dev/null +++ b/develop/parachain-devs/interoperability/hrmp-channels/para-to-para.md @@ -0,0 +1,181 @@ +--- +title: Opening HRMP Channels Between Parachains +description: Learn how to open HRMP channels between parachains on Polkadot. Discover the step-by-step process for establishing uni- and bidirectional communication. +--- + +# Opening HRMP Channels Between Parachains + +## Introduction + +For establishing communication channels between parachains on the Polkadot network using the Horizontal Relay-routed Message Passing (HRMP) protocol, the following steps are required: + +1. **Channel request** - the parachain that wants to open an HRMP channel must make a request to the parachain it wishes to have an open channel with +2. **Channel acceptance** - the other parachain must then accept this request to complete the channel establishment + +This process results in a unidirectional HRMP channel, where messages can flow in only one direction between the two parachains. + +An additional HRMP channel must be established in the opposite direction to enable bidirectional communication. This requires repeating the request and acceptance process but with the parachains reversing their roles. + +Once both unidirectional channels are established, the parachains can send messages back and forth freely through the bidirectional HRMP communication channel. + +## Prerequisites + +Before proceeding, ensure you meet the following requirements: + +- Blockchain network with a relay chain and at least two connected parachains +- Wallet with sufficient funds to execute transactions on the participant chains + +## Procedure for Initiating HRMP Channel Setup + +This example will demonstrate how to open a channel between parachain 2500 and parachain 2600, using Rococo Local as the relay chain. + +### Fund Sender Sovereign Account +<!-- This content will be moved to a new page because it is used in multiple places --> +The [sovereign account](https://github.com/polkadot-fellows/xcm-format/blob/10726875bd3016c5e528c85ed6e82415e4b847d7/README.md?plain=1#L50){target=_blank} for parachain 2500 on the relay chain must be funded so it can take care of any XCM transact fees. + +Use [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank} UI to connect to the relay chain and transfer funds from your account to the parachain 2500 sovereign account. +![](/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-2.webp) + +??? note "Calculating Parachain Sovereign Account" + To generate the sovereign account address for a parachain, you'll need to follow these steps: + + 1. Determine if the parachain is an "up/down" chain (parent or child) or a "sibling" chain: + + - Up/down chains use the prefix `0x70617261` (which decodes to `b"para"`) + + - Sibling chains use the prefix `0x7369626c` (which decodes to `b"sibl"`) + + 2. Calculate the u32 scale encoded value of the parachain ID: + - Parachain 2500 would be encoded as `c4090000` + + 3. Combine the prefix and parachain ID encoding to form the full sovereign account address: + + The sovereign account of parachain 2500 in relay chain will be `0x70617261c4090000000000000000000000000000000000000000000000000000` + and the SS58 format of this address is `5Ec4AhPSY2GEE4VoHUVheqv5wwq2C1HMKa7c9fVJ1WKivX1Y` + + To perform this conversion, you can also use the **"Para ID" to Address** section in [Substrate Utilities](https://www.shawntabrizi.com/substrate-js-utilities/). + +### Create Channel Opening Extrinsic + +1. In Polkadot.js Apps, connect to the relay chain, navigate to the **Developer** dropdown and select the **Extrinsics** option + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-1.webp) + +2. Construct an `hrmpInitOpenChannel` extrinsic call + + 1. Select the **`hrmp`** pallet + 2. Choose the **`hrmpInitOpenChannel`** extrinsic + 3. Fill in the parameters + - **`recipient`** - parachain ID of the target chain (in this case, 2600) + - **`proposedMaxCapacity`** - max number of messages that can be pending in the channel at once + - **`proposedMaxMessageSize`** - max message size that could be put into the channel + 4. Copy the encoded call data + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-2.webp) + The encoded call data for opening a channel with parachain 2600 is `0x3c00280a00000800000000001000`. + +### Crafting and Submitting the XCM Message from the Sender + +To initiate the HRMP channel opening process, you need to create an XCM message that includes the encoded `hrmpInitOpenChannel` call data from the previous step. This message will be sent from your parachain to the relay chain. + +This example uses the `sudo` pallet to dispatch the extrinsic. Verify the XCM configuration of the parachain you're working with and ensure you're using an origin with the necessary privileges to execute the `polkadotXcm.send` extrinsic. + +The XCM message should contain the following instructions: + +- **`WithdrawAsset`** - withdraws assets from the origin's ownership and places them in the Holding Register +- **`BuyExecution`** - pays for the execution of the current message using the assets in the Holding Register +- **`Transact`** - execute the encoded transaction call +- **`RefundSurplus`** - increases the Refunded Weight Register to the value of the Surplus Weight Register, attempting to reclaim any excess fees paid via BuyExecution +- **`DepositAsset`** - subtracts assets from the Holding Register and deposits equivalent on-chain assets under the specified beneficiary's ownership + +!!!note + For more detailed information about XCM's functionality, complexities, and instruction set, refer to the [xcm-format](https://github.com/polkadot-fellows/xcm-format){target=_blank} documentation. + +In essence, this process withdraws funds from the parachain's sovereign account to the XCVM Holding Register, then uses these funds to purchase execution time for the XCM `Transact` instruction, executes `Transact`, refunds any unused execution time and deposits any remaining funds into a specified account. + +To send the XCM message to the relay chain, connect to parachain 2500 in Polkadot.js Apps. Fill in the required parameters as shown in the image below, ensuring that you: + +1. Replace the **`call`** field with your encoded `hrmpInitOpenChannel` call data from the previous step +2. Use the correct beneficiary information +3. Click the **Submit Transaction** button to dispatch the XCM message to the relay chain + +![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-3.webp) + +!!! note + The exact process and parameters for submitting this XCM message may vary depending on your specific parachain and relay chain configurations. Always refer to the most current documentation for your particular network setup. + +After submitting the XCM message to initiate the HRMP channel opening, you should verify that the request was successful. Follow these steps to check the status of your channel request: + +1. Using Polkadot.js Apps, connect to the relay chain and navigate to the **Developer** dropdown, then select the **Chain state** option + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-1.webp) + +2. Query the HRMP open channel requests + 1. Select **`hrmp`** + 2. Choose the **`hrmpOpenChannelRequests`** call + 3. Click the **+** button to execute the query + 4. Check the status of all pending channel requests + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-4.webp) + +If your channel request was successful, you should see an entry for your parachain ID in the list of open channel requests. This confirms that your request has been properly registered on the relay chain and is awaiting acceptance by the target parachain. + +## Procedure for Accepting HRMP Channel + +For the channel to be fully established, the target parachain must accept the channel request by submitting an XCM message to the relay chain. + +### Fund Receiver Sovereign Account + +Before proceeding, ensure that the sovereign account of parachain 2600 on the relay chain is funded. This account will be responsible for covering any XCM transact fees. +To fund the account, follow the same process described in the previous section [Step 1 - Fund Sovereign Account](#step-1---fund-sender-sovereign-account). + +### Create Channel Accepting Extrinsic + +1. In Polkadot.js Apps, connect to the relay chain, navigate to the **Developer** dropdown and select the **Extrinsics** option + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-1.webp) + +2. Construct an `hrmpAcceptOpenChannel` extrinsic call + + 1. Select the **`hrmp`** pallet + 2. Choose the **`hrmpAcceptOpenChannel`** extrinsic + 3. Fill in the parameters: + - **`sender`** - parachain ID of the requesting chain (in this case, 2500) + 4. Copy the encoded call data + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-5.webp) + The encoded call data for accepting a channel with parachain 2500 should be `0x3c01c4090000` + +### Crafting and Submitting the XCM Message from the Receiver + +To accept the HRMP channel opening, you need to create and submit an XCM message that includes the encoded `hrmpAcceptOpenChannel` call data from the previous step. This process is similar to the one described in the previous section's [Step 3 - Crafting and Submitting the XCM Message](#step-3---crafting-and-submitting-the-xcm-message-from-the-sender), with a few key differences: + +- Use the encoded call data for `hrmpAcceptOpenChannel` obtained in Step 2 of this section +- In the last XCM instruction (DepositAsset), set the beneficiary to parachain 2600's sovereign account to receive any surplus funds + +To send the XCM message to the relay chain, connect to parachain 2600 in Polkadot.js Apps. Fill in the required parameters as shown in the image below, ensuring that you: + +1. Replace the **`call`** field with your encoded `hrmpAcceptOpenChannel` call data from the previous step +2. Use the correct beneficiary information +3. Click the **Submit Transaction** button to dispatch the XCM message to the relay chain + +![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-6.webp) + +After submitting the XCM message to accept the HRMP channel opening, verify that the channel has been set up correctly. + +1. Using Polkadot.js Apps, connect to the relay chain and navigate to the **Developer** dropdown, then select the **Chain state** option + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-1.webp) + +2. Query the HRMP channels + 1. Select **`hrmp`** + 2. Choose the **`hrmpChannels`** call + 3. Click the **+** button to execute the query + 4. Check the status of the opened channel + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-7.webp) + +If the channel has been successfully established, you should see the channel details in the query results. + +By following these steps, you will have successfully accepted the HRMP channel request and established a unidirectional channel between the two parachains. + +!!! note + Remember that for full bidirectional communication, you'll need to repeat this process in the opposite direction, with parachain 2600 initiating a channel request to parachain 2500. \ No newline at end of file diff --git a/develop/parachain-devs/interoperability/hrmp-channels/para-to-system.md b/develop/parachain-devs/interoperability/hrmp-channels/para-to-system.md new file mode 100644 index 000000000..a5a19c955 --- /dev/null +++ b/develop/parachain-devs/interoperability/hrmp-channels/para-to-system.md @@ -0,0 +1,105 @@ +--- +title: Opening HRMP Channels with System Parachains +description: Learn how to open HRMP channels with Polkadot system parachains. Discover the process for establishing bi-directional communication using a single XCM message. +--- + +# Opening HRMP Channels with System Parachains + +## Introduction + +While establishing Horizontal Relay-routed Message Passing (HRMP) channels between regular parachains involves a two-step request and acceptance procedure, opening channels with system parachains follows a more straightforward approach. + +System parachains are specialized chains that provide core functionality to the Polkadot network. Examples include Asset Hub for cross-chain asset transfers and Bridge Hub for connecting to external networks. Given their critical role, establishing communication channels with these system parachains has been optimized for efficiency and ease of use. + +Any parachain can establish a bidirectional channel with a system chain through a single operation, requiring just one XCM message from the parachain to the relay chain. + +## Prerequisites + +To successfully complete this process, you'll need to have the following in place: + +- Access to a blockchain network consisting of: + - A relay chain + - A parachain + - An Asset Hub system chain +- A wallet containing enough funds to cover transaction fees on each of the participating chains + +## Procedure for Establishing HRMP Channel + +This guide demonstrates opening an HRMP channel between parachain 2500 and system chain Asset Hub (parachain 1000) on the Rococo Local relay chain. + +### Fund Parachain Sovereign Account +<!-- This content will be moved to a new page because it is used in multiple places --> +The [sovereign account](https://github.com/polkadot-fellows/xcm-format/blob/10726875bd3016c5e528c85ed6e82415e4b847d7/README.md?plain=1#L50){target=_blank} for parachain 2500 on the relay chain must be funded so it can take care of any XCM transact fees. + +Use [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank} UI to connect to the relay chain and transfer funds from your account to the parachain 2500 sovereign account. +![](/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-2.webp) + +??? note "Calculating Parachain Sovereign Account" + To generate the sovereign account address for a parachain, you'll need to follow these steps: + + 1. Determine if the parachain is an "up/down" chain (parent or child) or a "sibling" chain: + + - Up/down chains use the prefix `0x70617261` (which decodes to `b"para"`) + + - Sibling chains use the prefix `0x7369626c` (which decodes to `b"sibl"`) + + 2. Calculate the u32 scale encoded value of the parachain ID: + - Parachain 2500 would be encoded as `c4090000` + + 3. Combine the prefix and parachain ID encoding to form the full sovereign account address: + + The sovereign account of parachain 2500 in relay chain will be `0x70617261c4090000000000000000000000000000000000000000000000000000` + and the SS58 format of this address is `5Ec4AhPSY2GEE4VoHUVheqv5wwq2C1HMKa7c9fVJ1WKivX1Y` + + To perform this conversion, you can also use the **"Para ID" to Address** section in [Substrate Utilities](https://www.shawntabrizi.com/substrate-js-utilities/). + +### Create Establish Channel with System Extrinsic + +1. In Polkadot.js Apps, connect to the relay chain, navigate to the **Developer** dropdown and select the **Extrinsics** option + + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-1.webp) + +2. Construct an `establish_channel_with_system` extrinsic call + + 1. Select the **`hrmp`** pallet + 2. Choose the **`establish_channel_with_system`** extrinsic + 3. Fill in the parameters: + - **`target_system_chain`** - parachain ID of the target system chain (in this case, 1000) + 4. Copy the encoded call data + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-1.webp) + The encoded call data for establishing a channel with system parachain 1000 should be `0x3c0ae8030000` + +### Crafting and Submitting the XCM Message + +Connect to parachain 2500 using Polkadot.js Apps to send the XCM message to the relay chain. Input the necessary parameters as illustrated in the image below. Make sure to: + +1. Insert your previously encoded `establish_channel_with_system` call data into the **`call`** field +2. Provide beneficiary details +3. Dispatch the XCM message to the relay chain by clicking the **Submit Transaction** button +![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-2.webp) + +!!! note + The exact process and parameters for submitting this XCM message may vary depending on your specific parachain and relay chain configurations. Always refer to the most current documentation for your particular network setup. + +After successfully submitting the XCM message to the relay chain, two HRMP channels should be created, establishing bidirectional communication between parachain 2500 and system chain 1000. To verify this, follow these steps: + +1. Using Polkadot.js Apps, connect to the relay chain and navigate to the **Developer** dropdown, then select **Chain state** + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-1.webp) + +2. Query the HRMP channels + 1. Select **`hrmp`** from the options + 2. Choose the **`hrmpChannels`** call + 3. Click the **+** button to execute the query + ![](/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-3.webp) + +3. Examine the query results. You should see output similar to the following: + ```json + --8<-- 'code/develop/parachain-devs/interoperability/hrmp-channels/hrmp-query-output.json' + ``` + +The output confirms the successful establishment of two HRMP channels: + +- From chain 1000 (system chain) to chain 2500 (parachain) +- From chain 2500 (parachain) to chain 1000 (system chain) + +This bidirectional channel enables direct communication between the system chain and the parachain, allowing for cross-chain message passing. \ No newline at end of file diff --git a/images/contributing/vale-output-01.webp b/images/contributing/vale-output-01.webp new file mode 100644 index 000000000..16e9790e1 Binary files /dev/null and b/images/contributing/vale-output-01.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-1.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-1.webp new file mode 100644 index 000000000..05db36743 Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-1.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-2.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-2.webp new file mode 100644 index 000000000..f5191aedb Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/hrmp-channels-2.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-1.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-1.webp new file mode 100644 index 000000000..c5a1932fa Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-1.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-2.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-2.webp new file mode 100644 index 000000000..dc8d4e629 Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/overview/hrmp-overview-2.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-1.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-1.webp new file mode 100644 index 000000000..14aa85ec7 Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-1.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-2.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-2.webp new file mode 100644 index 000000000..d707f19ad Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-2.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-3.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-3.webp new file mode 100644 index 000000000..db1b8cbbc Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-3.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-4.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-4.webp new file mode 100644 index 000000000..632740bea Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-4.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-5.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-5.webp new file mode 100644 index 000000000..e81e13b89 Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-5.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-6.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-6.webp new file mode 100644 index 000000000..45428be23 Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-6.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-7.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-7.webp new file mode 100644 index 000000000..091b94250 Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-para/hrmp-para-to-para-7.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-1.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-1.webp new file mode 100644 index 000000000..8de18a3af Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-1.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-2.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-2.webp new file mode 100644 index 000000000..29f2a7d7c Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-2.webp differ diff --git a/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-3.webp b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-3.webp new file mode 100644 index 000000000..ec72cbcdd Binary files /dev/null and b/images/develop/parachain-devs/interoperability/hrmp-channels/para-to-system/hrmp-para-to-system-3.webp differ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..65b7775ac --- /dev/null +++ b/package-lock.json @@ -0,0 +1,43 @@ +{ + "name": "polkadot-docs", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "polkadot-docs", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@taplo/cli": "^0.7.0", + "husky": "^8.0.0" + } + }, + "node_modules/@taplo/cli": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@taplo/cli/-/cli-0.7.0.tgz", + "integrity": "sha512-Ck3zFhQhIhi02Hl6T4ZmJsXdnJE+wXcJz5f8klxd4keRYgenMnip3JDPMGDRLbnC/2iGd8P0sBIQqI3KxfVjBg==", + "dev": true, + "license": "MIT", + "bin": { + "taplo": "dist/cli.js" + } + }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..0abdd3630 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "polkadot-docs", + "version": "1.0.0", + "description": "This package contains tools to support the development and maintenance of the polkadot-docs repository.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "prepare": "husky install" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@taplo/cli": "^0.7.0", + "husky": "^8.0.0" + } +} diff --git a/tutorials/polkadot-sdk/build-a-parachain/.pages b/tutorials/polkadot-sdk/build-a-parachain/.pages index 84be2a11b..cb44087a8 100644 --- a/tutorials/polkadot-sdk/build-a-parachain/.pages +++ b/tutorials/polkadot-sdk/build-a-parachain/.pages @@ -1,6 +1,5 @@ title: Build a Parachain Tutorials nav: - index.md - - prepare-relay-chain.md - - connect-a-parachain.md - - acquire-a-testnet-slot.md + - 'Prepare Relay Chain': 'prepare-relay-chain.md' + - 'Connect a Parachain': 'connect-a-parachain.md' diff --git a/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain.md b/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain.md index 9d0176470..33a87e34d 100644 --- a/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain.md +++ b/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain.md @@ -81,7 +81,7 @@ To reserve a parachain identifier, follow these steps: 1. Ensure your local relay chain validators are running. For further information, refer to the [Prepare a Local Relay Chain](/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/) tutorial -2. Connect to a local relay chain node using the [Polkadot.Js Apps](https://polkadot.js.org/apps/){target=_blank} interface. If you have followed the [Prepare a Local Relay Chain](/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/) tutorial, you can access the Polkadot.JS Apps interface at `ws://localhost:9944` +2. Connect to a local relay chain node using the [Polkadot.js Apps](https://polkadot.js.org/apps/){target=_blank} interface. If you have followed the [Prepare a Local Relay Chain](/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/) tutorial, you can access the Polkadot.js Apps interface at `ws://localhost:9944` ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-1.webp) @@ -92,7 +92,7 @@ To reserve a parachain identifier, follow these steps: ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-2.webp) 4. Register a parathread - 1. Select the **Prathreads** tab + 1. Select the **Parathreads** tab 2. Click on the **+ ParaId** button ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-3.webp) @@ -168,11 +168,7 @@ To modify the default chain specification, follow these steps: After running the command, you will see the following output: - <div id="termynal" data-termynal> - <span data-ty="progress">2024-09-10 14:34:58 Building chain spec</span> - <span data-ty="progress>2024-09-10 14:34:59 assembling new collators for new session 0 at #0</span> - <span data-ty="progress>2024-09-10 14:34:59 assembling new collators for new session 1 at #0</span> - </div> + --8<-- 'code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/raw-chain-spec-terminal.md' ## Prepare the Parachain Collator @@ -180,9 +176,9 @@ With the local relay chain running and the raw chain specification for the parac To prepare the parachain collator to be registered: -1. Export the WebAssembly runtime for the parachain +1. Export the Wasm runtime for the parachain - The relay chain needs the parachain-specific runtime validation logic to validate parachain blocks. You can export the WebAssembly runtime for a parachain collator node by running a command similar to the following: + The relay chain needs the parachain-specific runtime validation logic to validate parachain blocks. You can export the Wasm runtime for a parachain collator node by running a command similar to the following: ```bash ./target/release/parachain-template-node export-genesis-wasm --chain raw-parachain-chainspec.json para-2000-wasm @@ -198,9 +194,7 @@ To prepare the parachain collator to be registered: After running the command, you will see the following output: - <div id="termynal" data-termynal> - <span data-ty="progress">2024-09-10 14:41:13 🔨 Initializing Genesis block/state (state: 0xb089…1830, header-hash: 0x6b0b…bd69)</span> - </div> + --8<-- 'code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/genesis-state.md' !!!note You should note that the runtime and state you export must be for the genesis block. You can't connect a parachain with any previous state to a relay chain. All parachains must start from block 0 on the relay chain. See [Convert a Solo Chain](https://docs.substrate.io/reference/how-to-guides/parachains/convert-a-solo-chain/){target=\_blank} for details on how the parachain template was created and how to convert the chain logic—not its history or state migrations—to a parachain. @@ -218,52 +212,44 @@ To prepare the parachain collator to be registered: --port 40333 \ --rpc-port 8844 \ -- \ - --chain <INSERT_RELAY_CHAIN_PATH>/local-raw-spec.json \ + --chain INSERT_RELAY_CHAIN_PATH/local-raw-spec.json \ --port 30333 \ --rpc-port 9946 ``` !!! note - Ensure that you replace `<INSERT_RELAY_CHAIN_PATH>` with the path to the raw chain specification for the local relay chain. + Ensure that you replace `INSERT_RELAY_CHAIN_PATH` with the path to the raw chain specification for the local relay chain. After running the command, you will see the following output: - <div id="termynal" data-termynal> - <span>...</span> - <br> - <span>2024-09-10 16:26:30 [Parachain] PoV size { header: 0.21875kb, extrinsics: 3.6103515625kb, storage_proof: 3.150390625kb }</span> - <br> - <span>2024-09-10 16:26:30 [Parachain] Compressed PoV size: 6.150390625kb</span> - <br> - <span>2024-09-10 16:26:33 [Relaychain] 💤 Idle (2 peers), best: #1729 (0x3aa4…cb6b), finalized #1726 (0xff7a…4352), ⬇ 9.1kiB/s ⬆ 3.8kiB/s</span> - <br> - <span>...</span> - </div> + --8<-- 'code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/start-collator-node.md' ## Register With the Local Relay Chain -With the local relay chain and collator node running, you can register the parachain on the local relay chain. In a live public network, registration typically involves a [parachain auction](https://wiki.polkadot.network/docs/learn-auction){target=\_blank}. You can use a Sudo transaction and the Polkadot.Js App interface for this tutorial and local testing. A Sudo transaction lets you bypass the steps required to acquire a parachain or parathread slot; this transaction should be executed in the relay chain. +With the local relay chain and collator node running, you can register the parachain on the local relay chain. In a live public network, registration typically involves a [parachain auction](https://wiki.polkadot.network/docs/learn-auction){target=\_blank}. You can use a Sudo transaction and the Polkadot.js App interface for this tutorial and local testing. A Sudo transaction lets you bypass the steps required to acquire a parachain or parathread slot. This transaction should be executed in the relay chain. To register the parachain, follow these steps: 1. Validate that your local relay chain validators are running -2. Navigate to the **Sudo** tab in the Polkadot.Js Apps interface + +3. Navigate to the **Sudo** tab in the Polkadot.js Apps interface 1. Click on the **Developer** tab 2. Select **Sudo** from the dropdown menu ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-6.webp) 3. Submit a transaction with Sudo privileges - 1. Select the **paraSudoWrapper** pallet - 2. Click on the **sudoScheduleParaInitialize** extrinsic from the list of available extrinsics + 1. Select the **`paraSudoWrapper`** pallet + 2. Click on the **`sudoScheduleParaInitialize`** extrinsic from the list of available extrinsics ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-7.webp) 4. Fill in the required fields - 1. **id** - type the parachain identifier you reserved - 2. **genesisHead** - click the **file upload** button and select the `para-2000-genesis-state` file you exported - 3. **validationCode** - click the **file upload** button and select the `para-2000-wasm` file you exported - 4. **paraKind** - select **Yes** if you are registering a parachain or **No** if you are registering a parathread + 1. **`id`** - type the parachain identifier you reserved + 2. **`genesisHead`** - click the **file upload** button and select the `para-2000-genesis-state` file you exported + 3. **`validationCode`** - click the **file upload** button and select the `para-2000-wasm` file you exported + 4. **`paraKind`** - select **Yes** if you are registering a parachain or **No** if you are registering a parathread + 5. Click on the **Submit Transaction** button ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-8.webp) @@ -272,7 +258,7 @@ To register the parachain, follow these steps: ![](/images/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/connect-a-parachain-9.webp) - After the parachain is initialized, you can see it in **Parachains** section of the Polkadot.Js Apps interface + After the parachain is initialized, you can see it in **Parachains** section of the Polkadot.js Apps interface 6. Click **Network** and select **Parachains** and wait for a new epoch to start @@ -284,31 +270,7 @@ To register the parachain, follow these steps: The terminal where the parachain is running also displays details similar to the following: - <div id="termynal" data-termynal> - <span>...</span> - <br/> - <span>[Relaychain] 💤 Idle (2 peers), best: #90 (0x5f73…1ccf), finalized #87 (0xeb50…68ea), ⬇ 1.4kiB/s ⬆ 1.1kiB/s</span> - <br/> - <span>[Parachain] 💤 Idle (0 peers), best: #0 (0x3626…fef3), finalized #0 (0x3626…fef3), ⬇ 1.2kiB/s ⬆ 0.7kiB/s</span> - <br/> - <span>[Relaychain] 💤 Idle (2 peers), best: #90 (0x5f73…1ccf), finalized #88 (0xd43c…c3e6), ⬇ 0.7kiB/s ⬆ 0.5kiB/s</span> - <br/> - <span>[Parachain] 💤 Idle (0 peers), best: #0 (0x3626…fef3), finalized #0 (0x3626…fef3), ⬇ 1.0kiB/s ⬆ 0.6kiB/s</span> - <br/> - <span>[Relaychain] 👶 New epoch 9 launching at block 0x1c93…4aa9 (block slot 281848325 >= start slot 281848325)</span> - <br/> - <span>[Relaychain] 👶 Next epoch starts at slot 281848335</span> - <br/> - <span>[Relaychain] ✨ Imported #91 (0x1c93…4aa9)</span> - <br/> - <span>[Parachain] Starting collation. relay_parent=0x1c936289cfe15fabaa369f7ae5d73050581cb12b75209c11976afcf07f6a4aa9 at=0x36261113c31019d4b2a1e27d062e186f46da0e8f6786177dc7b35959688ffef3</span> - <br/> - <span>[Relaychain] 💤 Idle (2 peers), best: #91 (0x1c93…4aa9), finalized #88 (0xd43c…c3e6), ⬇ 1.2kiB/s ⬆ 0.7kiB/s</span> - <br/> - <span>[Parachain] 💤 Idle (0 peers), best: #0 (0x3626…fef3), finalized #0 (0x3626…fef3), ⬇ 0.2kiB/s ⬆ 37 B/s</span> - <br/> - <span>...</span> - </div> + --8<-- 'code/tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain/parachain-running.md' ## Resetting the Blockchain State @@ -328,7 +290,7 @@ To reset the blockchain state, follow these steps: ./target/release/parachain-template-node purge-chain --chain raw-parachain-chainspec.json ``` -3. In the terminal where either the alice validator node or the bob validator node is running, press `Control-c` +3. In the terminal where either the `alice` validator node or the `bob` validator node is running, press `Control-c` 4. Purge the local relay chain state by running the following command @@ -339,9 +301,9 @@ To reset the blockchain state, follow these steps: After purging the chain state, you can restart the local relay chain and parachain collator nodes to begin with a clean environment. !!! note - Note that in order to reset the network state and allow all the nodes to sync after the reset, each of them needs to purge their databases. Otherwise, the nodes will not be able to sync with each other effectively. + Note that to reset the network state and allow all the nodes to sync after the reset, each of them needs to purge their databases. Otherwise, the nodes won't be able to sync with each other effectively. Now that you have successfully connected a parachain to a relay chain, you can explore more advanced features and functionalities of parachains, such as: -- [Openning HRMP Channels](TODO:update-path){target=\_blank} +- [Opening HRMP Channels](TODO:update-path){target=\_blank} - [Transfer Assets Between Parachains](TODO:update-path){target=\_blank} \ No newline at end of file diff --git a/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain.md b/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain.md index 4ea547a76..631b8f961 100644 --- a/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain.md +++ b/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain.md @@ -129,7 +129,7 @@ To start the validator nodes, follow these steps: 3. Review log messages as the node starts and take note of the `Local node identity` value. This value is the node’s peer ID, which you need to connect the parachain to the relay chain - --8<-- "code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-bootstraping-logs.md" + --8<-- "code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-bootstraping-logs.html" !!! note You need to specify this identifier to enable other nodes to connect. In this case, the `Local node identity` is `12D3KooWG393uX82rR3QgDkZpb7U8StzuRx9BQUXCvWsP1ctgygp`. @@ -161,6 +161,6 @@ To start the validator nodes, follow these steps: 5. Verify that the relay chain nodes are running by checking the logs for each node. The logs should show that the nodes are connected to each other and producing blocks. For example, Bob's logs will be displayed as follows: - --8<-- "code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-running-logs.md" + --8<-- "code/tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain/relay-chain-running-logs.html" Once the relay chain nodes are running, you can proceed to the next tutorial to set up a test parachain node and connect it to the relay chain. \ No newline at end of file