Commit graph

58 commits

Author SHA1 Message Date
Claude
cf20259e96
feat(consensus): block reward with size penalty
BaseReward returns premine at genesis, fixed 1 LTHN otherwise.
BlockReward applies the C++ size penalty using 128-bit arithmetic.
MinerReward handles pre/post HF4 fee treatment.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 00:42:46 +00:00
Claude
fa1c127e12
feat(consensus): scaffold package with error types
Add consensus/ package with doc.go and sentinel error types for all
validation failures. Add MaxTransactionBlobSize constant to config.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 00:39:41 +00:00
Claude
bd8a42562a
docs: Phase 7 consensus rules implementation plan
13-task TDD plan covering block reward, fee extraction, transaction
semantic validation, block validation, PoW verification, signature
verification, and chain sync integration.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 00:35:03 +00:00
Claude
eb039fea38
docs: Phase 7 consensus rules design
Layered validation architecture (structural, economic, cryptographic)
in a standalone consensus/ package. Full hardfork coverage (HF0-HF6),
PoW via CGo bridge, optional signature verification during sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 00:26:58 +00:00
Claude
459ff80f1f
docs: Phase 6 wallet core documentation and integration test
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:32:07 +00:00
Claude
11b50d0491
feat(wallet): orchestrator with sync, balance, and send
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:29:42 +00:00
Claude
b8841a1a3b
feat(wallet): V1Builder for transaction construction with ring signatures
Builder interface with V1Builder that constructs signed v1 transactions.
Handles change outputs, ECDH output key derivation, ring construction
with sorted global indices, and NLSAG signing per input.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:23:33 +00:00
Claude
7e31e706c5
feat(wallet): RPCRingSelector for decoy output selection
RingSelector interface with RPCRingSelector that fetches random outputs
from the daemon, excludes the real output and duplicates, and returns
the requested ring size.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:20:15 +00:00
Claude
359952075a
feat(wallet): V1Scanner with ECDH output detection
Scanner interface with V1Scanner implementation for v0/v1 transactions.
Derives ephemeral keys via ECDH, generates key images, and tracks
coinbase status and unlock times.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:17:22 +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
ff97d51550
feat(wallet): NLSAGSigner with ring signature interface
Signer interface abstracts signature generation for v1/v2+ extensibility.
NLSAGSigner wraps the CGo ring signature functions for v0/v1 transactions.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:08:50 +00:00
Claude
3a5db81e13
feat(rpc): add GetRandomOutputs and SendRawTransaction endpoints
GetRandomOutputs wraps /getrandom_outs1 for ring selection decoys.
SendRawTransaction wraps /sendrawtransaction for tx submission.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:07:00 +00:00
Claude
b7349a054d
feat(wallet): transfer type and go-store persistence
Transfer struct tracks owned outputs with key image, amount, block height,
and spend status. Storage helpers use go-store JSON serialisation keyed by
key image hex. IsSpendable checks coinbase maturity and unlock time.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:05:08 +00:00
Claude
ee257baa83
feat(wallet): TX extra parsing for wallet-critical tags
Parses tags 22 (tx public key), 14 (unlock time), and 11 (derivation
hint) from raw extra bytes. Unknown tags are skipped. Raw bytes preserved
for round-tripping.

