Skip to content

Commit

Permalink
docs: Update localnet docs
Browse files Browse the repository at this point in the history
  • Loading branch information
abukosek committed Nov 25, 2024
1 parent 8740906 commit e290197
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions docs/dapp/tools/localnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ of a:
- single key manager node,
- PostgreSQL instance,
- Oasis Web3 gateway with transaction indexer and enabled Oasis RPCs,
- Oasis Nexus indexer and Explorer frontend,
- helper script which populates the account(s) for you.

:::note Hardware requirements
Expand All @@ -35,14 +36,14 @@ To run the image, execute:
<TabItem value="Sapphire">

```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/sapphire-localnet
```

</TabItem>
<TabItem value="Emerald">

```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/emerald-localnet
```

</TabItem>
Expand All @@ -51,16 +52,19 @@ docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet
After a while, running the `sapphire-localnet` will show you something like:

```console
sapphire-localnet 2024-10-03-gitbad082f (oasis-core: 24.2, sapphire-paratime: 0.8.2, oasis-web3-gateway: 5.1.0)
sapphire-localnet local (oasis-core: 24.3, sapphire-paratime: 0.9.0-testnet, oasis-web3-gateway: 5.1.0)

* No ROFLs detected.
* Starting oasis-net-runner with sapphire...
* Waiting for Postgres to start.
* Waiting for Oasis node to start........
* Waiting for Postgres to start....
* Waiting for Oasis node to start....
* Waiting for Envoy proxy to start.
* Starting oasis-web3-gateway...
* Bootstrapping network (this might take a minute)...
* Bootstrapping network (this might take a minute)....
* Waiting for key manager......
* Creating database 'nexus'
* Waiting for Nexus to start.
* Waiting for Explorer to start.
* Populating accounts...

Available Accounts
Expand All @@ -81,14 +85,16 @@ Private Keys

HD Wallet
==================
Mnemonic: test test test test test test test test test test test junk
Base HD Path: m/44'/60'/0'/0/%d
Mnemonic: test test test test test test test test test test test junk
Base HD Path: m/44'/60'/0'/0/%d

WARNING: The chain is running in ephemeral mode. State will be lost after restart!

* GRPC listening on http://localhost:8544.
* Web3 RPC listening on http://localhost:8545 and ws://localhost:8546. Chain ID: 0x5afd.
* Container start-up took 313 seconds, node log level is set to warn.
* Nexus API listening on http://localhost:8547.
* Localnet Explorer available at http://localhost:8548.
* Container start-up took 69 seconds, node log level is set to warn.
```

Those familiar with local dApp environments will find the output above similar
Expand All @@ -106,6 +112,11 @@ Additionally, the [Oasis GRPC][oasis-rpc] endpoint is exposed on:

[oasis-rpc]: https://github.com/oasisprotocol/oasis-core/blob/master/docs/oasis-node/rpc.md

In addition to these, the Nexus API is available on `http://localhost:8547`
and an Explorer instance on `http://localhost:8548`.
These can be disabled by passing `--no-explorer` or setting the environment
variable `OASIS_DOCKER_START_EXPLORER` to `no`.

By default, the Localnet docker image will populate the first five accounts
derived from the standard test mnemonic, compatible with `hardhat node`.
These accounts are typically used for Solidity unit tests. If you prefer
Expand All @@ -117,16 +128,16 @@ derived addresses to fund.
<TabItem value="Sapphire">

```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/sapphire-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/sapphire-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
```

</TabItem>
<TabItem value="Emerald">

```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/emerald-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/emerald-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
```

</TabItem>
Expand All @@ -141,14 +152,14 @@ force the docker image to use the `linux/x86_64` platform, like this:
<TabItem value="Sapphire">

```sh
docker run -it -p8544-8546:8544-8546 --platform linux/x86_64 ghcr.io/oasisprotocol/sapphire-localnet
docker run -it -p8544-8548:8544-8548 --platform linux/x86_64 ghcr.io/oasisprotocol/sapphire-localnet
```

</TabItem>
<TabItem value="Emerald">

```sh
docker run -it -p8544-8546:8544-8546 --platform linux/x86_64 ghcr.io/oasisprotocol/emerald-localnet
docker run -it -p8544-8548:8544-8548 --platform linux/x86_64 ghcr.io/oasisprotocol/emerald-localnet
```

</TabItem>
Expand All @@ -169,8 +180,7 @@ contract and wallet balance will be lost after you quit the Docker container!
## GitHub Actions

You can easily integrate localnet into your CI/CD workflow. Use the example
GitHub Action configuration to start a Sapphire or Emerald stack, fund the
first two test accounts, and expose the necessary ports for testing.
GitHub Action configuration to start a Sapphire or Emerald stack and expose the necessary ports for testing.

<Tabs>
<TabItem value="Sapphire">
Expand All @@ -186,7 +196,7 @@ jobs:
- 8545:8545
- 8546:8546
env:
OASIS_DEPOSIT_BINARY: /oasis-deposit -n 2
OASIS_DOCKER_START_EXPLORER: no
options: >-
--rm
--health-cmd="test -f /CONTAINER_READY"
Expand All @@ -207,7 +217,7 @@ jobs:
- 8545:8545
- 8546:8546
env:
OASIS_DEPOSIT_BINARY: /oasis-deposit -n 2
OASIS_DOCKER_START_EXPLORER: no
options: >-
--rm
--health-cmd="test -f /CONTAINER_READY"
Expand Down

0 comments on commit e290197

Please sign in to comment.