arkade-os/skills

arkade-regtest

Run Arkade regtest and prove any Arkade contract with one end-to-end test.

View source

How to use

  1. Copy the installation command and review the source package before installing it in your own agent environment.
  2. Check the source document for required tools, credentials and supported hosts.
  3. Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/arkade-os/skills --skill arkade-regtest

Before you start

  • Installation does not include a model subscription, API allowance or permission to access your files.
  • Repository stars and installation counts describe activity, not an independent quality or security test.
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Arkade regtest

This skill is used from a fresh project. Pull the stack. It is not already checked out.

bash
git clone --depth 1 https://github.com/ArkLabsHQ/arkade-regtest.git regtest
printf 'AUTOMINE_INTERVAL=0\n' > .env.regtest
node regtest/regtest.mjs start --env .env.regtest --profile ark --profile emulator

arkade-regtest is Docker images plus a Node CLI: Bitcoin Core, mempool (Esplora under /api), arkd, and the emulator. Docker with the compose plugin, and Node 18 or newer. No npm install inside regtest/. Ignore that directory. start initializes the ark client and seeds it with offchain funds.

One-shot stack

node regtest/regtest.mjs start with no profile flag brings up the full stack. A contract test needs ark and the emulator, as in the clone command above.

Stop with node regtest/regtest.mjs stop (volumes stay). Wipe with node regtest/regtest.mjs clean. The SDK repository's pnpm run regtest:* scripts call this same CLI. Use them only when the working tree is that repository.

AUTOMINE_INTERVAL=0 has to be loaded at start, as in the command above. The CLI reads --env <path> when you pass it, and otherwise the clone's parent .env.regtest or regtest/.env. A value already in the environment wins over those files. The default auto-miner (one block every 600 seconds) moves block-denominated expiry and sweeps under a running test. Mine with node regtest/regtest.mjs mine [n].

Defaults that matter: arkd http://localhost:7070 (admin 7071), Esplora http://localhost:3000/api, emulator http://localhost:7073, arkd wallet http://localhost:6060. The SDK's regtest Esplora default is that /api URL. Bitcoin Core RPC is localhost:18443, user admin1, password 123.

arkd's default locktimes in this stack are below 512, so they are blocks. Public arkd rejects that. An exit leaf written as older(serverExitDelay) takes this operator's unilateralExitDelay. The session fills <SERVER_EXIT_DELAY>. Do not pass an exit delay and do not rewrite csv.type. A constructor int used as older(name) is a raw BIP68 sequence: a block count on this stack, or seconds (a multiple of 512) for public arkd.

Fund

Onchain, from the node wallet. Amount is BTC. --confirm mines one block; without it the coin sits unconfirmed.

bash
node regtest/regtest.mjs faucet <address> 0.001 --confirm

Offchain, the stack's ark client sends sats to an Arkade address. The password in the e2e helpers is secret.

bash
docker exec arkd ark send --to <address> --amount 20000 --password secret

Copy the funding commands this test needs to the bottom of its own file. Do not import the SDK repository's e2e module. A fresh note is redeemed because spent rounds leave notes the balance still shows and ark send cannot spend:

bash
docker exec arkd arkd note --amount 200000
docker exec arkd ark redeem-notes -n <note> --password secret

Run this project's one end-to-end file against the stack you just started. The SDK repository's integration suite is that repo's own suite, not this project's test.

Issue an asset

Fund an offchain wallet first, then wallet.assetManager.issue({ amount }). Skip this when the contract under test locks only sats. The result's assetId is genesis txid plus group index. AssetId.fromString gives txid and groupIndex. Pass those under the constructor's bytes32 and int names. A parameter of type AssetId is name.txid and name.gidx.

A control asset is an issuance of amount 1n. A later issue({ amount, controlAssetId }) mints under that control. Poll getVtxos() until the amount is present. The indexer trails a settle and a mine; waitFor on the vtxo. When a locktime must still be immature, read Bitcoin Core with node regtest/regtest.mjs rpc getblockcount. An Esplora tip lags that height.

One functional test

Do not write unit tests. Do not add a file that compiles the artifact and counts opcodes, and do not add a test per require. Write one end-to-end test against this running stack, and make that one complete.

The test is the contract's real life, in order, in this one file: the stack answers, coins arrive from the faucet, assets are issued only when the contract locks them, the artifact is registered and funded, each spend function a party can run is run, and the indexer shows the coin leaving on vtxo_spent. A continuation pays the next script that function names. A coin whose reading moves is asserted by the amount on the continuing output. A path that must fail is one step in that same test, with the output or the clock the contract rejects.

One of those steps sends sats to the contract address and fails if the UI counts that coin as the contract's position. A direct send creates a second coin beside the one the contract continues. Only a spend that pays the continuation script changes the position the contract tracks.

Virtual txids are not on Esplora. Assert through the indexer. Mine, then ask Esplora, only for an unrolled exit.

A refused emulator signature is a key mismatch when hex.encode(client.emulatorKey) differs from the signerPubkey the emulator serves at /v1/info. hex is from @scure/base. client.emulatorKey is 33 bytes, and signerPubkey is the hex string. Compare those before changing the contract.

If the stack is down, stop. A failing spend will not explain a down arkd. curl -sf http://localhost:7070/v1/info and, when the contract has a covenant, the emulator on port 7073.

Shape of the file

The test is the body of the file. Helpers go at the end. Funding, waiting on the indexer, building constructor args, and decoding an asset id are functions below the test, not a prelude and not a second module of unit tests.

from this repository

More skills

All skills
arkade-os
Community

arkade-product

Decide what an Arkade contract tracks before writing it. Use when a coin, a balance, a standing order, a staging output, or a token right is still unnamed. Run before writing-arkade-contracts. Do not use for arkadec, timelocks, the SDK, or regtest.

1h installs
1
GitHub stars
7
Updated
Oct 31
arkade-os
Community

arkade-product-ui

Build the one next action for an Arkade contract. Use after covenant-viz and arkade-contract, when the screen must follow that picture. Emil's skills are motion after the flow is right. Do not invent a second protocol. Do not use for contract authoring, timelocks, the SDK, or Arkade regtest.

1h installs
1
GitHub stars
7
Updated
Oct 31
arkade-os
Community

covenant-viz

Draw an Arkade covenant as a short README story in mermaid: the coin a person sends, the direct send beside the continuation, the rejected transaction, and who signs versus who can build the server plus the function-tweaked emulator. Use after writing-arkade-contracts, in the same commit as the .ark file. An interactive page is only when a public input changes the payment. Do not use for arkadec, the SDK spend, or the product screen.

1h installs
1
GitHub stars
7
Updated
Oct 31
arkade-os
Community

writing-arkade-contracts

Author and edit an Arkade smart contract in .ark, and compile it with arkadec to an artifact. Use for constructor state, spend functions, tapscript leaves, witnesses, output layouts, oracle checks, recursive beacons, timelocks, and fixed-point arithmetic. Do not use for compiler implementation, spending the artifact, the covenant pictures, the product UI, or Arkade regtest.

1h installs
1
GitHub stars
7
Updated
Oct 31