diff --git a/README-dev.md b/README-dev.md index 651359df05..42a570364e 100644 --- a/README-dev.md +++ b/README-dev.md @@ -4,9 +4,9 @@ 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 @@ -14,7 +14,7 @@ git submodule update --init --recursive ## Run examples using Node.js -```sh +```shell npm install npm run build @@ -23,7 +23,7 @@ npm run build ## Run examples in the browser -```sh +```shell npm install npm run build:web @@ -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 @@ -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)