Skip to content

Commit d4ba678

Browse files
Merge pull request #1462 from oasisprotocol/uniyalabhishek/docs/localnet-setup-info
docs: add platform specific tabs for setup
2 parents 53deb30 + c74ab48 commit d4ba678

File tree

1 file changed

+40
-74
lines changed

1 file changed

+40
-74
lines changed

docs/build/tools/localnet.mdx

Lines changed: 40 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ import TabItem from '@theme/TabItem';
88
# Localnet
99

1010
For convenient development and testing of your dApps the Oasis team prepared
11-
both [ghcr.io/oasisprotocol/sapphire-localnet][sapphire-localnet] and
12-
[ghcr.io/oasisprotocol/emerald-localnet][emerald-localnet] Docker images.
13-
They will bring you a complete Oasis network stack to your workspace. The
11+
the [ghcr.io/oasisprotocol/sapphire-localnet][sapphire-localnet] container image.
12+
It will bring you a complete Oasis network stack to your workspace. The
1413
Localnet Sapphire instance **mimics confidential transactions**, but it does
1514
not run in a trusted execution environment nor does it require Intel's SGX on
1615
your computer. The network is isolated from the Mainnet or Testnet and consists
1716
of a:
1817

1918
- single Oasis validator node with 1-second block time and 30-second epoch,
2019
- single Oasis client node,
21-
- single compute node running Oasis Sapphire or Emerald,
20+
- single compute node running Oasis Sapphire,
2221
- single key manager node,
2322
- PostgreSQL instance,
2423
- Oasis Web3 gateway with transaction indexer and enabled Oasis RPCs,
@@ -27,7 +26,7 @@ of a:
2726

2827
:::note Hardware requirements
2928

30-
You will need at least 16GB of RAM to run the Docker images in addition to your
29+
You will need at least 16GB of RAM to run the Docker image in addition to your
3130
machine's OS.
3231

3332
:::
@@ -37,17 +36,39 @@ machine's OS.
3736
To run the image, execute:
3837

3938
<Tabs>
40-
<TabItem value="Sapphire">
39+
<TabItem value="linux-intel-win" label="Linux (Intel) / Windows">
4140

4241
```sh
43-
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/sapphire-localnet
42+
docker run -it --rm -p8544-8548:8544-8548 ghcr.io/oasisprotocol/sapphire-localnet
4443
```
4544

4645
</TabItem>
47-
<TabItem value="Emerald">
46+
<TabItem value="macos" label="macOS">
4847

4948
```sh
50-
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/emerald-localnet
49+
docker run -it --rm -p8544-8548:8544-8548 --platform linux/x86_64 ghcr.io/oasisprotocol/sapphire-localnet
50+
```
51+
52+
:::info macOS Startup Issue on Apple Silicon
53+
54+
On Apple Silicon Macs running macOS 26 (Tahoe) or later, the `sapphire-localnet` Docker
55+
image may hang on startup with peer authentication errors (e.g.,
56+
`chacha20poly1305: message authentication failed`).
57+
58+
This is due to a bug in Rosetta 2's x86_64 emulation. The workaround is to
59+
disable Rosetta in Docker Desktop settings, which makes Docker use QEMU
60+
instead.
61+
62+
Go to `Settings > Virtual Machine Options` and disable
63+
"Use Rosetta for x86/amd64 emulation on Apple Silicon".
64+
65+
:::
66+
67+
</TabItem>
68+
<TabItem value="linux-non-intel" label="Linux (non-Intel)">
69+
70+
```sh
71+
docker run -it --rm -p8544-8548:8544-8548 --platform linux/x86_64 ghcr.io/oasisprotocol/sapphire-localnet
5172
```
5273

5374
</TabItem>
@@ -121,60 +142,32 @@ and an Explorer instance on `http://localhost:8548`.
121142
These can be disabled by passing `--no-explorer` or setting the environment
122143
variable `OASIS_DOCKER_START_EXPLORER` to `no`.
123144

145+
## Optional Parameters
146+
124147
By default, the Localnet docker image will populate the first five accounts
125148
derived from the standard test mnemonic, compatible with `hardhat node`.
126149
These accounts are typically used for Solidity unit tests. If you prefer
127150
populating different accounts, use `-to` flag and pass the mnemonics seed
128151
phrases or wallet addresses. Use the `-n` parameter to define the number of
129152
derived addresses to fund.
130153

131-
<Tabs>
132-
<TabItem value="Sapphire">
133-
134154
```sh
135155
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
136156
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/sapphire-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
137157
```
138158

139-
</TabItem>
140-
<TabItem value="Emerald">
141-
142-
```sh
143-
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
144-
docker run -it -p8544-8548:8544-8548 ghcr.io/oasisprotocol/emerald-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
145-
```
146-
147-
</TabItem>
148-
</Tabs>
149-
150-
:::note Running on Apple M chips
151-
152-
There is currently no `arm64` build available for M Macs, so you will need to
153-
force the docker image to use the `linux/x86_64` platform, like this:
154-
155-
<Tabs>
156-
<TabItem value="Sapphire">
157-
158-
```sh
159-
docker run -it -p8544-8548:8544-8548 --platform linux/x86_64 ghcr.io/oasisprotocol/sapphire-localnet
160-
```
161-
162-
</TabItem>
163-
<TabItem value="Emerald">
164-
165-
```sh
166-
docker run -it -p8544-8548:8544-8548 --platform linux/x86_64 ghcr.io/oasisprotocol/emerald-localnet
167-
```
159+
:::danger
168160

169-
</TabItem>
170-
</Tabs>
161+
The [sapphire-localnet] runs in ephemeral mode. Any smart
162+
contract and wallet balance will be lost after you quit the Docker container!
171163

172164
:::
173165

174-
:::danger
166+
:::note Emerald Localnet
175167

176-
[sapphire-localnet] and [emerald-localnet] run in ephemeral mode. Any smart
177-
contract and wallet balance will be lost after you quit the Docker container!
168+
An Emerald flavor of [sapphire-localnet] also exists, called
169+
[emerald-localnet]. It behaves the same way as Sapphire, but without
170+
confidentiality.
178171

179172
:::
180173

@@ -184,12 +177,9 @@ contract and wallet balance will be lost after you quit the Docker container!
184177
## GitHub Actions
185178

186179
You can easily integrate localnet into your CI/CD workflow. Use the example
187-
GitHub Action configuration to start a Sapphire or Emerald stack and expose
180+
GitHub Action configuration to start a Sapphire stack and expose
188181
the necessary ports for testing.
189182

190-
<Tabs>
191-
<TabItem value="Sapphire">
192-
193183
```yaml
194184
jobs:
195185
example-test:
@@ -207,27 +197,3 @@ jobs:
207197
--health-cmd="test -f /CONTAINER_READY"
208198
--health-start-period=90s
209199
```
210-
211-
</TabItem>
212-
<TabItem value="Emerald">
213-
214-
```yaml
215-
jobs:
216-
example-test:
217-
services:
218-
emerald-localnet-ci:
219-
image: ghcr.io/oasisprotocol/emerald-localnet
220-
ports:
221-
- 8544:8544
222-
- 8545:8545
223-
- 8546:8546
224-
env:
225-
OASIS_DOCKER_START_EXPLORER: no
226-
options: >-
227-
--rm
228-
--health-cmd="test -f /CONTAINER_READY"
229-
--health-start-period=90s
230-
```
231-
232-
</TabItem>
233-
</Tabs>

0 commit comments

Comments
 (0)