Skip to content

Commit a492b54

Browse files
committed
validators on eutxo logic diagram
1 parent 421f24a commit a492b54

File tree

2 files changed

+33
-50
lines changed

2 files changed

+33
-50
lines changed

docs/get-started/technical-concepts/eutxo.md

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -112,41 +112,14 @@ EUTXO extends the basic UTXO model in two critical ways:
112112

113113
The EUTXO model combines:
114114

115-
- Smart Contracts (Validator scripts) that define arbitrary validation logic for different conditions like spending, minting, withdrawing etc.
116-
- Datums: Data stored/attached to outputs (UTxO) to carry state
117-
- Redeemers: User-supplied arguments passed to scripts during validation
118-
- Context: Transaction information available to scripts during validation
115+
- **Validator Scripts**: Define arbitrary validation logic for different conditions like spending, minting, withdrawing etc.
116+
- **Datums**: Data stored/attached to outputs (UTxO) to carry state
117+
- **Redeemers**: User-supplied arguments passed to scripts during validation
118+
- **Context**: Transaction information available to scripts during validation
119119

120-
```mermaid
121-
graph TB
122-
subgraph LOCKED[" "]
123-
UTXO["UTXO at Script Address<br/>Value: 100 ADA"]
124-
DATUM["Datum<br/>(state data)"]
125-
end
126-
127-
TX["Transaction<br/>wants to spend this UTXO"]
128-
129-
TX -->|"provides"| REDEEMER["Redeemer<br/>(spending argument)"]
130-
131-
SCRIPT["Validator Script asks:<br/>'Is this transaction allowed<br/>to spend this UTXO?'"]
132-
133-
LOCKED --> SCRIPT
134-
REDEEMER --> SCRIPT
135-
TX -.->|"transaction details visible to script"| SCRIPT
136-
137-
SCRIPT -->|"Yes ✓"| APPROVED["Transaction succeeds<br/>UTXO is spent"]
138-
SCRIPT -->|"No ✗"| REJECTED["Transaction fails<br/>UTXO remains locked"]
139-
140-
style UTXO fill:#e1f5ff
141-
style DATUM fill:#fff9c4
142-
style TX fill:#f5f5f5,stroke:#333,stroke-width:2px
143-
style REDEEMER fill:#ffe0b2
144-
style SCRIPT fill:#e1bee7
145-
style APPROVED fill:#c8e6c9
146-
style REJECTED fill:#ffcdd2
147-
```
148-
149-
*In EUTXO based smart contracts (validators), spending conditions are defined by scripts rather than simple signatures. The transaction provides a redeemer (arbitrary data) that the script validates against the datum and transaction context.*
120+
:::tip Understanding Validators
121+
To understand how smart contracts (validators) work on the EUTXO model and how these components interact, see the [Smart Contracts Overview](/docs/smart-contracts/).
122+
:::
150123

151124
<iframe width="100%" height="325" src="https://www.youtube-nocookie.com/embed/bfofA4MM0QE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture fullscreen"></iframe>
152125

docs/smart-contracts/overview.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,33 @@ Script: f(datum, redeemer, context) = success | failure
7171
Conceptually, you can think of validators as returning true/false, though under the hood they either succeed (returning unit `()`) or fail (throwing an error).
7272

7373
```mermaid
74-
flowchart TD
75-
B{Validator Execution}
76-
B --> C[Datum: Contract State]
77-
B --> D[Redeemer: User Input]
78-
B --> E[Context: Transaction Info]
79-
C --> F[Validation Logic]
80-
D --> F
81-
E --> F
82-
F --> G{Result}
83-
G -->|Success| H[Transaction Valid]
84-
G -->|Failure| I[Transaction Invalid]
74+
graph TB
75+
subgraph LOCKED[" "]
76+
UTXO["UTXO at Script Address<br/>Value: 100 ADA"]
77+
DATUM["Datum<br/>(state data)"]
78+
end
8579
86-
style C fill:#f5f5f5,stroke:#333,stroke-width:2px,color:#000
87-
style D fill:#f5f5f5,stroke:#333,stroke-width:2px,color:#000
88-
style E fill:#f5f5f5,stroke:#333,stroke-width:2px,color:#000
89-
style H fill:#e8f5e8,stroke:#28a745,stroke-width:2px,color:#000
90-
style I fill:#f8d7da,stroke:#dc3545,stroke-width:2px,color:#000
80+
TX["Transaction<br/>wants to spend this UTXO"]
81+
82+
TX -.->|"trying to spend"| UTXO
83+
TX -->|"provides"| REDEEMER["Redeemer<br/>(spending argument)"]
84+
85+
SCRIPT["Validator Script asks:<br/>'Is this transaction allowed<br/>to spend this UTXO?'"]
86+
87+
LOCKED --> SCRIPT
88+
REDEEMER --> SCRIPT
89+
TX -.->|"transaction details visible to script"| SCRIPT
90+
91+
SCRIPT -->|"Yes ✓"| APPROVED["Transaction succeeds<br/>UTXO is spent"]
92+
SCRIPT -->|"No ✗"| REJECTED["Transaction fails<br/>UTXO remains locked"]
93+
94+
style UTXO fill:#e1f5ff
95+
style DATUM fill:#fff9c4
96+
style TX fill:#f5f5f5,stroke:#333,stroke-width:2px
97+
style REDEEMER fill:#ffe0b2
98+
style SCRIPT fill:#e1bee7
99+
style APPROVED fill:#c8e6c9
100+
style REJECTED fill:#ffcdd2
91101
```
92102

93103
Consider the analogy of a simple function: `f(x) = x * a + b`

0 commit comments

Comments
 (0)