Alpha software: use at your own risk.
executord renews Arkade VTXOs and boards bitcoin while their owner is offline. A wallet registers
a delegation on the addresses of its template inputs; every spend is co-signed only if it satisfies
the template's covenant, by arkd's signer or by a standalone
emulator.
The default templates are registered at startup: renew, board (non-interactive boarding), htlc
and htlc_onchain (the receiver's claim of an HTLC, virtual or onchain) and, when
EXECUTOR_EMULATOR_URL is set, claim (VHTLC claim stream).
Two cosigners can run a covenant, and one daemon serves both: a template picks one by the key its spent leaves name.
<OPERATOR_KEY:fn>is arkd's signer key tweaked by the arkade script offn: arkd's signer runs the covenant and signs, which needs an arkd whose signer emulates. A leaf may name it alone (<OPERATOR_KEY:fn> OP_CHECKSIG), as the defaults intemplates/do, or next to the plain key<OPERATOR_KEY>, which<SERVER_KEY>also names. These are the names the Arkade compiler emits. arkd broadcasts the onchain transactions it cosigns, and cosigns only the collaborative leaves of a confirmed output, not an exit (OP_CHECKSEQUENCEVERIFY) leaf. A contract with several covenants reveals the hashes of those a spend does not run in each input'sArkadeTweakField, so that arkd accepts its whole taptree. The field holds 16 hashes: a template spending a contract with more covenants than that besides the one it runs is refused.<EMULATOR_KEY:fn>is the key of a standalone emulator tweaked the same way, available whenEXECUTOR_EMULATOR_URLis set. arkd settles a leaf only when it names its signer key, so a virtual or proof leaf names<OPERATOR_KEY>next to it, as the defaults intemplates/emulator/do. The emulator's key must differ from arkd's signer key.
A delegation whose spent leaves name both tweaked keys is refused. The two sets of defaults have
different addresses: a wallet moves to the leaves arkd emulates by registering a delegation of
the new template and spending its coins to the new address, while its old delegations keep
renewing as long as EXECUTOR_EMULATOR_URL stays set. The claim stream ships for the standalone
emulator only: its leaf is the one of the VHTLC the swap creates. htlc and htlc_onchain ship for
arkd only: they spend the nonInteractiveClaim leaf of an HTLC locked as a VTXO or as a bitcoin
output. The receiver registers a delegation with the terms of the HTLC and its preimage sealed to
the daemon's sealing key and the template id, and the daemon claims the coin to receiver_program
once it is funded, onchain after one confirmation and for a fee of at most claim_fee_cap_sat. They
leave alone a coin arkd would refuse to claim: one below min_claim_sat or holding less than
min_asset_amount of the asset, and onchain one below min_claim_sat plus claim_fee_cap_sat or
locked with a min_asset_amount.
An artifact the Arkade compiler writes registers as it
is: POST /v1/artifact takes the JSON arkadec produces. The compiler names arkd's signer only,
so arkd runs the covenants of a compiled contract and a standalone emulator does not. The default
contracts arkd emulates are compiled from the .ark sources in
templates/artifacts/: make artifacts compiles them again. htlc.json has
no .ark next to it: the artifact holds its source.
<OPERATOR_EXIT_DELAY>, theoperatorExitDelayof a contract, is arkd's unilateral exit delay, read from arkd at startup: it is part of the address, like arkd's signer key.<CONTRACT:Name(<a>,<b>)>, the program of a contract instantiated withnew Name(a, b), is an argument of the contract besides its constructor. A template gives it under the placeholder without its outer brackets, as abytes32or as the program of one of its outputs:"CONTRACT:SingleSig(<receiver>)": {"program": "payout"}.- A
ScriptPubKeynamedtois given asto.programandto.version.
make regtest-up # nigiri, arkd, emulator, postgres
make run # UI on http://localhost:7081/
make test # unit tests
make test-e2e # end-to-end tests on the regtest stack
make regtest-downIn production use ghcr.io/arkade-os/executor with the variables below, and back up the batch
cosigner and sealing keys.
- Port 7080 is the public API (service.proto).
- Port 7081 is the admin API and UI. It has no authentication, listens on every interface and speaks plain HTTP: keep it private, reachable only through a proxy that authenticates its clients and terminates TLS.
Artifacts and templates are registered on the admin port (POST /v1/artifact,
POST /v1/template). The public port only reads them, unless EXECUTOR_PUBLIC_REGISTRY is true.
On both ports, a REST request other than GET or DELETE carries
Content-Type: application/json.
| Variable | Default | |
|---|---|---|
EXECUTOR_ARK_URL |
arkd gRPC address | required |
EXECUTOR_EMULATOR_URL |
gRPC address of a standalone emulator, for the templates naming <EMULATOR_KEY:fn> |
unset |
EXECUTOR_ELECTRUM_URL |
Electrum server, tcp://host:port or ssl://host:port |
required |
EXECUTOR_DATABASE_URL |
postgres DSN | required |
EXECUTOR_BATCH_COSIGNER_KEY |
private key cosigning arkd's vtxo trees, 32 bytes hex | required |
EXECUTOR_SEALING_KEY |
ECIES private key template secrets are sealed to, 32 bytes hex | required |
EXECUTOR_PORT |
public API port | 7080 |
EXECUTOR_ADMIN_PORT |
admin API and UI port, different from PORT |
7081 |
EXECUTOR_DEFAULT_TEMPLATES |
register the default templates at startup | true |
EXECUTOR_PUBLIC_REGISTRY |
let the public port register artifacts and templates | false |
EXECUTOR_MAX_ARTIFACTS |
cap on registered artifacts; 0 disables |
1000 |
EXECUTOR_MAX_TEMPLATES |
cap on registered templates; 0 disables |
1000 |
EXECUTOR_MAX_DOCUMENT_BYTES |
size limit of an artifact or template document, a request holding 1 MiB at most; 0 disables |
1048576 |
EXECUTOR_PUBLIC_RATE_LIMIT |
requests per second per client address on the public port; 0 disables |
5 |
EXECUTOR_MIN_DELEGATION_EXPIRY |
minimum lead of a delegation's expiry | 24h |
EXECUTOR_EXPIRY_INTERVAL |
how often delegations past their expiry are marked | 1m |
EXECUTOR_OFFCHAIN_CONCURRENCY |
offchain attempts in flight at once | 8 |
EXECUTOR_ATTEMPT_TIMEOUT |
time to build and sign an offchain attempt | 1m |
EXECUTOR_RETRY_DELAY |
wait before the coins of a failed attempt are retried | 1m |
EXECUTOR_INTENTS_PER_BATCH |
intents arkd takes per batch | 128 |
EXECUTOR_INTENT_TIMEOUT |
wait before an intent no batch selected is queued again | 5m |
EXECUTOR_MIN_BATCH_EXPIRY |
shortest batch expiry accepted by executor, a block counting as 10 minutes; 0 disables |
512s |
EXECUTOR_BAN_DURATION |
how long the coins of an intent a batch failed on stay out of the queue | 5m |
EXECUTOR_LANDING_WINDOW |
after a restart or lost batch events, how long an attempt waits to see its coins spent | 5m |
EXECUTOR_RESERVE |
latest a coin enters a batch before its vtxo expires; at least twice INTENT_TIMEOUT |
15m |
EXECUTOR_TEMPLATE_MAX_FAILURES |
consecutive failed attempts that disable a template | 10 |
EXECUTOR_LOOP_STALL |
how long the loop or arkd's batch events may stay silent before /healthz fails |
2m |
EXECUTOR_MAX_DELEGATIONS |
cap on active client delegations; 0 disables |
500000 |
EXECUTOR_MAX_STREAM_CHILDREN |
cap on active delegations spawned by streams; 0 disables |
10000 |
EXECUTOR_MAX_VARIABLES_BYTES |
size limit of one client delegation's variables; 0 disables |
4096 |
EXECUTOR_IDLE_DELEGATION_EXPIRY |
when a client delegation that never held a coin expires; 0 disables |
168h |
EXECUTOR_EVICT_IDLE_AFTER |
at the cap, age from which such a delegation is deleted to make room; 0 disables |
1h |
EXECUTOR_PRUNE_AFTER |
how long after expiry a spawned or never-funded delegation is deleted | 720h |
EXECUTOR_LOG_LEVEL |
logrus level | 4 |
- Batching. A coin's deadline is the later of its due time and its expiry minus
RESERVE. Renewals due by the earliest deadline share one batch, split over consecutive batches aboveINTENTS_PER_BATCH. A boarding coin is registered as soon as its deposit has the confirmations its template asks for.GET /v1/admin/statusshows the queue, the planned batches and the coins forecast to miss their deadline. - Batch checks. Before it cosigns a batch, the daemon checks that arkd's tree pays every
output it registered, with its assets, in leaves its batch cosigner key signs from the root
down, and that the commitment transaction pays the onchain outputs. It does not join a batch
whose expiry is below
MIN_BATCH_EXPIRY: the intents are queued again. - Caps. A registration that meets a full cap first makes room among the delegations serving no coin, and is refused only when none qualifies. A delegation holding an unspent coin is never removed this way.
- Failing templates. A template refused
TEMPLATE_MAX_FAILUREStimes in a row is disabled; a success resets the count. Coins arkd refuses for their state do not count, nor do coins that fees or dust leave unspendable, nor coins the template finds ineligible (one wallet's coins cannot disable a template for the others). - Lost batch events. The daemon resubscribes to arkd with a backoff of up to thirty seconds.
- Electrum limits. A reply above 64 MiB, or more than 32 MiB of notifications waiting, drops the connection: the daemon reconnects and lists its scripts again.
A template with a trigger is registered by the operator as a stream (admin RegisterStream,
ListStreams, CancelStream), not by clients. For every arkd transaction whose extension holds
the trigger's packet, the daemon captures the trigger's variables, checks that the template locks
the output and spawns a delegation that expires after expires_after_seconds.
A default template with a trigger, like claim, starts by itself. For claim, the receiver seals
its terms (preimage, program to pay, least amount) to the daemon's sealing key and the template
id, and the funder puts that ciphertext in the packet. The daemon claims only an output that pays
that program at least that amount.