Adds PublicKey.IsZero() to types package.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 23:02:13 +00:00
Claude
5b677d1f36
feat(wallet): mnemonic seed encode/decode with Electrum wordlist
24-word Electrum encoding (4 bytes → 3 words × 8 groups) plus CRC32
checksum word. 1626-word dictionary extracted from C++ source.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 22:59:16 +00:00
Claude
b506c9c0a1
docs: Phase 6 wallet core implementation plan
11 tasks covering mnemonic seeds, TX extra parsing, account management,
transfer storage, scanning, signing, ring selection, tx building, and
wallet orchestration. TDD with complete code for every step.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 22:51:19 +00:00
Claude
4a07e6ca70
docs: Phase 6 wallet core design
Interface-driven wallet with Scanner, Signer, Builder, RingSelector
abstractions. v1 NLSAG ships first, v2+ Zarcanum architecture ready.
Full send+receive: key management, output scanning, tx construction,
ring selection via RPC, encrypted key storage in go-store.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 22:29:01 +00:00
Claude
28e3da63cb
test(chain): boost coverage to >80% with multi-block sync and error paths
Add comprehensive tests exercising regular transaction processing through
the sync pipeline (key image marking, output indexing, cumulative
difficulty) and not-found error paths for all query methods. Coverage
rises from 65.8% to 80.1%.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 22:02:10 +00:00
Claude
c2e6b165e7
docs: Phase 5 chain storage and sync client documentation
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:56:05 +00:00
Claude
ef4edd669a
test(chain): integration test syncing first 10 blocks from testnet
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:55:19 +00:00
Claude
23d337e397
feat(chain): RPC sync loop with block processing and indexing
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:53:49 +00:00
Claude
f5822e7222
feat(chain): block header validation (linkage, height, size)
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:50:12 +00:00
Claude
89f5f0ebdf
feat(chain): transaction, key image, and output index operations
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:49:15 +00:00
Claude
d5976d33c3
feat(chain): Chain struct with block storage and retrieval
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:44:57 +00:00
Claude
8cb5cb4ad2
feat(chain): go-store dependency and metadata types
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:42:22 +00:00
Claude
46cf1a747a
docs: Phase 5 chain storage implementation plan
7-task plan covering chain/ package: meta types, block storage,
transaction/output indexing, header validation, sync loop,
integration test, and documentation updates.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:37:27 +00:00
Claude
f5add3c73f
docs: Phase 5 chain storage and sync client design
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:31:55 +00:00
Claude
4e1dd85f8d
docs: Phase 4 RPC client documentation
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:14:41 +00:00
Claude
7d6e67f07d
test(rpc): integration test against C++ testnet daemon
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:14:36 +00:00
Claude
04fcf75ae5
feat(rpc): SubmitBlock endpoint
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:11:44 +00:00
Claude
91e124bc94
feat(rpc): transaction detail and bulk fetch endpoints
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:11:40 +00:00
Claude
e008dc5cfe
feat(rpc): block header and block details endpoints
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:09:40 +00:00
Claude
efbace75a8
feat(rpc): GetInfo, GetHeight, GetBlockCount endpoints
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:09:34 +00:00
Claude
03c11b3bbd
feat(rpc): JSON-RPC 2.0 client transport and response types
Co-Authored-By: Charon <charon@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:07:16 +00:00
Claude
1fdd8d47d7
docs: Phase 4 RPC client implementation plan
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:02:24 +00:00
Claude
c08d5a24b6
docs: Phase 4 RPC client design
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 20:52:30 +00:00
Claude
d33397e6b6
docs: Phase 3 P2P Levin protocol documentation
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:45:28 +00:00
Claude
412272b342
test(p2p): integration test against C++ testnet daemon
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:45:24 +00:00
Claude
074a7333aa
feat(p2p): timed sync and block/tx relay command types
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:41:30 +00:00
Claude
0e5ac70eef
feat(p2p): handshake command with NodeData and peerlist decoding
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:41:25 +00:00
Claude
b3d60948c6
feat(p2p): ping command encode/decode
Add EncodePingRequest (empty section) and DecodePingResponse
(status + peer_id) for the Levin ping command (1003).

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:34:36 +00:00
Claude
3474a98f97
feat(p2p): CORE_SYNC_DATA type and command ID constants
Add CoreSyncData with MarshalSection/UnmarshalSection for portable
storage roundtrip. Re-export Levin command IDs for the CryptoNote
P2P protocol layer.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:34:12 +00:00
Claude
888a0b6fff
feat(config): P2P network IDs and go-p2p dependency
Add NetworkIDMainnet and NetworkIDTestnet 16-byte UUIDs for P2P
handshake, ClientVersion constant, and NetworkID field to ChainConfig.
Add local replace directive for forge.lthn.ai/core/go-p2p.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:33:24 +00:00
Claude
d20fcb39cc
docs: Phase 3 P2P Levin protocol implementation plan
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:20:44 +00:00
Claude
9db3090f89
docs: Phase 3 P2P Levin protocol design
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:10:56 +00:00
Claude
8af95d457a
docs: Phase 2 crypto bridge documentation
Updated architecture.md with crypto/ package details (CGo bridge pattern,
build flow, exposed operations, 1/8 premultiplication semantics).
Updated history.md with Phase 2 completion (files, findings, tests).
Updated CLAUDE.md with CMake build prerequisite.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 18:49:21 +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