Skip to main content

Use this prompt to get started quickly.

Open in Cursor
These examples connect to signet so you can test for free. To go live, point the same configuration at Second’s mainnet endpoints from Test on mainnet and select the mainnet network.

Prerequisites

  • A modern browser with WebAssembly and IndexedDB support
  • A secure context: served over HTTPS or localhost (crypto.subtle is unavailable otherwise)
  • For the bundler setup: Node.js 18+ and any bundler that can emit a .wasm asset (Vite, webpack, Next, etc.).

Getting started

1

Install the SDK

Import from the @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.wasm into 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.
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

Generate an Ark address to receive bitcoin.
Send some signet sats to this address using the faucet.
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.