Skip to content

Instantly share code, notes, and snippets.

@mikekeke
Last active February 6, 2023 16:01
Show Gist options
  • Save mikekeke/cbaa2cb126d309b869b8154a023f97b2 to your computer and use it in GitHub Desktop.
Save mikekeke/cbaa2cb126d309b869b8154a023f97b2 to your computer and use it in GitHub Desktop.
seath design

Design with custodial script

The idea is that participants submit action UTXOs and then single "batcher" (as referred in some DEXes) runs those "actions" by submitting transactions that can spend state UTXO. The difference form existing batchers is that batcher - is leader picked among participants in trustless manner.

Step 1

Each participant builds and submits "action" transaction that creates UTXO at custodial script address.

flowchart LR
    subgraph blockchain
    PS["protocol script\n--state UTXO--"]
    CS["Custodial script"]
    end
    subgraph clients
    a -- action UTXO a--> CS
    b -- action UTXO b --> CS
    c -- action UTXO c--> CS
    end
Loading

Step 2

Custodial script holds action UTXOs.

flowchart LR
    subgraph blockchain
    PS["protocol script\n--state UTXO--"]
    CS["Custodial script\n--action UTXO a--\n--action UTXO b--\n--action UTXO c--"]
    end
Loading

Clients run leader selection.

flowchart LR
    subgraph clients
    A["a"]
    B["b"]
    C["c"]
    A <--> B
    C <--> B
    A <--> C
    end
Loading

Step 3

Assuming a was selected as leader, leader pulls action UTXOs from custodial script.

flowchart LR
    subgraph blockchain
    PS["protocol script\n--state UTXO--"]
    CS["Custodial script"]

    end
    subgraph clients
    CS  -- --action UTXO a--\n--action UTXO b--\n--action UTXO c-- --> A["a"]
    B["b"]
    C["c"]
    end
Loading

a builds chain of transactions against state UTXO

flowchart LR
    subgraph a
    CHAIN["Chain of Transactions"]
    UTXOS["--state UTXO a--\n--state UTXO b--\n--action UTXO c--"]
    UTXOS --> CHAIN
    end
Loading

Step 4

Leader submits chain of transactions to apply changes to protocol state UTXO.

flowchart LR
    subgraph blockchain
    PS["protocol script\n--state UTXO--"]
    CS["Custodial script"]
    end
    subgraph clients
    a -- "Chain of Transactions" --> PS
    b
    c
    end
Loading

Chain of Transactions sequenteually updates state at protocol script address.

Questions

  • How participants can be sure that leader performs honest actions, as leader builds transaction on his own?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment