Skip to content

Commit

Permalink
update content
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Oct 2, 2024
1 parent 7c85207 commit 767639e
Show file tree
Hide file tree
Showing 27 changed files with 264 additions and 21 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added docs/.DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions docs/contact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_label: "Contact"
sidebar_position: 7
---

# Contact Us

For feedback, bug report, request, or general Subnet discussion please feel free to make a post on [XDC Forum](https://forum.xinfin.org/) or [GitHub Issues](https://github.com/XinFinOrg/XDC-Subnet/issues)


For troubleshooting, you can talk to us at [Telegram Support Group](./deployment/3_troubleshooting.md#telegram-troubleshooting-support-group) and we will check as soon as possible.
13 changes: 11 additions & 2 deletions docs/deployment/1_launch_subnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ sidebar_position: 1
- https://faucet.apothem.network/
- https://faucet.blocksscan.io/

## Video Walkthrough

## Generate Subnet Configs With UI

1. Pull `generator.sh` script from the generator Github repo
Expand All @@ -34,7 +36,14 @@ sidebar_position: 1
cd generated
```

3. Go to [http://localhost:3000/](http://localhost:3000) in your browser. If you are running the generator on a remote server you can first use ssh tunnel: `ssh -N -L localhost:3000:localhost:3000 <username>@<ip_address> -i <private_key_file>`
3. Go to [http://localhost:5210/](http://localhost:5210) in your browser.
<details>
<summary>If you are running this on a remote server.</summary>
<p>
first use ssh tunnel: <code>ssh -N -L localhost:5210:localhost:5210 USERNAME@IP_ADDRESS -i SERVER_KEY_FILE</code>
</p>
</details>


4. Config the Subnet options per your requirement.
![UI](./img/ui.png)
Expand All @@ -45,7 +54,7 @@ sidebar_position: 1
- deploy XDC-Zero (optional)
- start Subnet Services (relayer, stats-server, frontend)

6. Once successfully deployed, you can check out [UI usage guide](./../usage/1_homepage.md)
6. Once successfully deployed, you can check out [UI usage guide](../usage/ui/1_homepage.md)

## Removing Subnet

Expand Down
94 changes: 94 additions & 0 deletions docs/deployment/2_configs_explanation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
sidebar_label: "2. Configs Explanation"
sidebar_position: 2
---

# Configs Explanation

## Files under 'generated' directory
After the generator has succesfully run, all generated files will be under 'generated' directory. These files can be edited if you would like to further customize your subnet. Below is a description of each generated file and how it is used.

- commands.txt - The generated instructions to launch the subnet.
- common.env - The config parameters for Subnet services.
- contract_deploy.env - The config file used for CSC deployment.
- subnet*.env - The config parameters for each Subnet node.
- genesis.json - The 'block 0' of the Subnet. Initializes the blockchain for subnet nodes.
- genesis_input.yml - An intermediate file used in config generation.
- keys.json - Generated keypairs or custom keypairs by user input. Please be mindful to keep the credentials secure.
- docker-compose.yml - The main deployment file. Includes docker images versions, startup commands, network configurations.
- docker-compose.env - The config injection path that docker uses to point to other *.env files.

### common.env
- PARENTNET_URL - RPC of the parentnet
- SUBNET_URL - RPC of the Subnet
- PARENTNET_WALLET - Public key of the Relayer wallet
- PARENTNET_WALLET_PK - Private key of the Relayer wallet
- VITE_SUBNET_URL - URL of stats server backend that is passed to your local browser
- VITE_SUBNET_RPC - URL of the Subnet RPC that is passed to your local browser
- CHECKPOINT_CONTRACT - Checkpoint Smart Contract address
- STATS_SECRET - Secret used by stats server backend
- EXTIP - Configured IP of bootnode
- BOOTNODE_PORT - Configured port of bootnode

### subnet*.env
- INSTANCE_NAME - Subnet node name
- PRIVATE_KEY - Subnet node private key
- BOOTNODES - Subnet bootnode to connect and discover other Subnet nodes
- NETWORK_ID - Subnet network ID
- SYNC_MODE - Node operation mode (full or archive)
- RPC_API - enabled api's scheme such as eth, xdpos, debug, net
- STATS_SERVICE_ADDRESS - Stats server backend URL
- STATS_SECRET - Secret to authenticate with Stats server
- PORT - Subnet node port for communication with other Subnet nodes
- RPCPORT - Subnet node port for accepting RPC calls
- WSPORT - Subnet node port for accepting Websocket connections
- LOG_LEVEL - Desired logging level. 2=Warn, 3=Info, 4=Debug.



## Subnet Ports
1. Subnet Nodes - 3 ports are used per each subnet, RPC port, WS port, and Peering port. The port number is incremented by 1 for the next subnet node. For example subnet1's RPC is 8545, subnet2's RPC will be 8546 and so on.
- RPC PORT - 8545, 8546, 8547, ... This is the API port, for outside chain communication to issue transaction or query chaindata.
- WS PORT - 9555, 9556, 9557, ... This is not used currently.
- Peering port - 20303, 20304, 20305, ... This is used for subnet nodes and bootnode peering and communication.
- Subnet ports config can be changed in `subnetX.env` for each individual subnet.
2. Bootnode - port 20301
- Bootnode port can be changed at `BOOTNODE_PORT` under `common.env`. Also in each `subnetX.env`, `BOOTNODES` port has to be changed.
3. Stats Server (UI backend) - port 5213.
4. UI Frontend - port 5214.
5. Relayer UI - port 5215.
6. Faucet Server - port 5211
7. Generator UI - port 5210.
<!-- 7. Explorer UI - port -->


## Updating Configs
### Upgrading Subnet Deployment
#### Create a Subnet backup
1. [Shutdown the subnet](./1_launch_subnet.md#shutdown-subnet )

2. Make a copy of `xdcchain` directory

#### Update Subnet Versions
1. Go to `docker-compose.yml` under `generated` directory.
2. Change the docker image tag of your desired component(s).
3. Run:
```
docker compose --env-file docker-compose.env --profile machine1 up -d
docker compose --env-file docker-compose.env --profile services up -d
```

Using `latest` tag is not recommended since not all components version are not guaranteed to be compatible.

### Updating Services Configs
1. Shut down subnet services
```
docker compose --env-file docker-compose.env --profile services down
```
2. Update configuration (usually ENVs inside common.env file)

3. Start subnet services
```
docker compose --env-file docker-compose.env --profile services up -d
```

7 changes: 0 additions & 7 deletions docs/deployment/2_faq.md

This file was deleted.

32 changes: 27 additions & 5 deletions docs/deployment/3_troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
---
sidebar_label: "3. Troubleshooting"
sidebar_label: "3. Common Issues and Troubleshooting"
sidebar_position: 3
---

# Debug guide (how to know if my subnet is running?)
## Common Issues
# Common Issues and Troubleshooting

1. Subnet node does not boot with error log `Fatal: Error starting protocol stack: listen unix /work/xdcchain/XDC.ipc: bind: invalid argument`
## Common Issues
- Subnet blocks are not being mined.
1. First confirm that the Subnet nodes are able to communicate with each other through the network layer. Run the check peer script `generated/scripts/check-peers.sh` the number of peers should be one less than number of subnet nodes. For example, if there are 3 Subnet nodes in total, each node should have 2 peers.

2. If the nodes are peering but still not mining, it could be a low memory issue. In Docker configs you can try to increase memory or swap. Then, in case of fresh Subnet, [delete data and start the nodes again](./1_launch_subnet.md/#deleting-subnet). ![Docker Memory Config](./img/docker_mem.png)

3. Docker engine in Mac OS can be inconsistent after long-running or high-load. It could help to restart the machine and [hard reset the subnet](./1_launch_subnet.md#deleting-subnet ) to get it running.

- Subnet node does not boot with error log `Fatal: Error starting protocol stack: listen unix /work/xdcchain/XDC.ipc: bind: invalid argument`

This is due to the volume mount path being too long. The mounth path is your current directory (also can check with `pwd` command). Please move the `generated` folder to a shorter path and try again.

2. Docker image startup fails with `SIGKILL` or `Error code: 137` found in logs. (Issue found in Frontend image)
- Docker image startup fails with `SIGKILL` or `Error code: 137` found in logs. (Issue found in Frontend image)

This error occurs because Docker ran Out Of Memory (OOM). You can increase the memory limit in [Docker settings](https://docs.docker.com/desktop/settings/mac/#:~:text=lower%20the%20number.-,Memory,-.%20By%20default%2C%20Docker)




## Troubleshooting Scripts
- `generated/scripts/check-mining.sh`

This will check your current block in Subnet

- `generated/scripts/check-peers.sh`

This will check the number of peers of your Subnet node


## Telegram Troubleshooting Support Group
https://t.me/+jvkX6LaLEEthZWM1
42 changes: 42 additions & 0 deletions docs/deployment/5_faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
sidebar_label: "4. FAQ"
sidebar_position: 4
---

# Frequently Asked Questions

- How many Subnet nodes should I have?

Even one node is enough to start the Subnet blockchain! However, for better decantralized security, 3+ nodes is recommended. At least 2/3 of all nodes must be online and honest to mine blocks.

- For testing, should I checkpoint the Subnet to devnet or testnet?

Testnet, devnet will be less stable due to frequent development changes.

- Where are all the Subnet tokens, how do I use the Subnet?

In XDC-Subnet all initial tokens are assigned to the Grandmaster wallet (check keys.json). You can transfer them to any wallet address. Check [Faucet](../usage/2_faucet.md).

- How can I manage Subnet tokens?

1. Check [here](../usage/2_faucet.md) for how you can use the Subnet Faucet to easily transfer Subnet tokens to your users.
2. You can use any web3 wallet and connect to the Subnet RPC as a custom network, then transfer to other addresses.

- How can I easily give out Subnet tokens to my users?

We have provided a Faucet server for you to deploy under `generated/scripts/faucet-server.sh`. Anyone with access to the faucet page can request for tokens.
Please check (faucet page)

- Which files contain sensitive data and private keys?

common.env, contract_deploy.env, keys.json, and subnet*.env. Please make sure these files are kept securely.

- This function didn't work/I have encoutered an unexpected bug

For troubleshooting we can help you at [Telegram Support Group](./3_troubleshooting.md#telegram-troubleshooting-support-group) and we will check as soon as possible.

Other channels for suggestions/requests include [XDC Forum](https://forum.xinfin.org/) and [GitHub Issues](https://github.com/XinFinOrg/XDC-Subnet/issues)

- How do I change the Relayer Wallet/Parentchain Wallet?

You can [update services configs](./2_configs_explanation.md#updating-services-configs) in common.env to change the Relayer key
5 changes: 4 additions & 1 deletion docs/deployment/6_subnet_deployment_generator_changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
sidebar_label: "Subnet Deployment Generator Changelog"
sidebar_position: 6
sidebar_position: 5
---

# Subnet Deployment Generator Changelog

### v0.1.0 - 2024/09/28
- WIP

### v0.3.2 - 2024/08/15
- Changed frontend default due to clashing from 5000 to 5555

Expand Down
Binary file added docs/deployment/img/docker_mem.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 added docs/usage/.DS_Store
Binary file not shown.
58 changes: 58 additions & 0 deletions docs/usage/2_faucet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
sidebar_label: "Faucet"
sidebar_position: 2
---
# Faucet

In Subnets, all native tokens are initially assigned to the Grandmaster Wallet. To allow users to use the Subnet, we have to distribute the tokens out of the Grandmaster. We have provided convenient scripts for you to easily share Subnet tokens to your users.

## One-time Transfer

Under `generated` directory run the Faucet script.

```
./scripts/faucet.sh
```

The script will ask for your source wallet private key. You can use the Grandmaster Wallet(check `keys.json` file for the private key).
Then input the destination wallet and the transfer amount.

![Example](./img/faucet.png)

## Faucet Server

Under `generated` directory run the Faucet server script.

```
./scripts/faucet-server.sh
```

The script will ask for your source wallet private key. you can use the Grandmaster Wallet(check `keys.json` for the private key).
By default, the server is hosted on port `5211` of your machine. Then, on your browser, visit the url: `http://127.0.0.1:5211`

![Example](./img/faucet-server1.png)

Input your destination wallet or feel free to generate a random wallet via Address Generator.

![Example](./img/faucet-server2.png)

Submit and wait for confirmation.

![Example](./img/faucet-server3.png)

You can host this on any server and allow users to make token requests by themselves.

## Transfer Subnet Funds Without Faucet

The Faucet is not neccessary needed for funds transfer, most Ethereum compatible web3 wallet will also work.

First import a new wallet with the Grandmaster private key. Then add a custom network pointing to your Subnet RPC URL. Finally, use the web3 wallet for tokens transfer.


## Faucet Source Code

Please feel free to check the below repositories for the Subnet Faucet source code.

https://github.com/XinFinOrg/XinFin-Node/tree/master/subnet/deployment-generator/scripts

https://github.com/XinFinOrg/XinFin-Node/tree/master/subnet/deployment-generator/src/faucet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_label: "4. Blockchain Explorer"
sidebar_position: 4
sidebar_label: "Blockchain Explorer"
sidebar_position: 3
---

# Blockchain Explorer
Expand Down
11 changes: 7 additions & 4 deletions docs/usage/_category_.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"label": "UI Usage Guide",
"position": 4,
"label": "Using the Subnet",
"position": 5,
"link": {
"type": "generated-index",
"description": "The guide for XDC Subnet user interface"
"description": "The guide to using XDC-Subnet"
}
}
}



Binary file added docs/usage/img/faucet-server1.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 added docs/usage/img/faucet-server2.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 added docs/usage/img/faucet-server3.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 added docs/usage/img/faucet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions docs/usage/ui/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "UI Usage Guide",
"position": 1,
"link": {
"type": "generated-index",
"description": "The guide for XDC Subnet user interface"
}
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 767639e

Please sign in to comment.