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
- Android: API 24+ (Android 7.0), Kotlin 1.9+
- JVM: OpenJDK 17+, Kotlin 1.9+
Getting started
Install the SDK
Add the GitLab Maven registry and the Bark dependency to your Gradle project.In your root settings.gradle.kts:dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://gitlab.com/api/v4/projects/78057981/packages/maven") }
}
}
In your module build.gradle.kts:dependencies {
implementation("tech.second.bark:bark-android:0.3.0+bark.0.1.1")
}
In your build.gradle.kts:repositories {
mavenCentral()
maven { url = uri("https://gitlab.com/api/v4/projects/78057981/packages/maven") }
}
dependencies {
implementation("tech.second.bark:bark-jvm:0.3.0+bark.0.1.1")
}
Create a wallet
Generate a BIP39 mnemonic, configure the wallet for signet, and initialize it.import uniffi.bark.*
import kotlinx.coroutines.runBlocking
import java.nio.file.Paths
fun main() = runBlocking {
// Generate a new mnemonic
val mnemonic = generateMnemonic()
println("Mnemonic: $mnemonic")
// Configure for signet
val config = Config(
serverAddress = "https://ark.signet.2nd.dev",
esploraAddress = "https://esplora.signet.2nd.dev",
bitcoindAddress = null,
bitcoindCookiefile = null,
bitcoindUser = null,
bitcoindPass = null,
network = Network.SIGNET,
vtxoRefreshExpiryThreshold = null,
vtxoExitMargin = null,
htlcRecvClaimDelta = null,
fallbackFeeRate = null,
roundTxRequiredConfirmations = null,
daemonFastSyncIntervalSecs = null,
daemonSlowSyncIntervalSecs = null
)
// Create a data directory
val dataDir = Paths.get(
System.getProperty("user.home"), ".bark", "my_wallet"
)
java.io.File(dataDir.toString()).mkdirs()
// Create the wallet
val wallet = Wallet.create(
mnemonic = mnemonic,
config = config,
datadir = dataDir.toString(),
forceRescan = false
)
}
Back up the mnemonic securely. It is the only way to recover your wallet.
On Android, wallet operations are suspend functions. Call them from a coroutine (e.g. withContext(Dispatchers.IO)) to keep the main thread free.
Get a receiving address
Generate an Ark address to receive funds.// Inside a coroutine (e.g. runBlocking, or withContext on Android)
val address = wallet.newAddress()
println("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.// Inside a coroutine
wallet.sync()
val balance = wallet.balance()
println("Spendable: ${balance.spendableSats} sats")
Next steps
Source and examples
Full Kotlin source and example projects on GitLab.
How Ark works
Learn about the protocol powering your wallet.