Documentation Index
Fetch the complete documentation index at: https://second.tech/docs/llms.txt
Use this file to discover all available pages before exploring further.
Use this prompt to get started quickly.
Prerequisites
Getting started
Install the SDK
npx expo install @secondts/bark-react-native
Add the plugin to your app.json:{
"expo": {
"plugins": ["@secondts/bark-react-native"]
}
}
Then prebuild:npm install @secondts/bark-react-native
For iOS, install the CocoaPods dependencies:cd ios && pod install && cd ..
If you use pnpm v10+, run pnpm approve-builds and select @secondts/bark-react-native to allow the postinstall script.
Create a wallet
Generate a BIP39 mnemonic, configure the wallet for signet, and initialize it.import {
generateMnemonic,
Config,
Network,
Wallet,
} from '@secondts/bark-react-native';
import { Directory, Paths } from "expo-file-system";
const BARK_DIR = ".bark";
// Generate a new mnemonic
const mnemonic = generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Configure for signet
const config = Config.create({
serverAddress: 'https://ark.signet.2nd.dev',
esploraAddress: 'https://esplora.signet.2nd.dev',
network: Network.Signet,
bitcoindAddress: undefined,
bitcoindCookiefile: undefined,
bitcoindUser: undefined,
bitcoindPass: undefined,
vtxoRefreshExpiryThreshold: undefined,
vtxoExitMargin: undefined,
htlcRecvClaimDelta: undefined,
fallbackFeeRate: undefined,
roundTxRequiredConfirmations: undefined,
daemonFastSyncIntervalSecs: undefined,
daemonSlowSyncIntervalSecs: undefined,
});
// Create the wallet
const dataDir = new Directory(Paths.document, BARK_DIR);
if (!dataDir.exists) dataDir.create();
const dataPath = dataDir.uri.replace("file://", "").replace(/\/+$/, "");
const wallet = await Wallet.create(mnemonic, config, dataPath, false);
import {
generateMnemonic,
Config,
Network,
Wallet,
} from '@secondts/bark-react-native';
import RNFS from 'react-native-fs';
// Generate a new mnemonic
const mnemonic = generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Configure for signet
const config = Config.create({
serverAddress: 'https://ark.signet.2nd.dev',
esploraAddress: 'https://esplora.signet.2nd.dev',
network: Network.Signet,
bitcoindAddress: undefined,
bitcoindCookiefile: undefined,
bitcoindUser: undefined,
bitcoindPass: undefined,
vtxoRefreshExpiryThreshold: undefined,
vtxoExitMargin: undefined,
htlcRecvClaimDelta: undefined,
fallbackFeeRate: undefined,
roundTxRequiredConfirmations: undefined,
daemonFastSyncIntervalSecs: undefined,
daemonSlowSyncIntervalSecs: undefined,
});
// Create the wallet
const dataDir = `${RNFS.DocumentDirectoryPath}/bark_wallet`;
await RNFS.mkdir(dataDir);
const wallet = await Wallet.create(mnemonic, config, dataDir, false);
Back up the mnemonic securely. It is the only way to recover your wallet.
Get a receiving address
Generate an Ark address to receive funds.const address = await wallet.newAddress();
console.log('Ark address:', address);
Send some signet sats to this address using the faucet. Check your balance
Sync the wallet with the Ark server and read your balance.await wallet.sync();
const balance = await wallet.balance();
console.log('Spendable:', balance.spendableSats, 'sats');
Next steps
Source and examples
Full React Native source and example projects on GitLab.
How Ark works
Learn about the protocol powering your wallet.