bark_bitcoin 0.27.0+bark-0.8.1
bark_bitcoin: ^0.27.0+bark-0.8.1 copied to clipboard
An implementation of the Ark protocol on Bitcoin.
import 'package:bark_bitcoin/bark_bitcoin.dart';
Future<void> main() async {
// Store the mnemonic securely: you need it to reopen the wallet.
final mnemonic = generateMnemonic();
final config = Config(
serverAddress: 'https://ark.signet.2nd.dev',
esploraAddress: 'https://esplora.signet.2nd.dev',
);
// Opens the wallet in datadir, creating it on first launch.
// In Flutter, use a directory from path_provider instead.
final wallet = await Wallet.open(
network: Network.signet,
mnemonicOrSeed: mnemonic,
config: config,
args: WalletOpenArgs(datadir: './bark-data'),
);
await wallet.sync_();
final balance = await wallet.balance();
print('Spendable: ${balance.spendableSats} sats');
final address = await wallet.newAddress();
print('Ark address: $address');
wallet.dispose();
}