Skip to content

Commit

Permalink
feat: add archive node for relay chain (#189)
Browse files Browse the repository at this point in the history
* docs: update README.md

* chore: added config

* feat: add archive node for relay chain

* docs: update README.md
  • Loading branch information
Riya Singh authored Jan 22, 2024
1 parent c8f3ef9 commit 51d5b3f
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 55,186 deletions.
127 changes: 24 additions & 103 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![HugoByte](img/hugobyte_logo.jpeg)
![HugoByte](img/hugobyte_logo.png)

**Empower your Polkadot development with the Polkadot-kurtosis-package, an all-in-one solution for effortlessly spawning relay chains and parachains. Dive into a world of efficiency, reliability, and innovation, all meant to enhance your Polkadot experience. Welcome to the future of decentralized possibilities! Remember, the key to our existence is to distribute, decentralize, and democratize.**

Expand All @@ -11,10 +11,10 @@
- [Kusama](#kusama)
- [Parachains](#parachains)
- [Explorer](#explorer)
- [Setup and Requirements](#setup-and-requirements)
- [Prerequisites](#prerequisites)
- [Integrated Parachains Within the Polkadot-kurtosis-package](#integrated-parachains-within-the-polkadot-kurtosis-package)
- [Overall List of Integrated Parachains](#overall-list-of-integrated-parachains)
- [Parachains Supported in Local](#parachains-supported-in-local)
- [Parachains Supported in Localnet](#parachains-supported-in-localnet)
- [Parachains Supported in Testnet](#parachains-supported-in-testnet)
- [Parachains Supported in Mainnet](#parachains-supported-in-mainnet)
- [Configuration File Guidelines](#configuration-file-guidelines)
Expand All @@ -39,7 +39,9 @@

# Introduction

Polkadot-kurtosis-package is a tool built leveraging the power of Kurtosis, a developer platform for packaging and launching environments. This tool simplifies the process of setting up various local, testnet, and mainnet network configurations and scenarios for Polkadot and Kusama parachains.
Polkadot-kurtosis-package is a tool built leveraging the power of Kurtosis, a developer platform for packaging and launching environments. This tool simplifies the process of setting up various localnet, testnet, and mainnet network configurations and scenarios for Polkadot and Kusama parachains.

### Polkadot-kurtosis-package made easy with DIVE CLI! Click [here](https://github.com/HugoByte/DIVE) to know more.

## About

Expand Down Expand Up @@ -69,7 +71,7 @@ The Polkadot JS Explorer is a web-based application that serves as a comprehensi

You can access the explorer [here](https://polkadot.js.org/).

## Setup and Requirements
## Prerequisites

Ensure the following prerequisites are met before using the Polkadot-kurtosis-package:
- [Docker](https://www.docker.com/): Make sure Docker is installed on your machine. You can [install it here](https://www.docker.com/).
Expand All @@ -82,92 +84,11 @@ A list of all the parachains supported by the package and the environments they

## Overall List of Integrated Parachains

<center>
<table border="1">
<tr>
<th>Polkadot</th>
<th>Kusama</th>
</tr>
<tr>
<td>acala</td>
<td>altair</td>
</tr>
<tr>
<td>ajuna</td>
<td>bajun</td>
</tr>
<tr>
<td>bifrost</td>
<td>bifrost</td>
</tr>
<tr>
<td>centrifuge</td>
<td>calamari</td>
</tr>
<tr>
<td>clover</td>
<td>encointer</td>
</tr>
<tr>
<td>frequency</td>
<td>karura</td>
</tr>
<tr>
<td>kilt</td>
<td>khala</td>
</tr>
<tr>
<td>kylin</td>
<td>integritee</td>
</tr>
<tr>
<td>litentry</td>
<td>litmus</td>
</tr>
<tr>
<td>manta</td>
<td>mangata</td>
</tr>
<tr>
<td>moonbeam</td>
<td>moonriver</td>
</tr>
<tr>
<td>moonsama</td>
<td>robonomics</td>
</tr>
<tr>
<td>nodle</td>
<td>subzero</td>
</tr>
<tr>
<td>parallel</td>
<td>turing</td>
</tr>
<tr>
<td>pendulum</td>
<td></td>
</tr>
<tr>
<td>phala</td>
<td></td>
</tr>
<tr>
<td>polkadex</td>
<td></td>
</tr>
<tr>
<td>subsocial</td>
<td></td>
</tr>
<tr>
<td>zeitgeist</td>
<td></td>
</tr>
</table>
</center>

## Parachains Supported in Local:
- **For Polkadot:** acala, ajuna, bifrost, centrifuge, clover, frequency, kilt, kylin, litentry, manta, moonbeam, moonsama, nodle, parallel, pendulum, phala, polkadex, subsocial, zeitgeist

- **For Kusama:** altair, bajun, bifrost, calamari, encointer, karura, khala, integritee, litmus, mangata, moonriver, robonomics, subzero, turing

## Parachains Supported in Localnet:

- **For Polkadot:** acala, ajuna, bifrost, centrifuge, clover, frequency, kilt, kylin, litentry, manta, moonbeam, moonsama, nodle, parallel, pendulum, phala, polkadex, subsocial, zeitgeist

Expand Down Expand Up @@ -237,7 +158,7 @@ To use the Polkadot-kurtosis-package, you need to create a configuration file sp

## Configuration Fields:

- **chain_type:** Specifies the type of the network (e.g., "local","testnet", "mainnet").
- **chain_type:** Specifies the type of the network (e.g., "localnet","testnet", "mainnet").
- **relaychain:** Configuration for the relay chain. (When chain_type is "testnet" or "mainenet", the "relaychain" can be an empty dictonary).
- **name:** Name of the relay chain (e.g., "rococo-local", "rococo", "polkadot" or "kusama").
- **nodes:** List of nodes on the relay chain, each with:
Expand All @@ -256,17 +177,17 @@ Feel free to modify this example configuration file based on your specific netwo

## Possible Values for Configuration Fields:

- **chain_type:** local, mainnet, testnet
- **chain_type:** localnet, mainnet, testnet
- **relaychain name:**
- for local: rococo-local
- for localnet: rococo-local
- for testnet: rococo, westend
- for mainnet: polkadot, kusama
- **node_type:**
- for relaychain: validator, full
- for relaychain: validator, full, archive
- for parachain: collator, full
- **parachain name:**
- for polkadot: any valid parachain for polkadot from [this list](#integrated-parachains)
- for kusama: any valid parachain for kusama from [this list](#integrated-parachains)
- for polkadot: any valid parachain for polkadot from [this list](#overall-list-of-integrated-parachains)
- for kusama: any valid parachain for kusama from [this list](#overall-list-of-integrated-parachains)
- **prometheus:** true or false
- **explorer:** true or false
- **node-name:** any
Expand Down Expand Up @@ -369,7 +290,7 @@ Consider this sample config file:

```json
{
"chain_type": "local",
"chain_type": "localnet",
"relaychain": {
"name": "rococo-local",
"nodes": [
Expand Down Expand Up @@ -411,35 +332,35 @@ You should also get the **user services** from kurtosis as follows:

![User Services](img/user_services.png)

The service name 'frequency-alice-local' contains the details of the 'frequency' parachain node and the service names 'rococo-local-alice' and 'rococo-local-bob' contain the details of the relay chain nodes. Each node has its own service name and service details.
The service name 'frequency-alice-localnet' contains the details of the 'frequency' parachain node and the service names 'rococo-local-alice' and 'rococo-local-bob' contain the details of the relay chain nodes. Each node has its own service name and service details.

The 'polkadot-js-explorer' service contains the details of the explorer.

The 'prometheus' and 'grafana' services contain the details of required metrics.

# Using Explorer with Service Details

To use the explorer with the service details, open the given endpoint for 'polkadot-js-explorer' in the **user services**. In this case, it would be: 'http://127.0.0.1:32970'
To use the explorer with the service details, open the given endpoint for 'polkadot-js-explorer' in the **user services**. In this case, it would be: 'http://127.0.0.1:80'

A page like this should open:

![Polkadot js explorer](img/polkadot_js_explorer.png)

Click on the orange icon next to unknown. This should open a side-menu. Click on Development and replace the custom endpoint port with the port of the node for which you would like to view the explorer details.

You can find the node in the **user services**. For example, consider port 32964. After passing the port in custom endpoint, your page should look like this:
You can find the node in the **user services**. For example, consider port 33131. After passing the port in custom endpoint, your page should look like this:

![Explorer](img/explorer.png)

# Using Grafana with Service Details

Grafana is automatically enabled when prometheus for any node is given as true. To use the grafana with the service details, open the given endpoint for 'grafana' in the **user services**. In this case, it would be: 'http://127.0.0.1:32969'
Grafana is automatically enabled when prometheus for any node is given as true. To use the grafana with the service details, open the given endpoint for 'grafana' in the **user services**. In this case, it would be: 'http://127.0.0.1:33136'

A page like this should open:

![Grafana](img/grafana.png)

Click on Data Sources, select Prometheus. In Connection field, enter the endpoint given in 'prometheus' service in **service details**. In this case it would be 'http://172.16.0.13:9090'. Scroll down and click on *save and test*.
Click on Data Sources, select Prometheus. In Connection field, enter the endpoint given in 'prometheus' service in **service details**. In this case it would be 'http://172.16.0.12:9090'. Scroll down and click on *save and test*.

Now, open the side menu and click on *Dashboards*. Click on *Create Dashboard* and then *import dashboard*. Type `13759` in the *Find and import dashboards for common applications* field and click on Load. You can also use your custom dashboards here.

Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"chain_type": "local",
"chain_type": "localnet",
"relaychain": {
"name": "rococo-local",
"nodes": [
Expand Down
Binary file modified img/explorer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/hugobyte_logo.jpeg
Binary file not shown.
Binary file added img/hugobyte_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/service_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/user_services.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ explorer_js = import_module("./package_io/polkadot_js_app.star")
utils = import_module("./package_io/utils.star")
constant = import_module("./package_io/constant.star")

def run(plan, chain_type = "local", relaychain = None, parachains = None, explorer = False):
def run(plan, chain_type = "localnet", relaychain = None, parachains = None, explorer = False):
"""
Main function to run the Polkadot relay and parachain setup.
Args:
chain_type (string): The type of chain (local, testnet or mainnet). Default is local.
chain_type (string): The type of chain (localnet, testnet or mainnet). Default is localnet.
relaychain (json): A json object containing data for relay chain config.
- name (string): Name of relay chain.
- nodes (json): A json object containing node details.
Expand All @@ -39,7 +39,7 @@ def run_polkadot_setup(plan, chain_type, relaychain, parachains, explorer):
Main function to run the Polkadot relay and parachain setup.
Args:
chain_type (string): The type of chain (local, testnet or mainnet). Default is local.
chain_type (string): The type of chain (localnet, testnet or mainnet). Default is localnet.
relaychain (json): A json object containing data for relay chain config.
- name (string): Name of relay chain.
- node (json): A json object of node details.
Expand All @@ -64,7 +64,7 @@ def run_polkadot_setup(plan, chain_type, relaychain, parachains, explorer):

service_details = {}

if chain_type == "local":
if chain_type == "localnet":
relay_chain_details = relay_chain.start_relay_chains_local(plan, relaychain)
polkadot_service_name = None
for key in relay_chain_details:
Expand Down
6 changes: 3 additions & 3 deletions package_io/utils.star
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def get_service_url(protocol ,ip_address, ports):

def check_config_validity(plan, chain_type, relaychain, parachains):

if chain_type != "local" and chain_type != "mainnet" and chain_type != "testnet":
if chain_type != "localnet" and chain_type != "mainnet" and chain_type != "testnet":
return fail("Invalid chain type")

if chain_type == "local" and relaychain == {}:
if chain_type == "localnet" and relaychain == {}:
return fail("relay config must be present for localnet")

if relaychain != {}:
Expand All @@ -56,7 +56,7 @@ def check_config_validity(plan, chain_type, relaychain, parachains):
elif chain_type == "mainnet":
if chain_name != "polkadot" and chain_name != "kusama":
return fail("Please provide polkadot or kusama as relaychain for mainnet")
elif chain_type == "local":
elif chain_type == "localnet":
if chain_name != "rococo-local":
return fail("Please provide rococo-local as relaychain for localnet")
elif len(relay_nodes) < 2:
Expand Down
8 changes: 4 additions & 4 deletions parachain/parachain.star
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def start_local_parachain_node(plan, chain_type, parachain, para_id):
Start local parachain nodes based on configuration.
Args:
chain_type (string): The type of chain (local, testnet or mainnet).
chain_type (string): The type of chain (localnet, testnet or mainnet).
parachains (dict): A dict containing data for para chain config.
para_id (int): Parachain ID.
Expand Down Expand Up @@ -41,7 +41,7 @@ def start_local_parachain_node(plan, chain_type, parachain, para_id):
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --rpc-port=9946 --port=30333 --rpc-external --rpc-cors=all --prometheus-external --{2} --collator --rpc-methods=unsafe --force-authoring --execution=wasm --trie-cache-size=0 -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"]),
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --rpc-port=9946 --port=30333 --rpc-external --rpc-cors=all --prometheus-external --{2} --collator --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"]),
]

build_file = raw_service.name
Expand All @@ -68,7 +68,7 @@ def start_nodes(plan, chain_type, parachains, relay_chain_ip):
Start multiple parachain nodes.
Args:
chain_type (string): The type of chain (local, testnet or mainnet).
chain_type (string): The type of chain (localnet, testnet or mainnet).
parachains (list): A list containing data for para chain config.
relay_chain_ip (string): IP address of the relay chain.
Expand All @@ -90,7 +90,7 @@ def run_testnet_mainnet(plan, chain_type, relaychain_name, parachain):
Run a testnet or mainnet based on configuration.
Args:
chain_type (string): The type of chain (local, testnet or mainnet).
chain_type (string): The type of chain (localnet, testnet or mainnet).
relaychain_name (string): The name of relay chain.
parachain (dict): A dict containing data for para chain config.
Expand Down
143 changes: 0 additions & 143 deletions parachain/static_files/configs/acala-raw.json

This file was deleted.

75 changes: 0 additions & 75 deletions parachain/static_files/configs/bajun-raw.json

This file was deleted.

168 changes: 0 additions & 168 deletions parachain/static_files/configs/bifrost-k-rococo.json

This file was deleted.

Loading

0 comments on commit 51d5b3f

Please sign in to comment.