Skip to content

Commit

Permalink
Merge pull request #1333 from o1-labs/lightnet-readme-dev
Browse files Browse the repository at this point in the history
Lightnet README-dev documentation.
  • Loading branch information
shimkiv authored Dec 18, 2023
2 parents ec78979 + f91e027 commit 9676933
Showing 1 changed file with 46 additions and 8 deletions.
54 changes: 46 additions & 8 deletions README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ This README includes information that is helpful for o1js core contributors.

## Setting up the repo on your local

After cloning the repo, you must fetch external submodules for the following examples to work.
After cloning the repo, you must fetch external submodules for the following examples to work.

```sh
```shell
git clone https://github.com/o1-labs/o1js.git
cd o1js
git submodule update --init --recursive
```

## Run examples using Node.js

```sh
```shell
npm install
npm run build

Expand All @@ -23,7 +23,7 @@ npm run build

## Run examples in the browser

```sh
```shell
npm install
npm run build:web

Expand All @@ -38,20 +38,20 @@ Note: Some of our examples don't work on the web because they use Node.js APIs.

- Unit tests

```sh
```shell
npm run test
npm run test:unit
```

- Integration tests

```sh
```shell
npm run test:integration
```

- E2E tests

```sh
```shell
npm install
npm run e2e:install
npm run build:web
Expand Down Expand Up @@ -89,8 +89,46 @@ The other base branches (`berkeley`, `develop`) are only used in specific scenar

You can execute the CI locally by using [act](https://github.com/nektos/act). First generate a GitHub token and use:

```
```shell
act -j Build-And-Test-Server --matrix test_type:"Simple integration tests" -s $GITHUB_TOKEN
```

to execute the job "Build-And-Test-Server for the test type `Simple integration tests`.

## Test zkApps against the local blockchain network

In order to be able to test zkApps against the local blockchain network, you need to spin up such a network first.
You can do so in several ways.

1. Using [zkapp-cli](https://www.npmjs.com/package/zkapp-cli)'s sub commands:

```shell
zk lightnet start # start the local network
# Do your tests and other interactions with the network
zk lightnet logs # manage the logs of the local network
zk lightnet explorer # visualize the local network state
zk lightnet stop # stop the local network
```

Please refer to `zk lightnet --help` for more information.

2. Using the corresponding [Docker image](https://hub.docker.com/r/o1labs/mina-local-network) manually:

```shell
docker run --rm --pull=missing -it \
--env NETWORK_TYPE="single-node" \
--env PROOF_LEVEL="none" \
--env LOG_LEVEL="Trace" \
-p 3085:3085 \
-p 5432:5432 \
-p 8080:8080 \
-p 8181:8181 \
-p 8282:8282 \
o1labs/mina-local-network:o1js-main-latest-lightnet
```

Please refer to the [Docker Hub repository](https://hub.docker.com/r/o1labs/mina-local-network) for more information.

Next up, you will need the Mina blockchain accounts information in order to be used in your zkApp.
Once the local network is up and running, you can use the [Lightnet](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/lib/fetch.ts#L1012) `o1js API namespace` to get the accounts information.
The corresponding example can be found here: [src/examples/zkapps/hello_world/run_live.ts](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/examples/zkapps/hello_world/run_live.ts)

0 comments on commit 9676933

Please sign in to comment.