InterchainJS (Beta ⚡️)
Networks
Ethereum
Starship
Overview

TLDR

Deploy

yarn starship

Run Tests

yarn starship:test

Teardown

yarn starship:stop

Port fording manually if needed

kubectl port-forward pods/ethereum-1337-0 8545:8545

Get chain id from node

curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \
  http://localhost:8545/

Get balance:

curl -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x7e5f4552091a69125d5dfcb7b8c2659029395bdf", "latest"],"id":1}' \
  http://localhost:8545

use ws to get latest block height:

wscat -c ws://127.0.0.1:8546

and then paste:

{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]}

1. Installation

Inorder to get started with starship, one needs to install the following

Note: To make the process easy we have a simple command that will try and install dependencies so that you dont have to.

yarn starship setup

This command will

  • check (and install) if your system has all the dependencies needed to run the e2e tests wtih Starship
  • fetch the helm charts for Starship

2. Connect to a kubernetes cluster

Inorder to set up the infrastructure, for Starship, we need access to a kubernetes cluster. One can either perform connect to a

  • remote cluster in a managed kubernetes service
  • use kubernetes desktop to spin up a cluster
  • use kind to create a local cluster on local machine

To make this easier we have a handy command which will create a local kind cluster and give you access to a kubernetes cluster locally.

NOTE: Resources constraint on local machine will affect the performance of Starship spinup time

yarn starship setup-kind

Run the following command to check connection to a k8s cluster

kubectl get pods

3. Start Starship

Now with the dependencies and a kubernetes cluster in handy, we can proceed with creating the mini-cosmos ecosystem

Run

yarn starship deploy

We use the config file configs/config.yaml as the genesis file to define the topology of the e2e test infra. Change it as required

Note: Spinup will take some time, while you wait for the system, can check the progress in another tab with kubectl get pods

4. Run the tests

We have everything we need, our desired infrastructure is now running as intended, now we can run our end-to-end tests.

Run

npm run starship:test

5. Stop the infra

The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins).

Once the state of the mini-cosmos is corrupted, you can stop the deployments with

npm run starship clean

Which will

  • Stop port-forwarding the traffic to your local
  • Delete all the helm charts deployed

6. Cleanup kind (optional)

If you are using kind for your kubernetes cluster, you can delete it with

yarn starship clean-kind

Related

Checkout these related projects:

Credits

🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to our github ⚛️ (opens in a new tab)

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.