Use this prompt to get started quickly.
Prerequisites
- Go 1.19+
- A C compiler on your
PATHfor cgo: GCC or Clang, or MinGW-w64 GCC on Windows - macOS 14+ (Intel or Apple silicon), Linux (x86-64 or ARM64) with glibc 2.34+, or Windows (x86-64)
Getting started
1
Install the SDK
In your module’s directory, run:On macOS, also set this variable in the terminal you build from:
2
Create a wallet
Generate a BIP39 mnemonic, configure the signet endpoints, and open the wallet in a data directory. With Run it with
CreateIfNotExists: true, bark.WalletOpen() creates the wallet on the first launch and reopens it on later ones.Set CreateIfNotExists and RunDaemon to true, as in the sample. Go sets every bool field you leave out to false.main.go
go run . from your module’s directory. If the build fails with undefined: BarkLogger, cgo is off. Put a C compiler on your PATH, check that go env CGO_ENABLED prints 1, and run it again.3
Get a receiving address
Generate an Ark address to receive bitcoin. Add this code at the end of Run
run(), before return nil:go run . to print the address. Send some signet sats to this address using the faucet.4
Check your balance
With Balance amounts are
RunDaemon: true, Bark syncs the wallet in the background while it’s open. Call Sync() when you need an up-to-date balance right away. Add this code after the address code, before return nil:uint64 values.Run go run . again. The program reopens the same wallet and prints your spendable balance in sats.Next steps
Source code
Go bindings source on GitLab.
How Ark works
Learn about the protocol powering your wallet.