Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pages

# Publishes the static landing page in landing/ to GitHub Pages.
on:
push:
branches: [main]
paths:
- "landing/**"
- ".github/workflows/pages.yml"
workflow_dispatch:

concurrency:
group: pages
cancel-in-progress: false

permissions: {}

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: landing
- id: deployment
uses: actions/deploy-pages@v4
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.1] - 2026-11-30

### Added

- Landing page in `landing/`: a three.js hero of accounts exchanging balanced
debit and credit pairs beside a live append-only ledger tape, with sections
on the guarantees, the life of a transfer, the API, the invariants and their
proofs, the benchmark, known limitations and the quickstart. three.js 0.170.0
is vendored in `landing/vendor`; nothing loads from a CDN.
- `Pages` workflow: publishes `landing/` to GitHub Pages on pushes to `main`.

No change to the service, its API or its schema.

## [0.2.0] - 2026-11-26

### Added
Expand Down Expand Up @@ -71,7 +84,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Docker image, `docker compose` stack, k6 benchmark, and CI through the
shared `ci-workflows` pipelines.

[Unreleased]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.0...HEAD
[Unreleased]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.1...HEAD
[0.2.1]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/CtrlAltDevelop/ledger-service/releases/tag/v0.1.0
244 changes: 244 additions & 0 deletions landing/index.html

Large diffs are not rendered by default.

202 changes: 202 additions & 0 deletions landing/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
import * as THREE from "three";
import { recordTransfer } from "./tape.js";

// Accounts are nodes. Every transfer sends a debit coin and a credit coin on
// the same journey; when they land, the pair is written to the tape and the
// node rings once. The scene always balances.

const NODE_COUNT = 9;
const RADIUS = 5;
const MAX_TRANSFERS = 12;
const SPAWN_EVERY_S = 0.9;
const TRANSFER_S = 2.4;
const CREDIT = 0xd9f36b;
const DEBIT = 0xff8a5c;
const FOG = 0x0b0f0d;
const TAU = Math.PI * 2;

const canvas = document.getElementById("scene");
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;

let renderer = null;
try {
renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
} catch {
// No WebGL: the page works fine without the backdrop.
}
if (renderer) start(renderer);

function glowTexture() {
const c = document.createElement("canvas");
c.width = c.height = 64;
const g = c.getContext("2d");
const grad = g.createRadialGradient(32, 32, 0, 32, 32, 32);
grad.addColorStop(0, "rgba(255,255,255,1)");
grad.addColorStop(0.3, "rgba(255,255,255,0.35)");
grad.addColorStop(1, "rgba(255,255,255,0)");
g.fillStyle = grad;
g.fillRect(0, 0, 64, 64);
return new THREE.CanvasTexture(c);
}

function makeGlow(texture, color, size) {
const mat = new THREE.SpriteMaterial({
map: texture, color, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
});
const sprite = new THREE.Sprite(mat);
sprite.scale.setScalar(size);
return sprite;
}

function buildNodes(parent, glow) {
const geo = new THREE.OctahedronGeometry(0.26, 0);
const ringGeo = new THREE.RingGeometry(0.3, 0.33, 40);
return Array.from({ length: NODE_COUNT }, (_, i) => {
const phi = Math.acos(1 - (2 * (i + 0.5)) / NODE_COUNT);
const theta = Math.PI * (1 + Math.sqrt(5)) * i;
const position = new THREE.Vector3(
RADIUS * Math.sin(phi) * Math.cos(theta),
RADIUS * Math.cos(phi) * 0.8,
RADIUS * Math.sin(phi) * Math.sin(theta),
);
const mesh = new THREE.Mesh(geo, new THREE.MeshBasicMaterial({ color: CREDIT, wireframe: true }));
mesh.position.copy(position);
const halo = makeGlow(glow, CREDIT, 1.1);
halo.material.opacity = 0.35;
mesh.add(halo);
const ring = new THREE.Mesh(ringGeo, new THREE.MeshBasicMaterial({
color: CREDIT, transparent: true, opacity: 0, side: THREE.DoubleSide, depthWrite: false,
}));
ring.position.copy(position);
parent.add(mesh, ring);
return { mesh, ring, position, pulse: 0 };
});
}

function buildEdges(parent, nodes) {
const pts = [];
nodes.forEach((a, i) => {
nodes.slice(i + 1).forEach((b) => {
if (a.position.distanceTo(b.position) < RADIUS * 1.3) pts.push(a.position, b.position);
});
});
const geo = new THREE.BufferGeometry().setFromPoints(pts);
parent.add(new THREE.LineSegments(geo, new THREE.LineBasicMaterial({ color: CREDIT, transparent: true, opacity: 0.09 })));
}

