argus/contracts/commit-box.cash
Local Dev 9f6dd69bf3 registry covenant v1: the contract that holds a name and enforces its lifecycle (draft)
Expiry was always going to be the chain refusing, not resolvers agreeing. This
is that contract: a certificate sits in a covenant whose address encodes its
owner and expiry, and five paths move it. The owner renews, transfers,
releases or migrates; anyone takes over an expired name at a price that
glides from a premium to a floor, paying the previous owner a share while the
grace period lasts and committing to the name a block ahead.

The two changing values are the last constructor arguments, so they sit first
in the redeem script and the contract re-creates itself by swapping 26 bytes.
A resolver that knows the code can check any claimed owner and expiry against
the address.

Every number comes from registry-lifecycle.js, which was written as the
fixture for this. The tests run each path in libauth's VM under the 2025 and
2026 rules, compare price and split to that model along the glide, and then
break one rule at a time with valid signatures; the suite counts that the VM
itself refused them.

Draft, not reviewed, and not wired into any resolver. REGISTRY-COVENANT-v1.md
says where it departs from the design: script cannot bound a height from
above, so reclaim has no deadline and a commit cannot expire, which leaves
commit hoarding open. That is the first thing a reviewer should read.
2026-10-04 15:42:36 +02:00

26 lines
1.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

pragma cashscript ^0.13.0;
// CommitBox — the "commit" of a commit–reveal takeover
// (Decentralized.DNS/DESIGN-covenant-registry.md §6.3).
//
// A taker creates one of these a block or more BEFORE taking a name over. Its
// address reveals nothing: commitHash = hash256(name ‖ salt). The registry
// covenant rebuilds this script from the taker's key hash and the revealed
// salt, and requires input 1 of the takeover to be locked to it.
//
// The box enforces its own age (this.age), so a takeover cannot be assembled in
// the same block as its commit, and it needs the taker's signature, so nobody
// else can spend it out from under them.
//
// STATUS: chipnet draft, NOT REVIEWED — see name-registry.cash.
contract CommitBox(bytes32 commitHash, bytes20 ownerPkh) {
function spend(pubkey pk, sig s) {
require(hash160(pk) == ownerPkh);
require(checkSig(s, pk));
require(this.age >= 1);
// The commitment is data, not logic: it only has to be part of this
// script so that it is part of the address. (The compiler rejects an
// unused constructor argument.)
require(commitHash.length == 32);
}
}