Skip to content

Commit

Permalink
feat: add localosmosis description
Browse files Browse the repository at this point in the history
  • Loading branch information
mattverse committed Nov 6, 2024
1 parent 71f7910 commit 4236c4b
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 153 deletions.
118 changes: 109 additions & 9 deletions docs/localosmosis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,129 @@ sidebar_position: 1
---
# LocalOsmosis



## What is LocalOsmosis?

LocalOsmosis (a fork of LocalTerra) is a complete Osmosis testnet and ecosystem containerized with Docker and orchestrated with a simple `docker-compose` file. It simplifies the way smart-contract developers test their contracts in a sandbox before they deploy them on a testnet or mainnet.

LocalOsmosis comes preconfigured with opinionated, sensible defaults for standard testing environments. If other projects mention testing on LocalOsmosis, they are referring to the settings defined in this repo.

LocalOsmosis has the following advantages over a public testnet:

- Easily modifiable world states
- Quick to reset for rapid iterations
- Simple simulations of different scenarios
- Controllable validator behavior

## Prerequisites

- [`Docker`](https://www.docker.com/)
- [`docker-compose`](https://github.com/docker/compose)
- [`Osmosisd`](https://get.osmosis.zone)
* Select option 3 (localosmosis), the installer will configure everything for you.
* The osmosisd dameon on your local computer is used to communicate with the localosmosis daemin running inside the Docker container.
- Supported known architecture: x86_64
- 16+ GB of RAM is recommended

## Get started
## 1. LocalOsmosis - No Initial State

The following commands must be executed from the root folder of the Osmosis repository.

### Clone Osmosis
1. Make any change to the osmosis code that you want to test

2. Initialize LocalOsmosis:

```bash
make localnet-init
```
git clone https://github.com/osmosis-labs/osmosis.git
cd osmosis

The command:

- Builds a local docker image with the latest changes
- Cleans the `$HOME/.osmosisd-local` folder

3. Start LocalOsmosis:

```bash
make localnet-start
```

### Run LocalOsmosis
> Note
>
> You can also start LocalOsmosis in detach mode with:
>
> `make localnet-startd`
4. (optional) Add your validator wallet and 9 other preloaded wallets automatically:

```bash
make localnet-keys
```
make localnet-build

- These keys are added to your `--keyring-backend test`
- If the keys are already on your keyring, you will get an `"Error: aborted"`
- Ensure you use the name of the account as listed in the table below, as well as ensure you append the `--keyring-backend test` to your txs
- Example: `osmosisd tx bank send lo-test2 osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks --keyring-backend test --chain-id localosmosis`

5. You can stop chain, keeping the state with

```bash
make localnet-stop
```

### Advanced options
6. When you are done you can clean up the environment with:

```bash
make localnet-clean
```

## 2. LocalOsmosis - With Mainnet State

Running an osmosis network with mainnet state is now as easy as setting up a stateless localnet.

1. Set up a mainnet node and stop it at whatever height you want to fork the network at.

2. There are now two options you can choose from:

- **Mainnet is on version X, and you want to create a testnet on version X.**

On version X, run:

```bash
osmosisd in-place-testnet localosmosis osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj
```

Where the first input is the desired chain-id of the new network and the second input is the desired validator operator address (where you vote from).
The address provided above is included in the localosmosis keyring under the name 'val'.

You now have a network you own with the mainnet state on version X.

- **Mainnet is on version X, and you want to create a testnet on version X+1.**

On version X, run:

```bash
osmosisd in-place-testnet localosmosis osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj --trigger-testnet-upgrade
```

Where the first input is the desired chain-id of the new network and the second input is the desired validator operator address (where you vote from).
The address provided above is included in the localosmosis keyring under the name 'val'.

The network will start and hit 10 blocks, at which point the upgrade will trigger and the network will halt.

Then, on version X+1, run:

```bash
osmosisd start
```

- [Test local Osmosis core changes](./test-local-changes.md)
- [Run local Osmosis with a copy of main state](./local-osmosis-mainstate.md)
You now have a network you own with the mainnet state on version X+1.

## Accounts

LocalOsmosis is pre-configured with one validator and 9 accounts with ION and OSMO balances.
LocalOsmosis is pre-configured with one validator and 9 accounts with ION and OSMO balances. You can also manually add these keys using `make localnet-keys`

| Account | Address | Mnemonic |
| --------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
104 changes: 0 additions & 104 deletions docs/localosmosis/local-osmosis-mainstate.md

This file was deleted.

28 changes: 0 additions & 28 deletions docs/localosmosis/test-local-changes.md

This file was deleted.

12 changes: 0 additions & 12 deletions src/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ const SECTIONS = [
icon: OsmosisCore,
section: 'core-sdk',
},
{
name: 'Local Osmosis',
id: 'localosmosis',
icon: LocalOsmosis,
section: 'core-sdk',
},
{
name: 'Networks',
id: 'networks',
icon: Network,
section: 'core-sdk',
},
//Cosmwasm
{
name: 'Cosmwasm',
Expand Down

0 comments on commit 4236c4b

Please sign in to comment.