Skip to content

Commit

Permalink
some more doc fixes (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege authored Mar 2, 2024
1 parent 6dd9da6 commit 269a934
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 69 additions & 9 deletions docs/pages/network/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ Since hyperbridge is a substrate-based blockchain, it has the same hardware requ
Hyperbridge is available at the official docker repository [`polytopelabs/hyperbridge`](https://hub.docker.com/r/polytopelabs/hyperbridge)

```bash
docker run polytopelabs/hyperbridge:latest --chain=messier
docker run polytopelabs/hyperbridge:latest --chain={messier|gargantua|nexus}
```

## Prebuilt Binaries

You can install a prebuilt binary for the hyperbridge node with the following bash script

```bash
wget -q --show-progress https://github.com/polytope-labs/hyperbridge/releases/download/v0.3.4/hyperbridge-x86_64-unknown-linux-gnu.tar.gz
wget -q --show-progress https://github.com/polytope-labs/hyperbridge/releases/download/v0.3.5/hyperbridge-x86_64-unknown-linux-gnu.tar.gz
tar -xvzf hyperbridge-x86_64-unknown-linux-gnu.tar.gz
# copy to $PATH
cp hyperbridge-x86_64-unknown-linux-gnu/hyperbridge $HOME/.local/bin/
Expand All @@ -33,7 +33,7 @@ cp hyperbridge-x86_64-unknown-linux-gnu/hyperbridge $HOME/.local/bin/
or a 1-liner shell script

```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/polytope-labs/hyperbridge/releases/download/v0.3.4/hyperbridge-installer.sh | sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/polytope-labs/hyperbridge/releases/download/v0.3.5/hyperbridge-installer.sh | sh
```

## Building from source
Expand Down Expand Up @@ -101,7 +101,7 @@ Download a local copy of the repo and checkout the latest release tag
```bash
git clone https://github.com/polytope-labs/hyperbridge.git
cd ./hyperbidge
git checkout v0.3.4
git checkout v0.3.5
```

### Build the node
Expand All @@ -114,17 +114,77 @@ cargo build --release -p hyperbridge

## Running the node (Rococo)

Hyperbridge currently exists on the rococo testnet, with a chainId of `gargantua` and paraId of `4374`. You can sync the rococo in a few hours by appending a relay chain argument `--sync=fast-unsafe`. This tells the relay chain node to simply download it's blocks and not execute them. It'll also download the full latest state.
Hyperbridge is available on the rococo testnet, with a chainId of `gargantua` and paraId of `4374`. You can sync the rococo relay chain in a few hours by appending a relay chain argument `--sync=fast-unsafe`. This tells the relay chain node to simply download it's blocks and not execute them. It'll also download the full latest state.
This is fine because the rococo testnet has no economic value.

```bash
hyperbridge --chain=gargantua --base-path=$HOME/.hyperbridge --pruning-archive -- --sync=fast-unsafe
hyperbridge \
--base-path=$HOME/.hyperbridge \
--pruning=archive \
--name="Your node name here" \
--rpc-cors=all \
--rpc-port=9944 \
--rpc-methods=unsafe \
--chain=gargantua \
--no-mdns \
--listen-addr=/ip4/0.0.0.0/tcp/30333 \
--listen-addr=/ip6/::/tcp/30333 \
--public-addr=/ip4/your-node-ip-address/tcp/30333 \
--out-peers=32 \
-- \
-- sync=fast-unsafe
```

## Running the node (Kusama)

Hyperbridge also currently exists on Kusama with a chainId of `messier` and paraId of `3340`
Hyperbridge is live on Kusama with a chainId of `messier` and ParaId of `3340`

```bash
hyperbridge --chain=messier --base-path=$HOME/.hyperbridge --pruning-archive
```
hyperbridge \
--base-path=$HOME/.hyperbridge \
--pruning=archive \
--name="Your node name here" \
--rpc-cors=all \
--rpc-port=9944 \
--rpc-methods=unsafe \
--chain=messier \
--no-mdns \
--listen-addr=/ip4/0.0.0.0/tcp/30333 \
--listen-addr=/ip6/::/tcp/30333 \
--public-addr=/ip4/your-node-ip-address/tcp/30333 \
--out-peers=32
```

## Running the node (Polkadot)

Hyperbridge is also live on Polkadot with a chainId of `nexus` and ParaId of `3367`

```bash
hyperbridge \
--base-path=$HOME/.hyperbridge \
--pruning=archive \
--name="Your node name here" \
--rpc-cors=all \
--rpc-port=9944 \
--rpc-methods=unsafe \
--chain=nexus \
--no-mdns \
--listen-addr=/ip4/0.0.0.0/tcp/30333 \
--listen-addr=/ip6/::/tcp/30333 \
--public-addr=/ip4/your-node-ip-address/tcp/30333 \
--out-peers=32
```

## Ansible Playbooks

A community member has graciously provided their ansible playbook for running the hyperbridge node. You can find it here:

https://github.com/schmiatz/hyperbridge-node

## Miscellaneous

Ensure that your firewall and NAT configuration allows incoming connections on port `30333` for optimal peering with other nodes on the network.

```bash
sudo ufw allow 30333
```
36 changes: 26 additions & 10 deletions docs/pages/network/relayer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,28 @@ The tesseract relayer command line interface expects two arguments, which are th


```bash
docker --network=host run -v /dir/on/host:/home/root polytopelabs/tesseract:latest --config=/home/root/config.toml --db=/home/root/dev.db
docker run -d \
--name=tesseract \
--network=host \
--restart=always \
--volume=/dir/on/host:/home/root \
polytopelabs/tesseract:latest \
--config=/home/root/config.toml \
--db=/home/root/dev.db
```

Access it's logs using

```bash
docker logs -f tesseract
```

## Ansible Playbooks

A community member has graciously provided their ansible playbook for running the hyperbridge relayer. You can find it here:

https://github.com/schmiatz/hyperbridge-relayer

### Configuration

The configuration file is a toml file that at the moment, expects the following configuration options:
Expand All @@ -81,8 +100,8 @@ The configuration file is a toml file that at the moment, expects the following
```toml
# Hyperbridge config, required
[hyperbridge]
# Hyperbridge chain spec, either one of Dev, Gargantua or Messier
chain = "Dev"
# Hyperbridge chain spec, either one of Dev, Gargantua, Messier or Nexus
chain = "Gargantua" # testnet
# Hyperbidge node ws rpc endpoint.
rpc_ws = "ws://127.0.0.1:9944" # example endpoint

Expand Down Expand Up @@ -178,8 +197,8 @@ signer = ""

# Relayer config, required
[relayer]
# Hyperbridge chain spec, either one of Dev, Gargantua or Messier
chain = "Dev"
# Hyperbridge chain spec, either one of Dev, Gargantua, Messier or Nexus
chain = "Gargantua" # testnet
# Define your profitability configuration. 0 -> 0% i.e relay all requests, even unprofitable ones. 1 -> 1%. ie fees provided for requests must be profitable by at least 1%. etc.
minimum_profit_percentage = 0
# (Optional) If not empty, will filter requests to be delivered by originating module identifier (eg contract address)
Expand Down Expand Up @@ -216,15 +235,12 @@ Stop any running relayer instances, run the following command in the terminal an
```

#### Initiating withdrawal from hyperbridge
To initiate a withdrawal from hyperbridge, a relayer needs to submit a `withdraw_fees` extrinsic from `pallet-ismp-relayer` on hyperbridge, The transaction takes a `WithdrawalInputData`, this value contains, the amount to be withdrawn, the destination chain and a signature that proves ownership of the account that will be debited.
To initiate a withdrawal from hyperbridge, a relayer needs to submit a `relayer.withdraw_fees` extrinsic to hyperbridge. This extrinsic is unsigned and will not require any native tokens for execution fees.
<br />
It is possible to use the relayer software to accumulate fees and initiate the withdrawal process with one command, for this to work, the relayer account must have sufficient funds to pay the transaction delivery fees on the withdrawal destination chains.
Once the extrinsic is executed, hyperbridge dispatches a POST request that when executed on it's destination, will provide the relayer with the fees they've accrued. The relayer account must have sufficient funds to pay the request delivery on the withdrawal destination chain.
<br />
To use this feature run the following command:

```bash
docker run --network=host -v /dir/on/host:/home/root polytopelabs/tesseract:latest --config=/home/root/config.toml --db=/home/root/dev.db accumulate-fees --withdraw
```

You can find the code that implements fee accumulation and withdrawals [here](https://github.com/polytope-labs/hyperbridge/blob/c3e940c60b718eaf5ac02a96c4801814a555dcf7/modules/relayer-fees/src/lib.rs#L120)

40 changes: 25 additions & 15 deletions parachain/chainspec/nexus.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyperbridge"
version = "0.3.4"
version = "0.3.5"
authors = ["Polytope Labs <[email protected]>"]
description = "The Hyperbridge coprocessor node"
repository = "https://github.com/polytope-labs/hyperbridge"
Expand Down
8 changes: 7 additions & 1 deletion parachain/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::net::SocketAddr;
use crate::{
chain_spec,
cli::{Cli, RelayChainCli, Subcommand},
service::{new_partial, GargantuanExecutor, MessierExecutor},
service::{new_partial, GargantuanExecutor, MessierExecutor, NexusExecutor},
};

fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Expand Down Expand Up @@ -239,6 +239,12 @@ pub fn run() -> Result<()> {

cmd.run(components.client.clone())
},
chain if chain.contains("nexus") => {
let components =
new_partial::<nexus_runtime::RuntimeApi, NexusExecutor>(&config)?;

cmd.run(components.client.clone())
},
chain => panic!("Unknown chain with id: {}", chain),
})
},
Expand Down
2 changes: 1 addition & 1 deletion parachain/runtimes/nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "nexus-runtime"
version = "0.1.0"
authors = ["Polytope Labs <[email protected]>"]
description = "Parachain runtime implementation of the hyperbridge protocol (Kusama)"
description = "Parachain runtime implementation of the hyperbridge protocol (Polkadot)"
edition = "2021"

[package.metadata.docs.rs]
Expand Down

0 comments on commit 269a934

Please sign in to comment.