Skip to content

Commit

Permalink
Merge pull request #110 from 0o-de-lally/od-testnet-setup
Browse files Browse the repository at this point in the history
[docs] testnet setup
  • Loading branch information
sirouk authored Feb 7, 2025
2 parents ca4e7a9 + a89f6af commit a890141
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions docs/validators/testnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
sidebar_label: 'Start a Testnet'
sidebar_position: 10
description: 'Recipe for starting a testnet'
---

# Testnet Setup

TL;DR: the `libra` cli tool has a helper to create all genesis files for a testnet from pre-determined test personas (Alice, Bob, Carol, and Dave).

Each host needs to present the same genesis information (just network address), and pick one persona.

A host can be bare metal, or a docker container.

Requirements: building the `libra` binary, or pulling the docker reference image at `https://github.com/0LNetworkCommunity/libra-framework/pkgs/container/libra-framework%2Flibra-node`

## On each host

Each node should run on their host the setup instructions.
WARNING: the usual `$HOME/.libra/` data director WILL BE DESTROYED in this process.

Here's an example of setting up a testnet with three hosts separated by the vast ocean of the internet.

In this case the first user will be "alice"
```
libra ops genesis testnet --me alice \
--host-list my.domain.com:6180 \
--host-list 1.2.4.5:6180 \
--host-list localhost:6182 \
--framework-mrb-path <LIBRA_SOURCE>/framework/releases/head.mrb
```

Next, each other hosts must pick Bob, Carol, (and optionally) Dave.

NOTE: you need three (up to Carol) or optionally four (Dave) to start a testnet. Trying for example five hosts will fail since there are only four predetermined personas. Other nodes can join testnet after genesis.

## Network addresses

The `--host-list` argument can be a domain, IPv4, or IPv6 address. You need to add a PORT. In production for validator networking this is `6180`. If you are doing docker voodoo keep this in mind and check the `validator.yaml` on each host to see if they are using expected ports.

## Framework MRB
This fils is the binary of the Move code for the system smart contracts. This is needed to produce the genesis transaction.

### Using mainnet's current deployed framework
You can start a testnet with any of the historical `.mrb` files. We archive these in the libra-framework source.
For example, mainnet is here: `https://github.com/0LNetworkCommunity/libra-framework/blob/main/framework/releases/mainnet.mrb`


### Using bleeding edge framework
You will want to use a `head.mrb` file build from recent source
```
cd <LIBRA SOURCE>/framework
libra move framework release
// will produce a file at framework/releases/head.mrb
```

## After all hosts are configured

Just start the node:

```
libra node
```

# Troubleshooting
- Can your nodes connect to each other on the internet?
- Do the ports in the `validator.yaml` file match on all nodes?
- Are the ports open on each host?
- (Docker) are you extra sure the ports are doing what you think?

0 comments on commit a890141

Please sign in to comment.