Skip to main content
You’re viewing an old version of the Arkade contracts documentation. Go to Your first contract for the current version.
The compiler is experimental. Do not fund contracts from it with real funds.
Arkade Script is a contract language for Bitcoin. The compiler, arkadec, turns a contract into a JSON artifact with two kinds of spending path: emulator-enforced paths, which use Arkade opcodes, and consensus-enforceable paths in plain Bitcoin Script. An emulator runs an emulator-enforced path’s script before it cosigns a spend. The operator does not enforce Arkade opcodes. The playground runs the compiler in your browser, with example contracts.

Install and run

arkadec prints warnings to stderr and exits with a non-zero status on a type or validation error. --no-optimize skips constant folding, static branch removal, and assembly optimization. Prebuilt binaries are on the releases page.

A first contract

SingleSig.ark
Each function is one way to spend the output:
  • spend has no modifier, so it is a covenant. Its body compiles to Arkade opcodes. The compiler adds a path that needs the operator’s signature and the emulator’s signature: <SERVER_KEY> OP_CHECKSIGVERIFY <EMULATOR_KEY:spend> OP_CHECKSIG. The emulator key is tweaked with the covenant’s script, so it signs only for that covenant.
  • unilateral has the tapscript modifier, so it compiles to one path of plain Bitcoin Script. older(serverExitDelay) waits for the operator’s exit delay. This is the exit path.
The compiler accepts a contract without an exit path and does not warn. Write one, or every spend needs the operator and the emulator.

The artifact

The artifact lists the constructor inputs, and for each function its Arkade opcodes and its paths, as templates. A wallet fills the templates with the constructor arguments to get the address. Keep the artifact you used for an address: the path order fixes the address. @arkade-os/sdk 0.4 does not read the current artifact format, which fills the exit delay from the <SERVER_EXIT_DELAY> placeholder. The v0.5 docs show how to load an artifact and spend it. The compiler README is the language reference, and examples/ has complete contracts. Arkade Functions lists the built-in functions.