Overview

Ark addresses are a fundamental component of the Arkade ecosystem, enabling instant off-chain transactions with near-zero fees. This guide explains the structure and technical implementation of Ark addresses.

Address Structure

An Ark address is a bech32m encoding of:

  1. A network prefix (ark for mainnet, tark for test networks)
  2. The P2TR (Pay-to-Taproot) output key
  3. The server’s x-only public key
Prefix
Network identifier: ark (mainnet) or tark (testnet)
P2TR Key
Taproot output key containing collaborative and exit script paths
Server Key
Ark Service Provider’s x-only public key (32 bytes)

Ark Address Components

VTXO Script Paths

A VTXO (Virtual UTXO) is locked by a P2TR script composed of two paths:

  1. Collaborative Path: Requires signatures from both the server and the user
  2. Exit Path: Allows the user to unilaterally withdraw funds after a timelock period

The key path in the P2TR script is always the unspendable key 0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0. This ensures that all spends must reveal the script path.

Like Bitcoin, the taproot tree encoded in the Ark address is revealed only when the VTXO is spent. If it doesn’t pass the server’s validation, the owner won’t be allowed to spend the VTXO off-chain. The unilateral exit would be the only option.

Example Addresses

Here’s an example of how the same components produce different addresses on mainnet and testnet:

P2TR output key: 25a43cecfa0e1b1a4f72d64ad15f4cfa7a84d0723e8511c969aa543638ea9967
Server public key: 33ffb3dee353b1a9ebe4ced64b946238d0a4ac364f275d771da6ad2445d07ae0

Mainnet: ark1x0lm8hhr2wc6n6lyemtyh9rz8rg2ftpkfun46aca56kjg3ws0tsztfpuanaquxc6faedvjk3tax0575y6perapg3e95654pk8r4fjec4q8efp

Testnet: tark1x0lm8hhr2wc6n6lyemtyh9rz8rg2ftpkfun46aca56kjg3ws0tsztfpuanaquxc6faedvjk3tax0575y6perapg3e95654pk8r4fjecs5fyd2

Technical Implementation

The following code demonstrates how to create an Ark address with collaborative and exit script paths:

import { Script, ScriptNum, p2tr, taprootListToTree } from '@scure/btc-signer'
import { TAPROOT_UNSPENDABLE_KEY } from '@scure/btc-signer/utils'
import { bech32m } from 'bech32'
import * as bip68 from 'bip68'


/**
 * Creates a default mainnet Ark address with collaborative and exit script paths
 * @param serverPubKey - Server's x-only public key (32 bytes)
 * @param myPubKey - User's x-only public key (32 bytes)
 * @param timelock - Number of blocks required for unilateral exit
 * @param isTestnet - Whether to use testnet prefix
 * @returns bech32m encoded Ark address
 */
function makeDefaultArkAddress(
  serverPubKey: XOnlyPubKey,
  myPubKey: XOnlyPubKey,
  timelock: number,
  isTestnet: boolean
): string {
  // create collaborative spending path
  const forfeit = Script.decode([
    serverPubKey,
    'CHECKSIGVERIFY',
    myPubKey,
    'CHECKSIG'
  ])
  
  // encode timelock as bip68 sequence
  const sequence = ScriptNum().encode(
    BigInt(bip68.encode({ blocks: timelock }))
  )

  // create unilateral exit path
  const exit = Script.decode([
    sequence,
    'CHECKSEQUENCEVERIFY',
    'DROP',
    myPubKey,
    'CHECKSIG'
  ])
  
  // generate P2TR output key with unspendable key path
  const vtxoTaprootKey = p2tr(
    TAPROOT_UNSPENDABLE_KEY,
    taprootListToTree([forfeit, exit]),
    undefined,
    true
  ).tweakedPubkey

  // combine server pubkey and vtxo taproot key
  const addressData = new Uint8Array(64)
  addressData.set(serverPubKey, 0)
  addressData.set(vtxoTaprootKey, 32)

  return bech32m.encode(
    isTestnet ? 'tark' : 'ark',    // network prefix
    bech32m.toWords(addressData),  // convert to 5-bit words
    1023                           // extends bech32m byte limit
  );
}

How Ark Addresses Work

1

Address Generation

When you create an Arkade wallet, the SDK generates an Ark address that encodes both your public key and the server’s public key.

2

Receiving Funds

When someone sends Bitcoin to your Ark address, they’re creating a VTXO (Virtual UTXO) that can be spent collaboratively off-chain.

3

Collaborative Spending

To spend the VTXO, both you and the Ark server must sign the transaction. This happens automatically when you use the SDK.

4

Unilateral Exit

If the Ark server becomes unavailable, you can still withdraw your funds after the timelock period using the exit script path.

Security Considerations

Ark addresses provide several security guarantees:

  • Self-custody: You always maintain control of your funds through the exit path
  • Timelock protection: The exit path ensures you can recover funds even if the server is unavailable
  • Cryptographic verification: All transactions require valid signatures from authorized parties

Next Steps

Now that you understand Ark addresses, learn how to: