Skip to content

Commit 9eee826

Browse files
committed
init will write to sqlite
1 parent d02cf1a commit 9eee826

12 files changed

Lines changed: 266 additions & 214 deletions

File tree

.env.example

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ NODE_RPC_PASSWORD=node_password_change_me
1818
WALLET_RPC_USERNAME=wallet_user
1919
WALLET_RPC_PASSWORD=wallet_password_change_me
2020

21-
# Full command for the wallet-rpc-daemon container.
22-
# init.sh writes this automatically. Edit it here to change the wallet file
23-
# or network, then run: docker compose restart wallet-rpc-daemon
24-
#
25-
# No wallet file (daemon starts, create one via /setup):
21+
# wallet-rpc-daemon command (network only — wallet files are managed via the web UI).
22+
# init.sh writes this automatically. Edit only to change the network.
2623
WALLET_RPC_CMD=wallet-rpc-daemon mainnet
27-
#
28-
# With a wallet file:
29-
# WALLET_RPC_CMD=wallet-rpc-daemon mainnet --wallet-file /home/mintlayer/my_wallet
3024

3125
# ── Web GUI ───────────────────────────────────────────
3226
# Port the Astro web interface listens on (host port).
@@ -50,14 +44,9 @@ PASSKEY_RP_ID=localhost
5044
PASSKEY_ORIGIN=http://localhost:4321
5145

5246
# ── Web UI Authentication ─────────────────────────────
53-
# Generated automatically by init.sh — do NOT edit manually.
54-
# To change the password or reset 2FA, re-run ./init.sh.
55-
#
56-
# UI_PASSWORD_HASH: PBKDF2-SHA512 hash of the login password.
57-
# UI_TOTP_SECRET: Base32 TOTP secret (RFC 6238, Google Authenticator compatible).
58-
# SESSION_SECRET: 32+ byte hex key used to sign session cookies.
59-
UI_PASSWORD_HASH=pbkdf2:sha512:100000:<salt_hex>:<key_hex>
60-
UI_TOTP_SECRET=BASE32TOTPSECRETHERE
47+
# SESSION_SECRET: 32+ byte hex key used to sign session cookies. Generated by init.sh.
48+
# Password and 2FA secret are stored in mintlayer-data/prefs/mintlayer_prefs.sqlite
49+
# and managed via the web UI Settings page.
6150
SESSION_SECRET=<64-hex-chars-random>
6251

6352
# ── Indexer (optional, profile: indexer) ─────────────

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,7 @@ Open <http://localhost:4321/setup> and use the **Create new wallet** form.
105105
- Use `/home/mintlayer/my_wallet` as the path — it appears as `./mintlayer-data/my_wallet` on the host
106106
- Write down the mnemonic shown — it will not be displayed again
107107

108-
**5. Make the wallet load automatically on restart**
109-
110-
```bash
111-
# .env
112-
WALLET_FILE=my_wallet
113-
```
114-
115-
```bash
116-
docker compose restart wallet-rpc-daemon
117-
```
118-
119-
The dashboard at <http://localhost:4321> will now show your balance and sync status.
108+
After creating your wallet at <http://localhost:4321/setup>, the dashboard at <http://localhost:4321> will show your balance and sync status.
120109

121110
> **Sync time:** balance and transaction history only appear once the node has fully synced. On first run this takes several hours for mainnet. The dashboard shows the current block height so you can track progress.
122111

app/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
.env
4+
*.log

app/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR /app
66

77
COPY package.json package-lock.json ./
88
COPY wasm-wrappers/ ./wasm-wrappers/
9-
RUN npm ci
9+
RUN npm ci && npm rebuild better-sqlite3
1010

1111
COPY . .
1212
RUN npm run build

app/Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR /app
66

77
# Install deps in a cacheable layer — source is mounted at runtime
88
COPY package.json package-lock.json ./
9-
RUN npm ci
9+
RUN npm ci && npm rebuild better-sqlite3
1010

1111
ENV HOST=0.0.0.0
1212
ENV PORT=4321

app/src/components/OrderBook.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ function BuySellPanel({
259259
<button type="button" onClick={() => setSide("buy")}
260260
className={`px-6 py-2 text-sm font-semibold transition-colors ${
261261
side === "buy" ? "bg-green-700 text-white" : "bg-gray-800 text-gray-400 hover:text-gray-200"
262-
}`}>Buy</button>
262+
}`}>Buy {effectiveTicker} with ML</button>
263263
<button type="button" onClick={() => setSide("sell")}
264264
className={`px-6 py-2 text-sm font-semibold transition-colors ${
265265
side === "sell" ? "bg-red-700 text-white" : "bg-gray-800 text-gray-400 hover:text-gray-200"
266-
}`}>Sell</button>
266+
}`}>Sell {effectiveTicker} for ML</button>
267267
</div>
268268

