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
Go 1.19+
CGo enabled (default)
C compiler (gcc, clang, or MSVC)
Getting started
Install the SDK
go get gitlab.com/ark-bitcoin/bark-ffi-bindings/golang/bark
Create a wallet
Generate a BIP39 mnemonic, configure the wallet for signet, and initialize it. package main
import (
" fmt "
" os "
" path/filepath "
" gitlab.com/ark-bitcoin/bark-ffi-bindings/golang/bark "
)
func main () {
// Generate a new mnemonic
mnemonic, err := bark. GenerateMnemonic ()
if err != nil {
fmt. Fprintf (os.Stderr, "Error: %v\n " , err)
os. Exit ( 1 )
}
fmt. Printf ( "Mnemonic: %s\n " , mnemonic)
// Helper for optional string fields
strPtr := func ( s string ) * string { return & s }
// Configure for signet
config := bark . Config {
ServerAddress: "https://ark.signet.2nd.dev" ,
EsploraAddress: strPtr ( "https://esplora.signet.2nd.dev" ),
Network: bark.NetworkSignet,
}
// Create a data directory
homeDir, _ := os. UserHomeDir ()
dataDir := filepath. Join (homeDir, ".bark" , "my_wallet" )
os. MkdirAll (dataDir, 0755 )
// Create the wallet
wallet, err := bark. WalletCreate (mnemonic, config, dataDir, false )
if err != nil {
fmt. Fprintf (os.Stderr, "Error: %v\n " , err)
os. Exit ( 1 )
}
defer wallet. Destroy ()
}
Back up the mnemonic securely. It is the only way to recover your wallet.
You must call wallet.Destroy() when you are done with the wallet to free the underlying Rust resources. Use defer wallet.Destroy() immediately after creation.
Get a receiving address
Generate an Ark address to receive funds. address, err := wallet. NewAddress ()
if err != nil {
fmt. Fprintf (os.Stderr, "Error: %v\n " , err)
os. Exit ( 1 )
}
fmt. Printf ( "Ark address: %s\n " , 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. if err := wallet. Sync (); err != nil {
fmt. Fprintf (os.Stderr, "Sync error: %v\n " , err)
os. Exit ( 1 )
}
balance, err := wallet. Balance ()
if err != nil {
fmt. Fprintf (os.Stderr, "Error: %v\n " , err)
os. Exit ( 1 )
}
fmt. Printf ( "Spendable: %d sats \n " , balance.SpendableSats)
Next steps
Source and examples Full Go source and example projects on GitLab.
How Ark works Learn about the protocol powering your wallet.