function spawnTransfer(parent, nodes, glow) {
const fromIdx = Math.floor(Math.random() * nodes.length);
let toIdx = fromIdx;
while (toIdx === fromIdx) toIdx = Math.floor(Math.random() * nodes.length);
const debit = makeGlow(glow, DEBIT, 0.5);
const credit = makeGlow(glow, CREDIT, 0.5);
parent.add(debit, credit);
return { fromIdx, toIdx, from: nodes[fromIdx], to: nodes[toIdx], debit, credit, progress: 0 };
}

/** Returns true once the transfer has settled. */
function advanceTransfer(tr, dt) {
tr.progress = Math.min(1, tr.progress + dt / TRANSFER_S);
const eased = tr.progress * tr.progress * (3 - 2 * tr.progress);
tr.debit.position.lerpVectors(tr.from.position, tr.to.position, eased);
tr.credit.position.lerpVectors(tr.from.position, tr.to.position, Math.max(0, eased - 0.09));
return tr.progress >= 1;
}

function settleTransfer(parent, tr) {
parent.remove(tr.debit, tr.credit);
tr.debit.material.dispose();
tr.credit.material.dispose();
tr.to.pulse = 1;
recordTransfer(tr.fromIdx, tr.toIdx);
}

function animateNodes(nodes, t, dt, camera) {
nodes.forEach((n, i) => {
n.mesh.rotation.y = t * 0.4 + i;
n.pulse = Math.max(0, n.pulse - dt * 1.2);
n.ring.visible = n.pulse > 0;
n.ring.material.opacity = n.pulse * 0.8;
n.ring.scale.setScalar(1 + (1 - n.pulse) * 3);
n.ring.quaternion.copy(camera.quaternion);
});
}

function start(gl) {
gl.setPixelRatio(Math.min(window.devicePixelRatio, 2));
const scene = new THREE.Scene();
scene.fog = new THREE.Fog(FOG, 9, 22);
const camera = new THREE.PerspectiveCamera(55, 1, 0.1, 100);
const world = new THREE.Group();
scene.add(world);

const glow = glowTexture();
const nodes = buildNodes(world, glow);
buildEdges(world, nodes);
const transfers = [];
const pointer = { x: 0, y: 0 };
let sinceSpawn = SPAWN_EVERY_S;
let running = true;
const clock = new THREE.Clock();

window.addEventListener("pointermove", (e) => {
pointer.x = (e.clientX / window.innerWidth - 0.5) * 2;
pointer.y = (e.clientY / window.innerHeight - 0.5) * 2;
});

function resize() {
const w = window.innerWidth;
const h = window.innerHeight;
gl.setSize(w, h, false);
camera.aspect = w / h;
camera.position.z = w < 860 ? 16 : 11;
// Shift the network left on wide screens so the tape has room.
world.position.x = w >= 860 ? -2.2 : 0;
camera.updateProjectionMatrix();
if (reduceMotion) gl.render(scene, camera);
}
window.addEventListener("resize", resize);
resize();

function frame() {
if (!running) return;
const dt = Math.min(clock.getDelta(), 0.1);
const t = clock.elapsedTime;

world.rotation.y += dt * 0.07;
world.rotation.x += (pointer.y * 0.2 - world.rotation.x) * 0.03;
camera.position.y = -(window.scrollY / Math.max(1, window.innerHeight)) * 1.6;
animateNodes(nodes, t, dt, camera);

sinceSpawn += dt;
if (sinceSpawn > SPAWN_EVERY_S && transfers.length < MAX_TRANSFERS) {
sinceSpawn = 0;
transfers.push(spawnTransfer(world, nodes, glow));
}
for (let i = transfers.length - 1; i >= 0; i--) {
if (advanceTransfer(transfers[i], dt)) {
settleTransfer(world, transfers[i]);
transfers.splice(i, 1);
}
}
gl.render(scene, camera);
requestAnimationFrame(frame);
}

document.addEventListener("visibilitychange", () => {
running = !document.hidden && !reduceMotion;
if (running) { clock.getDelta(); frame(); }
});

if (reduceMotion) {
for (let i = 0; i < 5; i++) {
const tr = spawnTransfer(world, nodes, glow);
tr.progress = 0.3 + Math.random() * 0.4;
advanceTransfer(tr, 0);
}
for (let i = 0; i < 4; i++) recordTransfer(i, i + 3);
gl.render(scene, camera);
} else {
frame();
}
}
Loading