Commit graph

8 commits

Author SHA1 Message Date
Claude
dd04cc9dee
feat(crypto): wire BPP/BPPE/BGE proof verification with real testnet data
Add cn_bpp_verify for Bulletproofs++ (1 delta, bpp_crypto_trait_ZC_out)
used by zc_outs_range_proof in post-HF4 transactions. Distinguish from
cn_bppe_verify (2 deltas, bpp_crypto_trait_Zarcanum) used for Zarcanum
PoS proofs.

Key changes:
- Add deserialise_bpp() and cn_bpp_verify() to bridge.cpp
- Add VerifyBPP() Go wrapper in proof.go
- Wire BPPE and BGE stubs into real C++ verify functions
- Add try/catch to all proof verifiers (C++ throws on invalid points)
- Add nil/empty input guards to all Go proof functions
- Test with real BPP proof from testnet block 101 coinbase tx

The BPP proof from tx 543bc3c2... (first post-HF4 coinbase) verifies
successfully through the full CGo pipeline, confirming wire format
deserialisation matches the C++ daemon output.

Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:37:08 +00:00
Claude
4fe3fdfbd2
feat(crypto): RandomX PoW hash via CGo bridge
Vendor RandomX source, add bridge_randomx_hash() with static
VM lifecycle. Key: LetheanRandomXv1. Input: header_hash || nonce.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 01:01:23 +00:00
Claude
f66ef2e61d
feat(wallet): account key management with Argon2id encryption
GenerateAccount, RestoreFromSeed, RestoreViewOnly with deterministic
view key derivation (sc_reduce32(Keccak256(spend_secret))), matching
C++ account_base::generate(). Encrypted persistence via Argon2id
(time=3, mem=64MB) + AES-256-GCM in go-store.

Adds cn_sc_reduce32 to the CGo bridge for scalar reduction mod l,
required to convert a hash output into a valid Ed25519 secret key.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:14:17 +00:00
Claude
1c763a8c31
feat(crypto): CLSAG ring signatures (GG/GGX/GGXXG) and proof verification stubs
CLSAG_GG generation and verification with flat-buffer ring marshalling.
Cofactor helpers (PointMul8/PointDiv8) for 1/8 premultiplication handling.
CLSAG_GGX and CLSAG_GGXXG verify-only bindings (GGX sig size tests).
Bulletproofs+, BGE, and Zarcanum verification stubs — implementation
deferred to Phase 4 when RPC provides real on-chain proof data.

19 tests pass, 3 skipped (proof stubs), all clean with -race.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 18:47:08 +00:00
Claude
f022e61da9
feat(crypto): standard and ring signature (NLSAG) generation/verification
Standard signature sign/verify round-trip with negative tests (wrong key,
wrong message). Ring signature (NLSAG) uses flat buffer C API to avoid
double-pointer indirection across CGo boundary. Round-trip with 4-member
ring and wrong-message negative test. All 15 tests pass with race detector.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 18:30:53 +00:00
Claude
9821ea4d21
feat(crypto): key derivation, one-time addresses, and key images
Add ECDH shared secret, ephemeral key derivation (DerivePublicKey,
DeriveSecretKey), and key image generation/validation to the CGo bridge.
Tests verify ECDH commutativity, output scanning round-trip, and key
image determinism.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 18:28:43 +00:00
Claude
a68926c45c
feat(crypto): key generation, validation, and secret-to-public derivation
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 18:24:06 +00:00
Claude
1416a6714a
feat(crypto): Phase 2a scaffold — vendored C++ and CMake build
Extract CryptoNote crypto sources from upstream (fa1608cf).
Build as static libcryptonote.a via CMake with compat stubs for
external dependencies (warnings, logging, varint, profiling).

37 upstream files, 10 compat stubs, 680KB static library.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 18:21:44 +00:00