Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 51 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ amount := uint64(1000)
receivers := []arksdk.Receiver{
arksdk.NewBitcoinReceiver(recipientOffchainAddr, amount),
}
txid, err = arkClient.SendOffchain(ctx, false, receivers)
txid, err = arkClient.SendOffChain(ctx, false, receivers)
if err != nil {
log.Fatal(err)
}
Expand All @@ -172,7 +172,7 @@ log.Infof("Transaction completed: %s", txid)

#### Submit Transaction

`SendOffchain` is useful for simple send operations. But complex contract or collaborative transactions require more flexibility. In this case, you can use the `TransportClient.SubmitTx` and `TransportClient.FinalizeTx` APIs.
`SendOffChain` is useful for simple send operations. But complex contract or collaborative transactions require more flexibility. In this case, you can use the `TransportClient.SubmitTx` and `TransportClient.FinalizeTx` APIs.

```go
// Create a new transport client
Expand Down Expand Up @@ -227,10 +227,10 @@ receivers := []arksdk.Receiver{
arksdk.NewBitcoinReceiver(recipient1OffchainAddr, amount1),
arksdk.NewBitcoinReceiver(recipient2OffchainAddr, amount2),
}
txid, err = arkClient.SendOffchain(ctx, false, receivers)
txid, err = arkClient.SendOffChain(ctx, false, receivers)
```

#### Redeem Funds
#### Cooperative Exit

To move funds from offchain to onchain:

Expand All @@ -242,6 +242,53 @@ if err != nil {
log.Infof("Redeemed with tx: %s", txid)
```

### 5. Additional Client Functions

The `ArkClient` interface exposes a number of utility methods beyond the
basic workflow shown above. Here is a quick overview:

- `GetVersion()` - return the SDK version.
- `GetConfigData(ctx)` - retrieve Ark server configuration details.
- `Init(ctx, args)` / `InitWithWallet(ctx, args)` - create or restore a wallet.
- `IsLocked(ctx)` - check if the wallet is currently locked.
- `Unlock(ctx, password)` / `Lock(ctx)` - unlock or lock the wallet.
- `Balance(ctx, computeExpiryDetails)` - query onchain and offchain balances.
- `Receive(ctx)` - generate onchain, offchain and boarding addresses.
- `SendOffChain(ctx, withExpiryCoinselect, receivers)` - send funds offchain.
- `Settle(ctx, opts ...) (string, error)` - finalize pending or preconfirmed funds into a commitment transaction.

- `RegisterIntent(...)` / `DeleteIntent(...)` - manage spend intents for collaborative transactions.
- `CollaborativeExit(ctx, addr, amount, withExpiryCoinselect, opts ...) (string, error)` - redeem offchain funds onchain.
- `Unroll(ctx) error` - broadcast unroll transactions when ready.
- `CompleteUnroll(ctx, to string) (string, error)` - finalize an unroll and sweep to an onchain address.
- `OnboardAgainAllExpiredBoardings(ctx) (string, error)` - onboard again using expired boarding UTXOs.
- `WithdrawFromAllExpiredBoardings(ctx, to string) (string, error)` - withdraw expired boarding amounts onchain.
- `ListVtxos(ctx) (spendable, spent []types.Vtxo, err error)` - list virtual UTXOs.
- `Dump(ctx) (seed string, error)` - export the wallet seed.
- `GetTransactionHistory(ctx)` - fetch past transactions.
- `GetTransactionEventChannel(ctx)` and `GetVtxoEventChannel(ctx)` - subscribe to wallet events.
- `RedeemNotes(ctx, notes, opts ...)` - redeem Ark notes back to your wallet.
- `SignTransaction(ctx, tx)` - sign an arbitrary transaction.
- `NotifyIncomingFunds(ctx, address)` - wait until a specific offchain address receives funds.
- `Reset(ctx)` - clear local caches and state.
- `Stop()` - stop any running listeners.

### 6. Transport Client

For lower-level control over transaction batching you can use the `TransportClient` interface directly:

- `GetInfo(ctx)` - return server configuration and network data.
- `RegisterIntent(ctx, signature, message)` and `DeleteIntent(ctx, signature, message)` - manage collaborative intents.
- `ConfirmRegistration(ctx, intentID)` - confirm intent registration on chain.
- `SubmitTreeNonces(ctx, batchId, cosignerPubkey, nonces)` and `SubmitTreeSignatures(ctx, batchId, cosignerPubkey, sigs)` - coordinate cosigner trees.
- `SubmitSignedForfeitTxs(ctx, signedForfeitTxs, signedCommitmentTx)` - provide fully signed forfeit and commitment transactions.
- `GetEventStream(ctx, topics)` - subscribe to batch events from the server.
- `SubmitTx(ctx, signedArkTx, checkpointTxs)` and `FinalizeTx(ctx, arkTxid, finalCheckpointTxs)` - submit collaborative transactions.
- `GetTransactionsStream(ctx)` - stream transaction notifications.
- `Close()` - close the transport connection.

See the [pkg.go.dev documentation](https://pkg.go.dev/github.com/arkade-os/go-sdk) for detailed API information.

## Full Example

For a complete end-to-end example demonstrating the usage of the Arkade Go SDK, including setting up multiple clients, boarding, and transferring funds, please refer to our [GitHub repository](https://github.com/arkade-os/go-sdk/blob/master/example/alice_to_bob.go).
Expand Down
16 changes: 0 additions & 16 deletions api-spec/go.mod

This file was deleted.

36 changes: 0 additions & 36 deletions api-spec/go.sum

This file was deleted.

7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ go 1.24.2

replace github.com/btcsuite/btcd/btcec/v2 => github.com/btcsuite/btcd/btcec/v2 v2.3.3

replace github.com/arkade-os/go-sdk/api-spec => ./api-spec

require (
github.com/arkade-os/arkd/pkg/ark-lib v0.0.0-20250708155328-721172a83dba
github.com/arkade-os/go-sdk/api-spec v0.0.0-00010101000000-000000000000
github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.5
Expand All @@ -29,7 +26,9 @@ require (
github.com/timshannon/badgerhold/v4 v4.0.3
github.com/vulpemventures/go-bip32 v0.0.0-20200624192635-867c159da4d7
golang.org/x/crypto v0.36.0
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7
google.golang.org/grpc v1.71.0
google.golang.org/protobuf v1.36.6
modernc.org/sqlite v1.33.1
)

Expand Down Expand Up @@ -148,9 +147,7 @@ require (
golang.org/x/text v0.23.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
Expand Down
Loading