269269
{/* Order type underline tabs */}
@@ -916,7 +916,7 @@ export default function OrderBook({ initialOwnOrders, balanceTokens = [], initia
916916
<option value="">— Select pair —</option>
917917
{favourites.map(f => (
918918
<option key={f.tokenId} value={f.tokenId}>
919-
ML / {f.ticker === "???" ? f.tokenId.slice(0, 12) + "…" : f.ticker}
919+
{f.ticker === "???" ? f.tokenId.slice(0, 12) + "…" : f.ticker} / ML
920920
</option>
921921
))}
922922
</select>
@@ -946,15 +946,15 @@ export default function OrderBook({ initialOwnOrders, balanceTokens = [], initia
946946
{!pairLoading && (
947947
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
948948
<PairBookPanel
949-
title={`Asks — sell ${selectedTicker} for ML`}
949+
title={`Asks — ${selectedTicker} Sell Orders`}
950950
orders={pairAsks}
951951
side="ask"
952952
ticker={selectedTicker}
953953
colorClass="text-red-400"
954954
onFilled={() => loadPairOrders(selectedTokenId)}
955955
/>
956956
<PairBookPanel
957-
title={`Bids — buy ${selectedTicker} with ML`}
957+
title={`Bids — ${selectedTicker} Buy Orders`}
958958
orders={pairBids}
959959
side="bid"
960960
ticker={selectedTicker}

app/src/lib/settings-migration.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import { getPref, setPref } from './prefs-db';
1010

1111
const MIGRATIONS: Array<{ key: string; envVar: string }> = [
12-
{ key: 'auth.password_hash', envVar: 'UI_PASSWORD_HASH' },
13-
{ key: 'auth.totp_secret', envVar: 'UI_TOTP_SECRET' },
1412
{ key: 'ipfs.provider', envVar: 'IPFS_PROVIDER' },
1513
{ key: 'ipfs.filebase_token', envVar: 'FILEBASE_TOKEN' },
1614
{ key: 'ipfs.pinata_jwt', envVar: 'PINATA_JWT' },

app/src/pages/setup.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ if (Astro.request.method === 'POST') {
7474
result = { action: 'error', message: 'Wallet file too large (max 50 MB).' };
7575
} else {
7676
try {
77-
const destPath = '/app/mintlayer-data/mintlayer.wallet';
77+
const destPath = '/app/uploads/mintlayer.wallet';
78+
const daemonPath = '/home/mintlayer/uploads/mintlayer.wallet';
7879
const { writeFile, access } = await import('node:fs/promises');
7980
8081
let walletExists = false;
@@ -84,7 +85,7 @@ if (Astro.request.method === 'POST') {
8485
result = { action: 'upload_confirm_needed' };
8586
} else {
8687
await writeFile(destPath, Buffer.from(await fileField.arrayBuffer()));
87-
await openWallet(WALLET_PATH, password);
88+
await openWallet(daemonPath, password);
8889
result = { action: 'upload_success' };
8990
}
9091
} catch (err) {

deploy/docker-compose.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ services:
3737
# ─────────────────────────────────────────
3838
# Core: Wallet RPC daemon (headless wallet)
3939
#
40-
# WALLET_RPC_CMD is written by init.sh and contains the full resolved
41-
# command, e.g. "wallet-rpc-daemon mainnet --wallet-file /home/mintlayer/wallet"
42-
# Run ./init.sh (or edit .env manually) to change it.
40+
# WALLET_RPC_CMD is written by init.sh (network only, e.g. "wallet-rpc-daemon mainnet").
41+
# Wallet files are managed via the web UI — no --wallet-file flag needed.
4342
# ─────────────────────────────────────────
4443
wallet-rpc-daemon:
4544
<<: *common
@@ -74,9 +73,7 @@ services:
7473
# Web GUI (Astro SSR app)
7574
# ─────────────────────────────────────────
7675
web-gui:
77-
build:
78-
context: ./app
79-
dockerfile: Dockerfile
76+
image: "mintlayer/web-gui:0.99.5"
8077
depends_on:
8178
- wallet-rpc-daemon
8279
volumes:
@@ -101,8 +98,6 @@ services:
10198
PINATA_JWT: "${PINATA_JWT:-}"
10299
IPFS_PROVIDER: "${IPFS_PROVIDER:-}"
103100
FILEBASE_TOKEN: "${FILEBASE_TOKEN:-}"
104-
UI_PASSWORD_HASH: "${UI_PASSWORD_HASH}"
105-
UI_TOTP_SECRET: "${UI_TOTP_SECRET}"
106101
SESSION_SECRET: "${SESSION_SECRET}"
107102
WALLET_RPC_CMD: "${WALLET_RPC_CMD:-}"
108103
INDEXER_ENABLED: "${INDEXER_ENABLED:-false}"

0 commit comments

Comments
 (0)