cred402/media/cred402-near-spend-guard-demo.cast
caelum0x 3dea83a1ac feat: record real NEAR SpendGuard demo video for hackathon submission
Adds scripts/record_near_spend_guard_demo.mjs (npm run
record:near-spend-guard), which asciinema-records the real `npm run
demo:near-spend-guard` terminal session and renders it with agg/ffmpeg.
Ran it for real against the live spendguard-024e8dd6f7.testnet
contract: full build, 18/18 unit tests, sandbox integration test, then
25 real spend_to_seller calls, a real repay_credit_line, a real
top_up_allowance, one more real spend on the same key, a dispute
freeze, and a rejected post-freeze call.

Commits the real artifacts: media/cred402-near-spend-guard-demo.cast
(.gif, .mp4, poster.png). Updates SUBMISSION-CHECKLIST.md to mark the
video done and adds a ready-to-post X caption draft
(X-POST-DRAFT-2026-11-07.md) since no social-posting credentials exist
in this environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-07 04:16:09 +03:00

86 lines
14 KiB
Plaintext

{"version":3,"term":{"cols":80,"rows":24},"timestamp":1794013837,"command":"npm run demo:near-spend-guard","title":"Cred402 SpendGuard — live NEAR Testnet revolving-credit loop","env":{"SHELL":"/bin/zsh"}}
[0.099, "o", "\r\n> cred402@0.1.0 demo:near-spend-guard\r\n> tsx scripts/near_spend_guard_full_demo.ts\r\n\r\n"]
[0.257, "o", "\r\n=== Build contract wasm (cargo near build non-reproducible-wasm) ===\r\n"]
[0.477, "o", "\u001b[1;36m•\u001b[0m Collecting cargo project metadata...\r\n"]
[0.568, "o", "\u001b[1;36m•\u001b[0m \u001b[1;32mdone\u001b[0m\r\n\r\n\u001b[1;36m"]
[0.000, "o", "•\u001b[0m Checking rustc version...\r\n"]
[0.001, "o", "\u001b[32mINFO\u001b[0m: \u001b[36mcontract's near-sdk targets protocol version 88; rustc 1.99.1 accepted (bulk-memory opcodes supported by nearcore VM)\u001b[0m\r\n\u001b[1;36m•\u001b[0m \u001b[1;32mdone\u001b[0m\r\n\r\n\u001b[1;36m•\u001b[0m Checking the host environment...\r\n"]
[0.068, "o", "\u001b[1;36m•\u001b[0m \u001b[1;32mdone\u001b[0m\r\n\r\n"]
[0.000, "o", "\u001b[1;36m•\u001b[0m Generating ABI\r\n"]
[0.176, "o", " │ \u001b[1m\u001b[92m Finished\u001b[0m \u001b]8;;https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles\u001b\\`dev` profile [unoptimized]\u001b]8;;\u001b\\ target(s) in 0.16s\r\n"]
[0.009, "o", "\u001b[1;36m•\u001b[0m Extracting ABI...\r\n"]
[0.308, "o", "\u001b[1;36m•\u001b[0m \u001b[1;32mdone\u001b[0m\r\n\r\n\u001b[1;36m•\u001b[0m Compressing ABI to be embedded..\r\n"]
[0.059, "o", "\u001b[1;36m•\u001b[0m \u001b[1;32mdone\u001b[0m\r\n\r\n\u001b[1;36m•\u001b[0m Building contract\r\n"]
[0.197, "o", " │ \u001b[1m\u001b[92m Finished\u001b[0m \u001b]8;;https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles\u001b\\`release` profile [optimized]\u001b]8;;\u001b\\ target(s) in 0.18s\r\n"]
[0.012, "o", "\r\nModification timestamps of:\r\n | \"/Users/arhansubasi/products/blockhain/cred402/contracts-near/spend_guard/target/wasm32-unknown-unknown/release/spend_guard.wasm\" = SystemTime { tv_sec: 1793894288, tv_nsec: 967510871 }\r\n | \"/Users/arhansubasi/products/blockhain/cred402/contracts-near/spend_guard/target/near/spend_guard.wasm\" = SystemTime { tv_sec: 1793893616, tv_nsec: 354757850 }\r\n"]
[0.000, "o", "\r\n\u001b[1;36m•\u001b[0m Running an optimize for size post-step with wasm-opt --enable-nontrapping-float-to-int --enable-bulk-memory...\r\n"]
[0.745, "o", " \u001b[1;38;2;90;90;90mFinished\u001b[0m wasm-opt -O in 744ms\r\n\u001b[1;36m•\u001b[0m \u001b[1;32mdone\u001b[0m\r\n\r\n"]
[0.001, "o", "\u001b[1;32m✓\u001b[0m Contract successfully built! (in CARGO_NEAR_BUILD_ENVIRONMENT=host)\r\n"]
[0.001, "o", " - Binary: \u001b[1;93m/Users/arhansubasi/products/blockhain/cred402/contracts-near/spend_guard/target/near/spend_guard.wasm\u001b[0m\r\n - "]
[0.000, "o", " Size: \u001b[2;36m172.9 KB (172904 bytes)\u001b[0m\r\n - SHA-256 checksum hex : \u001b[2;32m75800c0274e4a497e1f40ca90d459a73ec4dd15e689e9d3eb90ed37d7ea5c094\u001b[0m\r\n - SHA-256 checksum bs58: \u001b[2;32m8ufwsGPFhxx11vvUJez7YViXJcRokiXf6S6QQso53ism\u001b[0m\r\n"]
[0.000, "o", " - "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", " "]
[0.000, "o", "ABI"]
[0.000, "o", ": "]
[0.000, "o", "\u001b[1;33m/Users/arhansubasi/products/blockhain/cred402/contracts-near/spend_guard/target/near/spend_guard_abi.json"]
[0.000, "o", "\u001b[0m\r\n - Embedded ABI: \u001b[1;33m/Users/arhansubasi/products/blockhain/cred402/contracts-near/spend_guard/target/near/spend_guard_abi.zst"]
[0.000, "o", "\u001b[0m\r\n \u001b[1;36mFinished\u001b[0m cargo near build in 2s\r\n"]
[0.002, "o", "Here is the console command if you ever need to re-run it again:\r\n\u001b[33mcargo\u001b[0m \u001b[33mnear build non-reproducible-wasm\u001b[0m\r\n"]
[0.000, "o", "\r\ncargo-near has a new update available \u001b[2m0.22.0\u001b[0m → \u001b[32m0.23.0\u001b[0m\r\nTo update run: /Users/arhansubasi/.cargo/bin/cargo-near near self-update\r\n"]
[0.010, "o", "\r\n=== Full automated test pass (unit + sandbox) (cargo test) ===\r\n"]
[0.487, "o", "\u001b[1m\u001b[92m Finished\u001b[0m \u001b]8;;https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles\u001b\\`test` profile [unoptimized + debuginfo]\u001b]8;;\u001b\\ target(s) in 0.46s\r\n"]
[0.017, "o", "\u001b[1m\u001b[92m Running\u001b[0m unittests src/lib.rs (target/debug/deps/spend_guard-18accca1f6fba1b1)\r\n"]
[0.030, "o", "\r\nrunning 18 tests\r\n"]
[0.001, "o", "test policy::tests::credit_score_and_interest_stay_in_documented_ranges_across_inputs ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.000, "o", "test policy::tests::credit_line_matches_the_ts_risk_policy_fixture_once_units_align ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.000, "o", "test policy::tests::stake_multiplier_uses_yocto_near_not_the_casper_cspr_divisor ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.000, "o", "test policy::tests::v1_produces_a_positive_line_and_sane_interest ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.069, "o", "test scam_detection::tests::crossing_threshold_freezes_even_without_a_key_to_revoke ... \u001b[32mok\u001b(B\u001b[m\r\ntest exposure::tests::activate_then_decrease_moves_reserved_into_outstanding_then_back_down ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.011, "o", "test scam_detection::tests::below_threshold_does_not_freeze_or_revoke ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.011, "o", "test exposure::tests::release_reservation_never_goes_negative ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.016, "o", "test exposure::tests::ensure_agent_creates_then_only_raises_the_cap ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.015, "o", "test exposure::tests::freeze_blocks_further_reservation ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.008, "o", "test exposure::tests::repay_then_reserve_again_reaches_full_cap_a_second_time ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.010, "o", "test exposure::tests::reserve_exposure_refuses_to_exceed_the_cap ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.004, "o", "test scam_detection::tests::crossing_threshold_releases_the_agents_unspent_reservation ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.007, "o", "test scam_detection::tests::crossing_threshold_with_a_key_schedules_revocation ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.007, "o", "test scam_detection::tests::freezing_an_agent_with_a_partially_spent_line_only_releases_what_is_left ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.001, "o", "test scam_detection::tests::emergency_freeze_also_releases_the_unspent_reservation ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.004, "o", "test spend_key::tests::identity_subaccount_id_is_deterministic_and_lowercased ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[0.007, "o", "test spend_key::tests::mint_spend_key_rejects_a_zero_allowance - should panic ... \u001b[32mok\u001b(B\u001b[m\r\n\r\ntest result: \u001b[32mok\u001b(B\u001b[m. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.17s\r\n\r\n"]
[0.001, "o", "\u001b[1m\u001b[92m Running\u001b[0m tests/sandbox.rs (target/debug/deps/sandbox-36fc52aefe14bfe1)\r\n"]
[0.020, "o", "\r\nrunning 2 tests\r\n"]
[3.568, "o", "test concurrent_spend_to_seller_from_the_same_signer_cannot_double_spend ... \u001b[32mok\u001b(B\u001b[m\r\n"]
[23.570, "o", "test full_spend_guard_loop_earn_policy_cap_spend_dispute_freeze_reject ... \u001b[32mok\u001b(B\u001b[m\r\n\r\ntest result: \u001b[32mok\u001b(B\u001b[m. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 27.14s\r\n\r\n"]
[0.001, "o", "\u001b[1m\u001b[92m Doc-tests\u001b[0m spend_guard\r\n"]
[1.400, "o", "\r\nrunning 0 tests\r\n\r\ntest result: \u001b[32mok\u001b(B\u001b[m. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out"]
[0.000, "o", "; finished in 0.00s\r\n\r\n"]
[0.036, "o", "\r\n=== Live Testnet bonus run against spendguard-024e8dd6f7.testnet ===\r\n"]
[0.117, "o", "Authorizing demo-buyer-1794013870339 with a fresh real ed25519 key (ed25519:Gm6nJbyBJNNQJfRuk7zD1gHY4pB78pSPzdZ24SGwTSaU)...\r\n"]
[2.468, "o", "real on-chain agent record: {\r\n agent_id: \u001b[32m'demo-buyer-1794013870339'\u001b[39m,\r\n sub_account: \u001b[32m'agent-demo-buyer-1794013870339.spendguard-024e8dd6f7.testnet'\u001b[39m,\r\n public_key: \u001b[32m'ed25519:Gm6nJbyBJNNQJfRuk7zD1gHY4pB78pSPzdZ24SGwTSaU'\u001b[39m,\r\n credit_line: \u001b[32m'300000000000000000000000'\u001b[39m,\r\n credit_score: \u001b[33m91\u001b[39m,\r\n interest_rate_bps: \u001b[33m926\u001b[39m,\r\n policy_version: \u001b[33m1\u001b[39m,\r\n key_active: \u001b[33mtrue\u001b[39m\r\n}\r\n"]
[46.204, "o", "real spend attempts: [\r\n { attempt: \u001b[33m1\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m2\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m3\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m4\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m5\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m6\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m7\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m8\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m9\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m10\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m11\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m12\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n "]
[0.000, "o", " { attempt: \u001b[33m13\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m14\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m15\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m16\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m17\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m18\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m19\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m20\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m21\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m22\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m23\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33m24\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m },\r\n { attempt: \u001b[33"]
[0.000, "o", "m25\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m }\r\n]\r\n"]
[0.001, "o", "\r\nRepaying 25 yoctoNEAR of real outstanding exposure for demo-buyer-1794013870339...\r\n"]
[1.082, "o", "exposure after real repay: {\r\n agent_id: \u001b[32m'demo-buyer-1794013870339'\u001b[39m,\r\n outstanding: \u001b[32m'25'\u001b[39m,\r\n reserved: \u001b[32m'299999999999999999999975'\u001b[39m,\r\n max_allowed: \u001b[32m'300000000000000000000000'\u001b[39m,\r\n frozen: \u001b[33mfalse\u001b[39m,\r\n updated_at: \u001b[33m1794013917736209200\u001b[39m\r\n}\r\nTopping up demo-buyer-1794013870339 by the same 25 yoctoNEAR on its SAME live key...\r\n"]
[2.077, "o", "exposure after real top-up: {\r\n agent_id: \u001b[32m'demo-buyer-1794013870339'\u001b[39m,\r\n outstanding: \u001b[32m'0'\u001b[39m,\r\n reserved: \u001b[32m'300000000000000000000000'\u001b[39m,\r\n max_allowed: \u001b[32m'300000000000000000000000'\u001b[39m,\r\n frozen: \u001b[33mfalse\u001b[39m,\r\n updated_at: \u001b[33m1794013920668150800\u001b[39m\r\n}\r\n"]
[2.119, "o", "real spend after top-up (must succeed, on the ORIGINAL key): [ { attempt: \u001b[33m1\u001b[39m, success: \u001b[33mtrue\u001b[39m, detail: \u001b[32m'settled'\u001b[39m } ]\r\n"]
[1.716, "o", "Authorized demo-scammer-1794013924305; simulating a dispute-rate spike...\r\n"]
[2.197, "o", "frozen: \u001b[33mtrue\u001b[39m\r\n"]
[0.065, "o", "key_active: \u001b[33mfalse\u001b[39m\r\n"]
[0.096, "o", "post-freeze spend attempt (must fail): [\r\n {\r\n attempt: \u001b[33m1\u001b[39m,\r\n success: \u001b[33mfalse\u001b[39m,\r\n detail: \u001b[32m'Access key ed25519:ALMnhuytsPY1eG3i6vQNk1YW6qSJKKLc8W3LbGz8Tf6R does not exist at block height 276563295'\u001b[39m\r\n }\r\n]\r\n"]
[0.064, "o", "\r\nLive Testnet loop verified for real: {\r\n contract: \u001b[32m'spendguard-024e8dd6f7.testnet'\u001b[39m,\r\n rpc: \u001b[32m'https://rpc.testnet.fastnear.com'\u001b[39m,\r\n buyer_credit_line: \u001b[32m'300000000000000000000000'\u001b[39m,\r\n real_spends: \u001b[33m25\u001b[39m,\r\n revolving_credit_proved: \u001b[33mtrue\u001b[39m,\r\n scammer_frozen: \u001b[33mtrue\u001b[39m\r\n}\r\n\r\ndemo:near-spend-guard complete.\r\n"]
[0.120, "o", "⠙"]
[0.005, "o", "\u001b[1G\u001b[0K"]
[0.028, "x", "0"]