Tokens on Spark leverages three core concepts which have been central to the value transfer process on Bitcoin and the Lightning network. Understanding these concepts are prerequisites for understanding the token transaction model on Spark.

1. UTXO Model

Token Transactions on Spark draw heavy inspiration from the Bitcoin UTXO model. An L1 token transaction takes a set of inputs and spends them to form a set of outputs which must match the value of the inputs (excluding fees).

2. Partially Signed Bitcoin Transactions (PSBTs)

PSBTs are widely used in Bitcoin L2s, enabling transactions to be signed, authorized, and distributed without immediate on-chain broadcast. Once issued, a valid PSBT cannot be ‘unsigned’ by the creating party if it has already been communicated.

3. Double Spend Prevention with HTLCs & Revocation Keys

Token Transactions on Spark leverage fundamental concepts to disincentivize cheating that are also used in the Lightning Network called ‘Hashed Timelock Contracts (HTLCs)’ and ‘Revocation Keys’ to manage the irreversible transfer of PSBTs from one party to another.

In Lightning, two parties agree on a shared channel state represented by dual unilaterally broadcastable PSBTs. When a payment is made changing the agreed upon channel balance, both parties cooperatively agree on a new version of those PSBTs. However, in order to finalize them- both parties have to agree on ‘revoking’ the old PSBTs. HTLCs and Revocation Keys are what enable the previous channel balance to be securely revoked.

An HTLC in both Lightning and Spark is a bitcoin output with two spending conditions:

  • Spend using a private Revocation Key immediately
  • Spend using the private key of the Owner in X blocks

By providing both of these spending conditions and ensuring the presence of an active Watchtower which checks for malicious parties attempting to broadcast a revoked PSBT on L1, a sender of funds can safely ‘update’ a PSBT by sharing the revocation key associated with an ‘input’ PSBT at the same time that they finalize the creation of an ‘output’ PSBT.