Use this prompt to get started quickly.
Prerequisites
- A modern browser with WebAssembly and IndexedDB support
- A secure context: served over HTTPS or
localhost(crypto.subtleis unavailable otherwise) - For the bundler setup: Node.js 18+ and any bundler that can emit a
.wasmasset (Vite, webpack, Next, etc.).
Getting started
1
Install the SDK
- Vite
- Next
- Vanilla HTML/JS
@secondts/bark/web subpath, and load the .wasm with your bundler’s URL import (Vite’s ?url) to pass to init(). Your bundler emits it as a hashed asset; the example below shows the full setup.The only bundler-specific line is how you get the .wasm URL to pass to init():- Vite:
import wasmUrl from "@secondts/bark/web/bark_ffi_wasm_bg.wasm?url" - webpack / Next:
new URL("@secondts/bark/web/bark_ffi_wasm_bg.wasm", import.meta.url) - Fallback (any): copy
bark_ffi_wasm_bg.wasminto your served/public dir and pass its path string.
2
Create a wallet
Generate a BIP39 mnemonic, configure the wallet for signet, and initialize it. The wasm module must be instantiated with
init() before any binding is called.- Vite
- Next
- Vanilla HTML/JS
Back up the mnemonic securely, and back up wallet data continuously. Both are required to restore a wallet. To reopen an existing wallet on later loads, store the mnemonic and call
Wallet.open({ mnemonic, config, dbName }) instead of Wallet.create.3
Get a receiving address
4
Check your balance
Sync the wallet with the Ark server and read your balance.
Next steps
Source and examples
Full Wasm source and example projects on GitLab.
How Ark works
Learn about the protocol powering your wallet.