Skip to main content

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
  • docker-compose
  • Osmosisd
    • 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.

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

  2. Initialize LocalOsmosis:

make localnet-init

The command:

  • Builds a local docker image with the latest changes
  • Cleans the $HOME/.osmosisd-local folder
  1. Start LocalOsmosis:
make localnet-start

Note

You can also start LocalOsmosis in detach mode with:

make localnet-startd

  1. (optional) Add your validator wallet and 9 other preloaded wallets automatically:
make localnet-keys
  • 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
  1. You can stop chain, keeping the state with
make localnet-stop
  1. When you are done you can clean up the environment with:
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:

      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:

      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:

      osmosisd start

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. You can also manually add these keys using make localnet-keys

AccountAddressMnemonic
lo-valosmo1phaxpevm5wecex2jyaqty2a4v02qj7qmlmzk5a
osmovaloper1phaxpevm5wecex2jyaqty2a4v02qj7qm9v24r6
satisfy adjust timber high purchase tuition stool faith fine install that you unaware feed domain license impose boss human eager hat rent enjoy dawn
lo-test1osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaksnotice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius
lo-test2osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vvquality vacuum heart guard buzz spike sight swarm shove special gym robust assume sudden deposit grid alcohol choice devote leader tilt noodle tide penalty
lo-test3osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8kasymbol force gallery make bulk round subway violin worry mixture penalty kingdom boring survey tool fringe patrol sausage hard admit remember broken alien absorb
lo-test4osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53bounce success option birth apple portion aunt rural episode solution hockey pencil lend session cause hedgehog slender journey system canvas decorate razor catch empty
lo-test5osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2tsecond render cat sing soup reward cluster island bench diet lumber grocery repeat balcony perfect diesel stumble piano distance caught occur example ozone loyal
lo-test6osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jqspatial forest elevator battle also spoon fun skirt flight initial nasty transfer glory palm drama gossip remove fan joke shove label dune debate quick
lo-test7osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0noble width taxi input there patrol clown public spell aunt wish punch moment will misery eight excess arena pen turtle minimum grain vague inmate
lo-test8osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5facream sport mango believe inhale text fish rely elegant below earth april wall rug ritual blossom cherry detail length blind digital proof identify ride
lo-test9osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqhindex light average senior silent limit usual local involve delay update rack cause inmate wall render magnet common feature laundry exact casual resource hundred
lo-test10osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgkprefer forget visit mistake mixture feel eyebrow autumn shop pair address airport diesel street pass vague innocent poem method awful require hurry unhappy shoulder