Skip to content

Instantly share code, notes, and snippets.

@aruokhai
Last active November 26, 2024 15:29
Show Gist options
  • Select an option

  • Save aruokhai/22d67b042c441ff2ac8eb3c1f0bd5bb8 to your computer and use it in GitHub Desktop.

Select an option

Save aruokhai/22d67b042c441ff2ac8eb3c1f0bd5bb8 to your computer and use it in GitHub Desktop.
Ark Liquidity Issue Fix

Ark Liquidity Lock Fix

The unresolved issue of liquidity lock requirements must be addressed before the Ark protocol can be deemed ready for public deployment. This issue pertains specifically to the mechanics of spending outputs within the Ark protocol, which directly impact its scalability and efficiency in managing off-chain transactions.

In the Ark Protocol, a timelock is imposed on non-leaf transactions, allowing the Ark Server to reclaim the associated outputs once the timelock expires. However, this timelock mechanism significantly amplifies the Ark Server's liquidity requirements, as it necessitates maintaining locked funds over extended periods, thereby impacting the system's overall capital efficiency.

To address this issue, I propose utilizing a multi-key address scheme analogous to the structure employed in Silent Payments. This approach not only mitigates the liquidity challenges but also introduces the added advantage of enabling Ark Providers to reorganize and group transactions based on anticipated spending intervals, thereby optimizing liquidity managemnt.

Parties Involved ( Keys )

  • Ark ( A ) --> The Ark Server
  • Bob ( nonce n , Bob_scan_key Bc, Bob_spend_key Bs )
  • Charlie ( nonce n , Charlie_scan_key Cc, Charile_spend_key Cs )

Bob Keys Derivation

  • Bob_nonce (n) = hash(bs.A) + hash(random_secret_known_to_bob)
  • Bob_scan_key (Bc) = (bs.A || random_secret_know_to_bob).G
  • Bob_scan_secret (bc) = (bs.A || random_secret_know_to_bob).G
  • Bob_spend_key (Bs) = bs.G

Note:

  • Bob (n, Bc, Bs) ---> Bob Ark Address
  • Note that a new Ark Address is always generated by the receiver whenever payment is to be made, which (Bs) is expected to be static.

Scenrio (Bob send to Charlie)

In Ark, payments work in such flow: Bob -> Ark -> Charlie (atomic)

  • Bob gives Charlie Ark Address to the Ark Server
  • Server Decodes and derives ( n , Cc, Cs )
  • Server computes k = hash(random_secret_known_to_charlie) = n - hash(a.Cs)
  • Ark creates a leaf transaction and includes a forefeitig tapscript spending condtion for Charlie and Ark:
    • forfeiting_tapscript = OP_SHA256 k OP_EQUAL OP_DATA_32 <asp_pubkey> OP_CHECKSIGVERIFY OP_DATA_32 Cs OP_CHECKSIG.
    • P = NUMS_H + [taproot].G
  • Ark sends fund to P.
  • If Bob also sends fund to Dave, Ark provider then creates a non leaf transaction which includes a key spend path, using Musig key aggregation:
    • Internal_Pubkey = H(Bc, Dc, A). Bc + Dc + A
    • Internal_Privkey = H(Bc, Dc, A). bc + dc + a
    • Q = Internal_Key + [scirpt_path].G The Inernal Key can be created recursively to the root transaction.

Bonus

By ensuring that Bs remains static, the Ark Provider can group transactions more effectively, separating keys with frequent transactions into a distinct branch from those with infrequent transactions. This approach helps to significantly enhance liquidity management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment