Skip to main content

Use this prompt to get started quickly.

CursorOpen in Cursor

Prerequisites

  • Dart SDK 3.10+ / Flutter 3.x+
  • Rust toolchain (rustup, cargo, rustc). The bark_bitcoin package compiles its Rust core at build time using Dart’s Native Assets feature.

Getting started

1

Install the SDK

dart pub add bark_bitcoin
Then run:
dart pub get
2

Create a wallet

Configure the wallet for signet and initialize it.
import 'dart:io';
import 'package:bark_bitcoin/bark_bitcoin.dart';

void main() {
  // Use a known test mnemonic (generate your own for real use)
  final mnemonic =
      "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";

  // Configure for signet
  final config = Config(
    "https://ark.signet.2nd.dev",  // serverAddress
    "https://esplora.signet.2nd.dev",  // esploraAddress
    null, // bitcoindAddress
    null, // bitcoindCookiefile
    null, // bitcoindUser
    null, // bitcoindPass
    Network.signet,
    null, // vtxoRefreshExpiryThreshold
    null, // vtxoExitMargin
    null, // htlcRecvClaimDelta
    null, // fallbackFeeRate
    null, // roundTxRequiredConfirmations
  );

  // Create a data directory
  final dataDir = Directory('./bark_db');
  dataDir.createSync(recursive: true);

  // Create the wallet
  final wallet = Wallet.create(
    mnemonic, config, dataDir.path, false,
  );
}
Back up the mnemonic securely. It is the only way to recover your wallet.
The Config constructor uses positional parameters. See the example above for the correct argument order.
3

Get a receiving address

Generate an Ark address to receive funds.
final address = wallet.newAddress();
print("Ark address: $address");
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.
sync is a reserved keyword in Dart. The method is named sync_() with a trailing underscore.
wallet.sync_();

final balance = wallet.balance();
print("Spendable: ${balance.spendableSats} sats");

Next steps