Overview

Ark addresses are a fundamental component of the Arkade ecosystem, enabling instant offchain 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 version number (0 is the only version currently supported)
  3. The server’s x-only public key
  4. The P2TR (Pay-to-Taproot) output key
Prefix

Network identifier: ark (mainnet) or tark (testnet)

Version

Address version number: 0 (1 byte)

Server Key

Ark Service Provider’s x-only public key (32 bytes)

P2TR Key

Taproot output key containing collaborative and exit script paths (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: ark1qqellv77udfmr20tun8dvju5vgudpf9vxe8jwhthrkn26fz96pawqfdy8nk05rsmrf8h94j26905e7n6sng8y059z8ykn2j5xcuw4xt8ngt9rw

Testnet: tark1qqellv77udfmr20tun8dvju5vgudpf9vxe8jwhthrkn26fz96pawqfdy8nk05rsmrf8h94j26905e7n6sng8y059z8ykn2j5xcuw4xt846qj6x

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(65)
  addressData[0] = 0 // version
  addressData.set(serverPubKey, 1)
  addressData.set(vtxoTaprootKey, 33)

  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: