Skip to main content
AirdropCovenant enforces fixed-size BCH/FT claims with permissionless claim submission plus claim-authority co-signing, and authority-only administration. Contract path: contracts/core/distribution/AirdropCovenant.cash CashScript version: ^0.13.0

Constructor Parameters (Bytecode-Embedded)

ParameterTypeDescription
vaultIdbytes32Links to source vault
authorityHashbytes20Controls pause/resume/cancel
claimAuthorityHashbytes20Backend-held claim co-signer hash for eligibility/rate-limit enforcement
amountPerClaimintFixed amount per claim
totalPoolintTotal distribution pool
startTimestampintClaims open time. 0 = immediate.
endTimestampintClaims close time. 0 = no expiry.

NFT State (40 bytes)

[0]:    status
[1]:    flags
[2-9]:  total_claimed (uint64)
[10-17]: claims_count (uint64)
[18-22]: last_claim_timestamp (5 bytes)
[23-39]: reserved

Transaction Structure

All entrypoints spend the covenant UTXO at tx.inputs[0].
FunctionRequired outputsNotes
claimtx.outputs[0] claimant payout, tx.outputs[1] updated covenant UTXOlocktime enforces start/end window and is written into state.
pausetx.outputs[0] updated covenant UTXOStatus ACTIVE -> PAUSED.
resumetx.outputs[0] updated covenant UTXOStatus PAUSED -> ACTIVE.
canceltx.outputs[0] authority payoutCampaign UTXO is consumed (no continuing state output required).

Functions

claim(bytes20 claimerHash, sig claimAuthSig, pubkey claimAuthPubkey)

Claim submission is permissionless. The claimer does not sign; backend claim-authority co-signs after eligibility checks. Validation
  • hash160(claimAuthPubkey) == claimAuthorityHash
  • checkSig(claimAuthSig, claimAuthPubkey)
  • Current status is ACTIVE
  • Time window checks (startTimestamp, endTimestamp) if configured
  • newTotalClaimed = totalClaimed + amountPerClaim must stay <= totalPool
Output rules
  • tx.outputs[0] must pay claimerHash with amountPerClaim (BCH or FT mode by flag bit2).
  • tx.outputs[1] must keep same locking bytecode and token category as input.
  • tx.outputs[1].nftCommitment must encode:
    • updated total_claimed
    • updated claims_count
    • last_claim_timestamp = tx.locktime
    • status = COMPLETED when newTotalClaimed >= totalPool, else ACTIVE

pause(sig authSig, pubkey authPubkey)

resume(sig authSig, pubkey authPubkey)

cancel(sig authSig, pubkey authPubkey)

Authority-only admin paths (hash160(authPubkey) == authorityHash, valid signature). Pause / Resume
  • pause requires status == ACTIVE and cancelable flag bit0 set.
  • resume requires status == PAUSED.
  • Both require output 0 to keep covenant locking bytecode and token category with updated status commitment.
Cancel
  • Allowed only from ACTIVE or PAUSED, with cancelable flag bit0 set.
  • Computes remainingPool = totalPool - totalClaimed, requires remainingPool > 0.
  • tx.outputs[0] must pay authorityHash with remainingPool (BCH or FT mode by flag bit2).