State Machine Formalization

This document formalizes the state transitions and invariants for Dogenals protocols, ensuring consistent indexer behavior.

DMP Marketplace State Machine

States

  • Unlisted: Inscription owned by address, no active list/bid/auction.
  • Listed: Active list intent, awaiting bids or settle.
  • Auction: Active auction intent, accepting bids until expiry.
  • Offered: Private offer or counteroffer pending.
  • Settled: Ownership transferred via valid settle.
  • Invalidated: Provenance gap or invalidation.

Transitions

Unlisted --list--> Listed
Listed --bid--> Listed (with bids)
Listed --settle--> Settled
Listed --cancel--> Unlisted
Auction --bid--> Auction
Auction --settle--> Settled
Auction --cancel--> Unlisted
Offered --accept/decline--> Settled/Unlisted
Any --provenance_gap--> Invalidated

Invariants

  • Ownership verified via UTXO or signature.
  • No double-settle: canonical ordering prevents replay.
  • Royalty paid on settle if collection specifies.
  • Platform fee deducted if present.

Mermaid Diagram

stateDiagram-v2
    [*] --> Unlisted
    Unlisted --> Listed: list
    Listed --> Listed: bid
    Listed --> Settled: settle
    Listed --> Unlisted: cancel
    Auction --> Auction: bid
    Auction --> Settled: settle
    Auction --> Unlisted: cancel
    Offered --> Settled: accept
    Offered --> Unlisted: decline
    note right of Settled : Ownership transferred
    note right of Invalidated : Provenance gap
    Any --> Invalidated: provenance_gap

Edge Cases

Concurrent Bids on Same Listing

  • Scenario: Two bids on the same inscription in the same block.
  • Resolution: Canonical tx order determines winner; later bids are active but not settled until accepted.
  • Invariant: Only one settle per list; indexers must track bid order.

Reorg Invalidating Recent Settle

  • Before: Block N settles inscription X to buyer Y.
  • After Reorg: Block N removed; inscription X returns to seller Z.
  • Resolution: Rollback state to pre-settle, replay from fork point.
  • Invariant: Reorgs do not allow double-spend; provenance gaps flagged if ownership changes without intent.

Collection Update During Active Auction

  • Scenario: Creator updates collection metadata while auction is live.
  • Resolution: Update applies immediately; auction continues with new metadata.
  • Invariant: Updates are append-only; no retroactive changes to past states.

Provenance Tracking

Gap Detection

  • If ownership changes without valid DMP intent in same tx, flag gap.
  • Indexers maintain UTXO-to-inscription mapping.
  • Reorgs require rollback and replay.

Formal Rules

  • Provenance gap = (ownership_changed ∧ ¬has_valid_intent)
  • Valid intents: settle, transfer with matching txid verification.

DogeTokens State Machine

States

  • Undeployed: Ticker not yet deployed.
  • Deployed: Token exists, minting possible.
  • Minted: Tokens in circulation.

Transitions

Undeployed --deploy--> Deployed
Deployed --mint--> Minted
Minted --transfer--> Minted (balance update)

Invariants

  • First deploy wins.
  • Mint respects lim and max.
  • Transfer deducts from sender balance.

This formalization ensures deterministic, trustless indexing.