Skip to Content
SilluDocs
Developers

Read a wallet's passes

Use Sillu passes in your own site or tool. A few lines of code, free reads, no key and no permission from us.

Why you would

A hiring page, a class dashboard or a community role bot can check what someone has built without asking Sillu anything. The records are on X Layer and reading them is free.

With viem

This is the whole of it. It was run against X Layer as written here before this page was published.

import { createPublicClient, http, parseAbi } from "viem";

const client = createPublicClient({ transport: http("https://xlayerrpc.okx.com") });

const GRADER = "0xA31268555BF9da44d6efe5F812a2B4A21C48eD9D";
const CIRCUITS = "0x99081e1D0CE916Cd5b2c53e769DFC3B000BFE9A4";

const abi = parseAbi([
  "struct Pass { uint256 lessonId; uint256 circuitId; uint64 seedBlock; uint32 testsRun; uint32 gates; uint256 sameDesignAs; }",
  "function passesOf(address learner) view returns (Pass[])",
  "function eval(uint256 circuitId, bytes inputs) view returns (bytes outputs)",
]);

// 1. Every lesson a wallet has passed.
const wallet = "0x7ba9f0169b73fB1766e100E16e5Ed37a925f5f01";
const passes = await client.readContract({ address: GRADER, abi, functionName: "passesOf", args: [wallet] });
for (const pass of passes) {
  console.log(`lesson ${pass.lessonId}: chip ${pass.circuitId}, ${pass.gates} gates, same design as ${pass.sameDesignAs}`);
}

// 2. Run one of those chips yourself. Chip 7 is an XOR gate: inputs A = 1, B = 0, packed low bit first.
const out = await client.readContract({ address: CIRCUITS, abi, functionName: "eval", args: [7n, "0x01"] });
console.log(`XOR(1, 0) = ${out}`);

For that wallet it prints 16 lines, ending with lesson 16: chip 19, 168 gates, same design as 0, and then XOR(1, 0) = 0x01.

What each field tells you

FieldMeaning
lessonIdThe lesson's id in the LessonBook. Read its name with nameOf(lessonId).
circuitIdThe chip's number on the Sillu processor. Run it with eval or step.
testsRunHow many runs the Grader checked when it passed the chip.
seedBlockFor a sampled lesson, the block whose hash picked the drawn runs. Zero when every run was checked.
gatesThe chip's size, counted through the chips inside it.
sameDesignAsAn earlier chip of the same lesson with the same design, or zero if this was the first.

Do not stop at the record

passesOf tells you what the Grader wrote down. If the result matters to you, run the chip. The lesson's tests are public (LessonBook.rowsOf(lessonId)), and comparing the chip's answers with them is a handful of free reads. That is what the verify page does, and its code is in packages/web/src/lib/verify.ts in the repository.

Two things to get right if you do:

  • Ask an endpoint you chose, and treat one that does not answer as "no answer", never as "the chip failed".
  • Public endpoints refuse a read that would use too much gas. Sixty-four beats of the largest chip fit in one call; 256 do not.

Lesson ids

Passes carry LessonBook ids, which are not the same as places in the course: the course's 16 lessons are ids 1 to 11 and 17 to 21. A pass with an id from 12 to 16 is a pass of an earlier edition of a lesson, and it stands. The lessons says why.

On this page