Skip to content

Bitcoin Script contract defintions for the Ark protocol using Introspection opcodes

License

Notifications You must be signed in to change notification settings

ark-network/tapscripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ark Taproot Scripts

Script tree

Ark virtual transaction outputs (VTXO) are created by a shared output. This output is enforcing the value to be splitted into a binary tree of other taproot scripts.

graph TD
    A[Shared Out ROOT]
    A --> B[Shared out 1]
    A --> C[Shared out 2]
    B --> D[Shared out 3]
    B --> E[Shared out 4]
    C --> F[Shared out 5]
    C --> G[Shared out 6]
    D --> H((VTXO 1))
    E --> I((VTXO 2))
    F --> J((VTXO 3))
    G --> K((VTXO 4))
Loading

Each node of the diagram is a taproot script.

Shared output script

A shared output is a bitcoin transaction output locked by a taproot script with 2 tapscript closures:

  • Unroll and Boarding scripts use Elements introspections opcodes to force the spending transaction format. The tx creates the next level of the script tree on-chain. Splitting the value into 2 outputs with the children taproot scripts.
  • Sweep lets the Ark Service Provider to spend the whole shared output after a timeout (CSV).

VTXO script

A VTXO taproot script is the last level of the script tree. It should appear on-chain only if the VTXO owner decided to unilaterally exit the Ark. It has 2 tapscript closures:

  • Redeem lets to spend the VTXO onchain after a CSV delay. the delay prevents the ASP to lost a VTXO spent off-chain.
  • Forfeit expects both parties (owner and ASP) to sign the spending transaction. It is used to spend the VTXO off-chain.

Miniscript

The scripts are written using miniscript syntax. You can analyse them using the Elements Miniscript compiler.

install the miniscript-compiler:

cargo install miniscript-compiler

Compile miniscript examples:

make unroll 
make onboarding
make vtxo

About

Bitcoin Script contract defintions for the Ark protocol using Introspection opcodes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published