Skip to main content

ARK v0.2 | Covenant-less, Offline Payments, Client SDKs, and MutinyNet Support... Oh My!

ยท 7 min read

Photo by Aram Photo by Aram on Unsplash

Greetings, Arkonauts! ๐Ÿš€

We're thrilled to announce the release of Ark v0.2, a significant milestone in our journey. This update brings exciting new features and improvements, including covenant-less Ark implementation, offline payments, client SDKs, MutinyNet support, and substantial enhancements to our codebase and documentation.

๐Ÿง What's New?โ€‹

Covenant-less Arkโ€‹

The Go implementation now supports covenant-less Ark, enabling seamless integration with the Bitcoin network. Building on our initial Rust prototype from the previous months, we've successfully merged covenant-less version for Bitcoin in the arkd server and in the ark client, alongside the covenant version for the Liquid Network. This advancement allows users to leverage the Ark protocol on the Bitcoin network without requiring a covenant soft-fork.

The new covenant-less version makes use of an embedded Bitcoin wallet, significantly simplifying deployment and management. We've also added new environment variables to configure arkd running on Bitcoin or Liquid, offering greater flexibility for different use cases. Please note that on Bitcoin only the covenant-less version is supported.

Starting a covenant-less version on Bitcoin RegTest with Docker and Nigiri looks like:

docker run -d --name arkd \
-v ark:/app/wallet-data \
-v arkd:/app/data \
--network nigiri \
-p 7070:7070 \
-e ARK_NETWORK=regtest \
-e ARK_TX_BUILDER_TYPE=covenantless \
-e ARK_ROUND_INTERVAL=5 \
-e ARK_MIN_RELAY_FEE=200 \
-e ARK_NEUTRINO_PEER=bitcoin:18444 \
-e ARK_ESPLORA_URL=http://chopsticks:3000 \
-e ARK_NO_TLS=true \
-e ARK_NO_MACAROONS=true \
ghcr.io/ark-network/ark:latest

To enhance management capabilities, we've introduced new Admin API that allow direct control of the onchain wallet used by the ark server. These APIs enable admin users to initialize and unlock the wallet, retrieve addresses, and check the balance. arkd can now be used as a CLI tool to interact with the wallet consuming the new admin APIs.

In terms of authentication, we've upgraded from BasicAuth to macaroons as the auth layer for admin APIs. This change brings improved security and more granular access control to the system.

While we've made significant progress, it's important to note that some features are still under development for the covenant-less version of the Ark server. These include wallet restoration and vtxo tree sweeping.

Another important thing to note is that the protocol implementation is not fully trustless as designed, yet. Currently, the VTXO tree is signed only by the server while it should be signed also by the users and the server misses APIs to collect such signatures. We're working on it as we speak on these aspects to ensure a robust and feature-complete implementation.

Client SDKsโ€‹

We're excited to introduce new client SDKs that make integrating Ark into your projects easier than ever. We now offer both Go package and WASM binary for JavaScript, allowing web developers to start experimenting and integrating Ark into their wallets and applications.

Our Go SDK allows seamless integration with Go-based projects. Here's a quick example of how to create a new Ark wallet:

GOโ€‹

import (
arksdk "github.com/ark-network/ark/pkg/client-sdk"
filestore "github.com/ark-network/ark/pkg/client-sdk/store/file"
)

func main() {
// Setup the store for the client SDK instance.
storeSvc, err := filestore.NewConfigStore("./alice-ark-datadir")
if err != nil {
fmt.Printf("failed to setup store: %s\n", err)
os.Exit(1)
}

// Setup SDK client for Alice
alice, err := arksdk.NewCovenantlessClient(storeSvc)
if err != nil {
fmt.Printf("failed to setup Alice's ark client: %s\n", err)
os.Exit(1)
}

// Intialize the wallet and connect with the asp
if err := alice.Init(context.Background(), arksdk.InitArgs{
WalletType: "single-key",
ClientType: "rest",
AspUrl: "http://localhost:7070",
Password: "password",
}); err != nil {
fmt.Printf("failed to initialize Alice's ark wallet: %s\n", err)
os.Exit(1)
}

if err := alice.Unlock(context.Background(), "password"); err != nil {
fmt.Printf("failed to unlock Alice's ark wallet: %s\n", err)
os.Exit(1)
}

// Check the balance
balance, err := alice.Balance(context.Background(), false)
if err != nil {
fmt.Printf("failed to retrieve Alice's balance: %s\n", err)
os.Exit(1)
}

fmt.Printf("alice onchain balance: %d\n", balance.OnchainBalance.SpendableAmount)
fmt.Printf("alice offchain balance: %d\n", balance.OffchainBalance.Total)
os.Exit(0)
}

Offline Paymentsโ€‹

We've introduced offline payment support in the Go implementation, significantly enhancing user flexibility. Leveraging the Ruben shortcut as the default Payment protocol, senders can now co-sign transactions with the ASP (Ark Service Provider) and deliver payment requests directly to recipients.

This approach allows recipients to join the next round to enter into the next VTXO tree when they come back online, without needing to be online at the time of the sender's payment request. It's a game-changer for users who need to send payments in areas with limited internet connectivity or unreliable data service.

While this feature represents a significant step forward in terms of liquidity efficiency, it's important to note that it's still under development and has some limitations in its current state.

The implementation is not yet fully trustless, as users and the server don't verify the transactions exchanged within an offline payment. Currently, they trust the counter-party to add valid signatures.
Additionally, the server assumes clients to not act maliciously and doesn't implement strategies to react to adversarial scenarios that could occur during offline payments.

At present, offline payments are implemented only for the covenant-less version of the Ark server running on the Bitcoin chain. We've updated the Ark CLI to use offline payment APIs by default when sending bitcoins off-chain, and we've introduced a new claim command for receivers to join a round and settle their funds.

We're actively working on extending support for these APIs to the covenant version as well. Once this goal is achieved, we plan to deprecate the current SDK API for sending off-chain and making SendAsync and ClaimAsync the default payment protocol.

Integrating offline payments into your projects using the SDK is straightforward. Here's an example of how Alice can send sats to Bob asynchronously, and how Bob can claim them later:

// Alice sends some sats to Bob without joining a round
redeemTx, err := alice.SendAsync(context.Background(), false, []arksdk.Receiver{
{
arksdk.NewBitcoinReceiver(bobOffchainAddr, amount),
}
})
if err != nil {
fmt.Printf("Alice failed to send %d sats Bob: %s", amount, err)
os.Exit(1)
}

// Bob comes online after a while and claims the funds by joiniing a round
time.Sleep(5 * time.Second)

roundTxID, err := bob.ClaimAsync(context.Background(), false)
if err != nil {
fmt.Printf("Bob failed to claim the funds: %s", err)
os.Exit(1)
}

fmt.Printf("Bob claimed the funds in round: %s\n", roundTxID)
os.Exit(0)

MutinyNet Supportโ€‹

We're excited to announce that Ark now includes support for MutinyNet, a custom Bitcoin signet created by the Mutiny team. MutinyNet offers several advantages for developers and testers:

  1. Faster block times: MutinyNet features 30-second block times, significantly speeding up testing and development processes.
  2. Pre-configured infrastructure: It comes with pre-configured lightning nodes, a faucet, a Lightning Service Provider (LSP), and a rapid gossip sync server.
  3. Realistic network simulation: MutinyNet provides a more realistic testing environment compared to regtest, allowing for better validation of features and bug fixes.

To use Ark with MutinyNet, simply configure your arkd to connect to the MutinyNet signet. Here's an example of how to set it up:

docker run -d --name arkd \
-v ark:/app/wallet-data \
-v arkd:/app/data \
-p 7070:7070 \
-e ARK_NETWORK=signet \
-e ARK_TX_BUILDER_TYPE=covenantless \
-e ARK_ROUND_INTERVAL=5 \
-e ARK_MIN_RELAY_FEE=200 \
-e ARK_NEUTRINO_PEER=mutinynet.com:38333 \
-e ARK_ESPLORA_URL=https://mutinynet.com/api \
-e ARK_NO_TLS=true \
-e ARK_NO_MACAROONS=true \
ghcr.io/ark-network/ark:latest

This configuration connects Ark to the MutinyNet signet, allowing you to take advantage of its faster block times and pre-configured infrastructure.

๐Ÿš€ Get Startedโ€‹

Head over to our Developer Portal to explore the latest documentation and resources. We've updated our guides to reflect the new features and improvements in Ark v0.2, making it easier than ever to get started with the protocol.

We recommend following our Quick Start Guide to set up a local Bitcoin regtest network and run the Ark implementation on top of it. This will help you understand the protocol better and test the new features in a controlled environment.

Happy coding, Arkonauts! We can't wait to see what you'll build with Ark v0.2! ๐Ÿ’ป๐ŸŒŸ