Synthetic demo datademo

Every block, transaction, address and hash on this chain is generated from a fixed seed. None of them exists on any network, and none of these values can be looked up anywhere else. The execution trace is real — it is a recorded Noir program — but it is not the execution of the transaction it is published under.

Verified source

0x7786…f011

0x7786e8534393d0edc5f7bbbefacc4c960b28f011

Verification

Code hash
0x1b553b6102b2054e7efcea7e135b1161c2e10965
Status
full match
Provider
demo-vendored
Compiler
nargo 1.0.0-beta.26
Language
noir
Bundle
sha1:468159733e407c34a4628e8e56f0b1912d0f3e1d

Sources

Nargo.toml7 lines
1[package]
2name = "tour_events"
3type = "bin"
4authors = ["BlockTracer capability tour"]
5
6[dependencies]
7
Prover.toml3 lines
1threshold = "300"
2orders = "4"
3
src/main.nr75 lines
1// TOUR: program output and the event log
2//
3// The subject is the event log — the stream of things the execution SAID, as
4// distinct from the values it held. In this language that stream is `print`,
5// `println` and format strings, and it is the only pane whose content a
6// program author writes directly.
7//
8// The entries are deliberately varied: bare text, a single interpolated value,
9// several values in one line, output from inside a loop, and output from a
10// nested frame — so the log is a sequence a reader can follow rather than the
11// same sentence repeated.
12
13struct Order {
14 id: u32,
15 qty: u32,
16 unit_price: u32,
17}
18
19unconstrained fn line_total(o: Order) -> u32 {
20 let total = o.qty * o.unit_price;
21 // A format string interpolates BINDINGS, not expressions — `{o.qty}` is a
22 // compile error in this language, so the fields are bound first. The
23 // locals that exist only to be printed are worth seeing: they are what
24 // the event log's text is built from.
25 let id = o.id;
26 let qty = o.qty;
27 let price = o.unit_price;
28 // Output from a nested frame: this entry is written while the call trace
29 // is one frame deeper than the entries around it.
30 println(f" line {id}: {qty} x {price} = {total}");
31 total
32}
33
34unconstrained fn apply_discount(total: u32, threshold: u32) -> u32 {
35 if total >= threshold {
36 let discounted = total - (total / 10);
37 println(f" discount applied at threshold {threshold}: {total} -> {discounted}");
38 discounted
39 } else {
40 println(f" no discount: {total} is below {threshold}");
41 total
42 }
43}
44
45unconstrained fn main(threshold: u32, orders: pub u32) -> pub u32 {
46 // A bare string with no interpolation at all.
47 println("=== invoice ===");
48
49 let mut running: u32 = 0;
50
51 // Output from inside a loop: one entry per iteration, each carrying the
52 // iteration's own values, so the log and the loop rail line up rung for
53 // rung.
54 for i in 0..orders {
55 let line_no = i + 1;
56 let o = Order { id: line_no, qty: i + 2, unit_price: 10 + i };
57 let t = line_total(o);
58 running = running + t;
59 println(f" running total after line {line_no}: {running}");
60 }
61
62 // `print` without a newline, then `println` completing the same line —
63 // two events that a reader sees as one sentence.
64 print("subtotal: ");
65 println(running);
66
67 let final_total = apply_discount(running, threshold);
68
69 // Several values interpolated into one entry.
70 println(f"orders={orders} threshold={threshold} subtotal={running} total={final_total}");
71 println("=== end ===");
72
73 final_total
74}
75
This is a circuit, not a contract. It declares no ABI and no storage layout, so there is no interface list and no slot mapping to show. The source above is the whole of what it publishes.

Deployments

This code is deployed at one address. Any other address running the same bytecode would appear here too, already verified.