caelum0x 7dd0b7facb docs(near-hackathon,soonami): add narrated submission videos + pitch decks
NEAR Hackathon: replace the 4.6s demo video with a 69.8s narrated
version (Deepgram Aura-2 + burned-in captions, -14.5 LUFS / -1.9 dBTP)
covering append -> anchor -> independent raw-RPC re-read -> a real
replay attempt rejected live on-chain, recorded against a freshly
deployed NEAR Testnet account (tx 5YebAM2...ome1t, replay-rejection tx
7v6m81j...469o). Old video kept, not deleted. Adds an 11-slide pitch
deck (PITCH-DECK.md/.pdf/.pptx) mapping the submission to NEAR's own
judging criteria (technical implementation, design, impact,
originality, sustainability, confirmed live from the hackathon FAQ).

soonami Venturethon 11: adds a venture-framed pitch deck
(docs/soonami/PITCH-DECK.md/.pdf/.pptx) covering market, business
model (flagged as an unpriced hypothesis), go-to-market, honest
traction, the 10-day sprint ask, and an explicitly flagged co-founder
placeholder (soonami requires >=2 co-founders; none invented). Reuses
the NEAR demo video per plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 01:05:19 +03:00

286 lines
15 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Ration × NEAR Hackathon 2026 (Nov 1-14, dev deadline Nov 14 23:59 UTC)
**Same person, two separate entries:** the owner of this repo is also submitting
[Cred402](https://github.com/caelum0x/cred402) (`HACKATHON.md`) to the
**Agent Economy** track in this same NEAR Hackathon. The two submissions are
independent — different repos, different NEAR Testnet contracts, no shared code
path — this note exists only to satisfy the hackathon's one-entrant/cross-reference
expectation.
**🎬 Demo video (primary, submission-ready):** [`media/ration-near-demo-2026-11-11.mp4`](media/ration-near-demo-2026-11-11.mp4) —
69.8s, 1920x1080, narrated (Deepgram Aura-2 TTS, burned-in captions,
-14.5 LUFS / -1.9 dBTP). A real, unedited `near-anchor demo` run against
a dedicated, freshly-deployed NEAR Testnet account
(`ration-video-61849d567f.testnet`), **plus** an independent raw-RPC
re-read and a deliberate replay attempt shown being rejected live
on-chain — not just the append+anchor steps. Anchor tx:
[`5YebAM2YRyoneabk8npkH3a8VnnevnLv9NLkBT5ome1t`](https://testnet.nearblocks.io/txns/5YebAM2YRyoneabk8npkH3a8VnnevnLv9NLkBT5ome1t);
replay rejection tx:
[`7v6m81jkbT2K5AjVBbDray9hXWVB2cHvTBWt3Uui469o`](https://testnet.nearblocks.io/txns/7v6m81jkbT2K5AjVBbDray9hXWVB2cHvTBWt3Uui469o)
(failed on-chain exactly as intended — nearcore's own panic:
*"sequence must strictly advance..."*). Pitch deck:
[`PITCH-DECK.md`](PITCH-DECK.md) / `.pdf` / `.pptx` in this same
directory.
**Earlier, shorter recording (kept, not deleted):** [`media/near-demo-2026-11-10.mp4`](media/near-demo-2026-11-10.mp4) —
4.6s, a real, unedited recording of `near-anchor demo` run against a
different dedicated, freshly-deployed NEAR Testnet account
(`ration-demo-23bd92e5.testnet`, created via the free public faucet).
Shows two real audit-log records appended, the chain anchored
on-chain, and the live on-chain anchor independently re-read and
confirmed to match the local chain tip. Anchor tx:
[`z8GWsRVxDykJ55rTKgb4dbN9WTH1UGMzk4NhQfogFrt`](https://testnet.nearblocks.io/txns/z8GWsRVxDykJ55rTKgb4dbN9WTH1UGMzk4NhQfogFrt).
(The repo's primary submission account/contract referenced elsewhere in this
doc, `ration-anchor-286ca315f1.testnet`, is unchanged and separately live —
this demo used its own fresh account specifically so the recording would
start from a clean sequence=0 instead of replaying the primary account's
already-advanced history.)
## Track
**AI Security & Defense** — "Trust, but verify."
Ration's `agent` service is an LLM-driven agentic loop that makes real
financial decisions (bridge-funding an end customer's card against a
late deposit — see `docs/AGENT-DESIGN.md`) inside a deterministic rule
envelope it can never override. Every decision is already journaled
into `audit-log`, a genuine append-only, hash-chained trail
(`sha256(prev_hash || record)`) deliberately kept as a *separate*
durability mechanism from `ledger-core`'s own write-ahead log, so a bug
or compromise in ledger-core cannot also quietly rewrite what the agent
actually did.
The problem this submission closes: that hash chain was, until now,
only verifiable by trusting Ration's own database and whoever operates
it. This submission anchors the chain's current tip on NEAR Testnet, so
anyone — a judge, an auditor, a counterparty, an end customer — can
independently confirm what an LLM-driven agent's financial decisions
looked like at a given point in time, without ever touching Ration's
infrastructure. That is literally "trust, but verify" applied to an AI
agent's own money decisions.
(**Real-World Money** — "bring the boring money onchain" — is also a
genuine fit: Ration is a real fiat-ledger/stablecoin platform, and this
submission is quite literally bringing its own internal audit ledger
onchain. AI Security & Defense is the sharper match because the actual
mechanism being added is a verification/trust primitive, not a payment
rail.)
## What this submission honestly is — and is not
This is a **focused add-on to Ration's existing, already-real system**,
not a NEAR-native rewrite of Ration. Ration's core (ledger-core, the
agent, card-issuance, the whole bridge-funding flow) is unchanged and
runs exactly as it did before this submission — see
`plans/ration-architecture.md` for the full, pre-existing architecture
inventory this submission builds on top of, not around.
What is new is exactly one thing: a way to publish the audit-log's
chain tip to a public, independently-verifiable NEAR Testnet contract,
on demand or periodically, and a way for anyone to check the two sides
agree.
**Proven live on NEAR Testnet (real transactions, not simulated):**
- A real NEAR Testnet account, `ration-anchor-286ca315f1.testnet`,
created via NEAR's public faucet.
- `contracts-near/audit_anchor`'s wasm (108,418 bytes, SHA-256 checksum
`9t3f9kFSvR7bv5JZcouWwWfgMhNxGiswAT36ZTVYy2Bk`) deployed to that
account and initialized — deploy tx
[`FuU26BxiaeiH8jgWmcUrDcCBSu88uGRNLzvsuPhfjcB2`](https://testnet.nearblocks.io/txns/FuU26BxiaeiH8jgWmcUrDcCBSu88uGRNLzvsuPhfjcB2).
The deployed contract's own `code_hash`, independently read back via
`EXPERIMENTAL_tx_status`, matches that checksum exactly — the wasm
that's live on-chain is provably the wasm built in this repo, not a
stand-in.
- Two real audit-log records appended to a real local chain (one
`AgentDecision`, one `LedgerEntry` — the same shapes
`services/agent`/`services/ledger-core` already mirror into
audit-log in production), the chain's integrity re-verified
(`VerifyChain`) after each append.
- The resulting chain tip anchored on-chain — commit tx
[`6Ksmo3LNpdEtKg2JwoVWmrFbnhjY4DJPRnXnQGFfdTNB`](https://testnet.nearblocks.io/txns/6Ksmo3LNpdEtKg2JwoVWmrFbnhjY4DJPRnXnQGFfdTNB)
(sequence 2) — and a **second** real anchor after two more records —
commit tx
[`EC6Puujw4qSURT1a1WX44PSGvnUiT2nnemis1tY2ZbtK`](https://testnet.nearblocks.io/txns/EC6Puujw4qSURT1a1WX44PSGvnUiT2nnemis1tY2ZbtK)
(sequence 4).
- The on-chain `get_latest_anchor()` view independently re-read via raw
`curl` against NEAR's own JSON-RPC (not just this repo's own tool
reporting success) and confirmed byte-for-byte equal to the real
local chain tip both times.
- The contract's replay/regression guard proven live, not just in a
unit test: re-submitting the already-anchored sequence 2 a second
time was rejected **by nearcore itself** — tx
[`3sWNYB5ddbqT5BaUqQfRJXJi8EfHUSJA7k8vgwDvAzPr`](https://testnet.nearblocks.io/txns/3sWNYB5ddbqT5BaUqQfRJXJi8EfHUSJA7k8vgwDvAzPr)
failed with `Smart contract panicked: audit_anchor: sequence must
strictly advance past the last anchored sequence`.
- A real Go integration test
(`services/audit-log/internal/nearanchor/integration_test.go`,
`TestCommitAndVerifyAgainstRealTestnet`) run against this same live
account and contract — commit tx
[`7pM5LsiBa6tbQXS3rEZUm9B3n5Wihinb2K8V7BBnecw8`](https://testnet.nearblocks.io/txns/7pM5LsiBa6tbQXS3rEZUm9B3n5Wihinb2K8V7BBnecw8)
(sequence 5) — not mocked against a fake RPC.
- Final on-chain state as of this writing: `get_anchor_count()` → `3`
(the rejected replay attempt never landed, by design).
**What is still local-only / not yet wired into production:**
- `services/agent`/`services/ledger-core` do not yet call
`near-anchor commit` automatically on a schedule — today it is a
standalone, manually- or cron-invoked tool (`services/audit-log/cmd/near-anchor`),
not wired into docker-compose or `services/agent`'s own poll loop.
Wiring it in is a small, obvious next step (a periodic goroutine or a
cron entry calling the same `nearanchor.CommitAnchor` this CLI
calls), deliberately left undone so this submission's scope stays
honest about what was actually built and tested under the deadline,
not padded with an unverified "also auto-runs in prod" claim.
- The anchor contract stores one global chain tip (plus full history),
not per-tenant chains — because `services/audit-log/internal/store.go`'s
real chain is itself one global, strictly-sequential log (every
tenant's records interleaved), not N independent per-tenant chains.
`tenant_id` is carried through per anchor (whichever tenant's record
most recently advanced the chain) for the same reason audit-log's own
`Record` carries it, but it is not a per-tenant guarantee.
- No NEAR Mainnet transaction was made or claimed — Testnet only, as
instructed.
## What NEAR tooling this submission uses, and how
- **A real NEAR smart contract** (`contracts-near/audit_anchor`,
near-sdk 5.30.1, built with `cargo-near`) — one state-changing method
(`commit_anchor`, with a real monotonic-sequence guard, not just a
pass-through write) and three view methods (`get_latest_anchor`,
`get_anchor_count`, `get_anchor_at`). 5/5 unit tests green
(`cargo test`), including two that specifically assert the
stale/replayed-sequence rejection the live transaction above also
demonstrates.
- **A from-scratch Go NEAR transaction signer**
(`services/audit-log/internal/nearanchor`) — at the time this was
written there was no actively maintained Go SDK for NEAR transaction
signing, so this package Borsh-encodes and ed25519-signs
`Transaction`/`Action`/`SignedTransaction` directly against nearcore's
documented wire format, rather than depending on an unmaintained
third-party Go Borsh library. This repo already hand-rolls its own
binary formats elsewhere (`services/wal`'s C WAL frames,
`services/ledger-core`'s WAL encryption), so this follows the same
house style rather than introducing a new one.
- Cross-checked against the real, official `near-api-js` (not just
against itself): `transaction_test.go` encodes a transaction with
fixed inputs and asserts byte-for-byte equality against a reference
vector generated by actually running
`near-api-js`'s own `createTransaction`/`encodeTransaction`
(vendored in the sibling `~/products/blockhain/cred402` repo, used
here only as a reference oracle — nothing copied). `keys_test.go`
does the same for secret-key parsing against a real
`KeyPair.fromRandom('ed25519')` keypair.
- Talks to NEAR's JSON-RPC directly (`broadcast_tx_commit`, `query`
for view calls and access-key nonces, `block` for the latest
finalized block hash) — no third-party facilitator, no near-cli
dependency (confirmed `near-cli` is not installed in this
environment; this package never shells out to it).
- **The public NEAR Testnet faucet** (`helper.testnet.near.org/account`)
for free, no-captcha account creation — the same endpoint
`~/products/blockhain/cred402`'s own NEAR work already proved works
for named subaccounts.
- **FastNear's public RPC** (`rpc.testnet.fastnear.com`) as the default
— NEAR's own legacy public endpoint (`rpc.testnet.near.org`) now
rate-limits most calls with HTTP 429, the same finding cred402's NEAR
work already documented;
`RATION_NEAR_ANCHOR_RPC_URL` overrides this for any caller who wants
a different (or self-hosted) RPC node.
## How to run it (for judges)
Everything below is real and re-runnable — no mocked RPC, no fake
contract, no staged output.
```bash
git clone https://github.com/caelum0x/ration.git
cd ration
# Run the full existing test suites first — this submission changes
# nothing about Ration's core (confirmed zero regressions):
cd services/ledger-core && cargo test --release && cd -
cd services/audit-log && go test ./... && cd -
# The new contract's own unit tests:
cd contracts-near/audit_anchor && cargo test && cd -
```
**Deploy your own contract account and run the real demo** (needs a
free NEAR Testnet account — no mainnet funds, no payment):
```bash
cd services/audit-log
go build -o /tmp/near-anchor ./cmd/near-anchor
# 1. Create a fresh *.testnet account via the free public faucet:
export RATION_NEAR_ANCHOR_NEW_ACCOUNT_ID=your-choice-$(openssl rand -hex 4).testnet
/tmp/near-anchor create-account
# prints the export lines for the next steps, and writes
# .secrets/near_anchor_credentials.json
# 2. Deploy contracts-near/audit_anchor's wasm to that same account
# and initialize it (build the wasm first if you haven't):
cd ../../contracts-near/audit_anchor && cargo near build non-reproducible-wasm && cd ../../services/audit-log
export RATION_NEAR_ANCHOR_SIGNER_ACCOUNT_ID=<printed above>
export RATION_NEAR_ANCHOR_SIGNER_SECRET_KEY=<printed above>
export RATION_NEAR_ANCHOR_CONTRACT_ID=<same account — deploying to self>
/tmp/near-anchor deploy ../../contracts-near/audit_anchor/target/near/audit_anchor.wasm
# 3. The single-command, end-to-end proof: appends two real audit-log
# records, anchors the real resulting chain tip on NEAR Testnet,
# then independently re-reads both sides to confirm they match:
export RATION_AUDIT_LOG_DATA_DIR=/tmp/ration-near-demo-data
/tmp/near-anchor demo
```
Expected output ends with:
```
near-anchor demo: PASSED — a real audit-log entry was written, the hash chain advanced, the anchor transaction was confirmed on NEAR Testnet, and the on-chain stored hash matches the real local chain tip.
```
**Run the real Go integration test against your own deployed contract**
(same env vars as above, already exported):
```bash
go test ./internal/nearanchor/... -run TestCommitAndVerifyAgainstRealTestnet -v
```
It `SKIP`s cleanly (does not fail) if those env vars are unset — so
`go test ./...` stays green in any environment without NEAR
credentials, while still being a real, non-mocked network test for
anyone who sets them.
**Verify this submission's own already-live account/contract directly,
without running anything**, by querying NEAR's public RPC yourself:
```bash
curl -s https://rpc.testnet.fastnear.com -X POST -H 'Content-Type: application/json' -d \
'{"jsonrpc":"2.0","id":"dontcare","method":"query","params":{"request_type":"call_function","finality":"optimistic","account_id":"ration-anchor-286ca315f1.testnet","method_name":"get_latest_anchor","args_base64":"e30="}}'
```
## What's new in this submission (files)
- `contracts-near/audit_anchor/` — the new NEAR contract (`Cargo.toml`,
`src/lib.rs`), 5/5 unit tests green.
- `services/audit-log/internal/store/tip.go` — `ReadTip`, a read-only
helper that returns the chain's current tip without loading the
whole file (store.go itself, the pre-existing hash-chain
implementation, is untouched — confirmed via `git diff`).
- `services/audit-log/internal/nearanchor/` — the Go NEAR transaction
signer/RPC client/high-level anchor flow (`base58.go`, `borsh.go`,
`keys.go`, `transaction.go`, `rpcclient.go`, `config.go`, `anchor.go`)
plus its tests (`base58_test.go`, `keys_test.go`, `transaction_test.go`,
`integration_test.go`).
- `services/audit-log/cmd/near-anchor/main.go` — the CLI
(`create-account` / `deploy` / `commit` / `verify` / `demo`).
- `.gitignore` — added `contracts-near/*/target/` and `.secrets/` (never
commit a generated testnet private key, even a disposable one).
- This file and `SUBMISSION-CHECKLIST.md`.
Every other file in this repository is unchanged by this submission —
`git diff --stat` against the commit before this work only touches the
files listed above plus `plans/ration-near-hackathon.md` and
`plans/INDEX.md`.