/near-kurtosis-module

A Kurtosis module for launching a local NEAR network in Kurtosis

Primary LanguageTypeScript

NEAR Kurtosis Module

This repository contains a Kurtosis module for setting up a NEAR network locally on your machine using Kurtosis. It is published to Dockerhub here.

Quickstart

These quickstart instructions will do the following:

  1. Start a local NEAR cluster, running in Kurtosis, complete with Wallet, Explorer, indexer, etc.

NOTE: If you're viewing these instructions on Github, all code blocks can be copied by hovering over the block and clicking the clipboard that appears in the top-right corner

Install prerequisites

  1. Make sure Docker is running with at least 4GB of memory:
    1. If you don't already have Docker installed, do so using this link
    2. Open the "Docker Desktop" program (which will start your Docker engine if it's not running already)
    3. Give Docker >= 4GB of memory:
      1. Click the gear icon in the top-right of Docker Desktop
      2. Select the "Resources" tab from the left-hand menu
      3. Give Docker at least 4GB of memory
      4. Select "Apply & Restart"
      5. Wait until the whale icon in the bottom-left corner is green once more
  2. Visit this link to install the Kurtosis CLI (or upgrade it to latest if it's already installed)

Launch the local NEAR cluster in Kurtosis

  1. Download this script to somewhere on your local machine
  2. Execute the script
  3. Follow the instructions printed

Manage your local NEAR cluster

The cluster you started will continue to run on your local machine for as long as your Docker engine is running (which, in most cases, is for as long as you don't restart your computer). The cluster runs inside of a Kurtosis "enclave", an environment isolated from both your computer and other enclaves; in practice, this means that you can have multiple independent local NEAR clusters running on your machine simply be rerunning the kurtosis module exec command from the start of this guide.

To see the status of your existing enclaves, run:

```
kurtosis enclave ls
```

To see detailed information about an enclave, copy an enclave ID and run:

```
kurtosis enclave inspect THE_ENCLAVE_ID
```

To shut down your cluster to free up resources on your machine, run the following (NOTE: You will not be able to restart the cluster! If this is something you need, please file an issue here so we can prioritize it):

```
kurtosis enclave stop THE_ENCLAVE_ID
```

Stopping an enclave leaves its resources intact so that you can examine them if need be. To destroy a stopped enclave and free its resources, run:

```
kurtosis clean
```

If you would like to destroy all enclaves, regardless of if they're running, pass the -a flag to clean like so:

```
kurtosis clean -a
```

This can be a handy way to clear all your Kurtosis data.

Configure your dApp to use the local NEAR cluster running in Kurtosis

Use the values outputted during cluster launch (e.g. nearNodeRpcUrl, walletUrl, etc.) to fill the configuration values of your dApp.