Commit graph

194 commits

Author SHA1 Message Date
Claude
ff00a29e08
feat(daemon): add 6 more RPC methods — 17 total
Some checks failed
Security Scan / security (push) Successful in 13s
Test / Test (push) Failing after 34s
New methods: getblockheaderbyhash, on_getblockhash, get_tx_details,
get_blocks_details, get_alias_reward, get_est_height_from_date

Total: 17 JSON-RPC methods + 3 HTTP endpoints = 20 API endpoints.
Covers all read operations the explorer, LNS, and status bot need.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:34:06 +01:00
Claude
0320f2828f
feat(chain): add genesis-based network auto-detection
Some checks failed
Security Scan / security (push) Successful in 13s
Test / Test (push) Failing after 33s
chain.DetectNetwork(hash) returns "mainnet", "testnet", or "unknown".
Known genesis hashes stored as constants. Eliminates runtime ambiguity
about which network a node is connected to — the genesis block IS
the network identity.

Binary name encodes the build variant, genesis encodes the network:
  lthn (mainnet genesis) vs core-chain (testnet genesis)

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:30:58 +01:00
Claude
9befee1264
feat(wallet): add transfer command, build tags for CoreIDE
Some checks failed
Security Scan / security (push) Successful in 12s
Test / Test (push) Failing after 31s
wallet transfer: send LTHN via C++ wallet RPC proxy.
  core-chain wallet transfer --to iTHN... --amount 1.5

Build tag `blockchain` added to command files. CoreIDE discovers
c.Command() registrations when tag is active, enabling custom
CoreApp builds with blockchain features as a picklist.

  go build -tags blockchain .

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:22:19 +01:00
Claude
28e1536d36
refactor(logging): migrate commands to core.Print(nil, ...)
Some checks failed
Security Scan / security (push) Successful in 13s
Test / Test (push) Failing after 32s
Top-level commands (serve, wallet, asset, service) now use
core.Print(nil, ...) for package-level logging without Core instance.
Chain internals keep log.Printf (pure package, no Core dependency).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:18:37 +01:00
Claude
01c9a37902
feat(wallet): add restore from seed command
Some checks failed
Security Scan / security (push) Waiting to run
Test / Test (push) Failing after 37s
core-chain wallet restore --seed "25 words..." --wallet-file path
Verified: create → seed → restore produces identical iTHN address.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:11:25 +01:00
Claude
2f8d7357bd
feat(daemon): add legacy mining + getheight HTTP endpoints
Some checks failed
Security Scan / security (push) Successful in 12s
Test / Test (push) Failing after 29s
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:02:57 +01:00
Claude
00d6de64eb
feat(daemon): add get_alias_by_address, get_asset_info RPC methods
Some checks are pending
Security Scan / security (push) Waiting to run
Test / Test (push) Waiting to run
11 total RPC methods now served by the Go daemon:
getinfo, getheight, getblockcount, getblockheaderbyheight,
getlastblockheader, get_all_alias_details, get_alias_details,
get_alias_by_address, get_asset_info

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:02:22 +01:00
Claude
944291934e
feat(asset): add RPC client + CLI for confidential assets (HF5)
Some checks failed
Security Scan / security (push) Successful in 12s
Test / Test (push) Failing after 40s
rpc/assets.go: DeployAsset, EmitAsset, BurnAsset, GetAssetInfo
daemon/server.go: get_asset_info RPC method (native LTHN + custom assets)
cmd_deploy_itns.go: CLI command to deploy ITNS trust token
cmd/core-chain: register asset command group

Ready for HF5 activation — `core-chain asset deploy-itns` deploys
the ITNS token via the wallet RPC.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 00:59:18 +01:00
Claude
0634e29d62
feat(service): register blockchain as Core service with actions
Some checks failed
Security Scan / security (push) Waiting to run
Test / Test (push) Failing after 37s
BlockchainService with lifecycle (start/stop), background sync,
RPC daemon, and 6 Core actions:
  blockchain.height, blockchain.info, blockchain.block,
  blockchain.aliases, blockchain.alias, blockchain.wallet.create

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 00:53:24 +01:00
Claude
07caca7b25
feat(p2p): add missing response encoders for P2P listener
Some checks failed
Security Scan / security (push) Successful in 11s
Test / Test (push) Failing after 39s
HandshakeResponse.Encode, HandshakeRequest.Decode,
RequestChain.Decode, ResponseChainEntry.Encode — all using
go-p2p's EncodeStorage/DecodeStorage.

These enable the Go node to accept incoming P2P connections
and serve blocks to other peers (full seed node capability).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 00:42:30 +01:00
053b6a0a94 Merge pull request 'feat: full testnet sync, RPC daemon, wallet CLI, alias extraction' (#9) from feat/testnet-sync-rpc-wallet into dev
Some checks failed
Security Scan / security (push) Successful in 12s
Test / Test (push) Failing after 34s
2026-04-01 23:34:44 +00:00
Claude
9f20e7a2e8
feat(daemon): add getblockcount RPC, fix method routing
All checks were successful
Security Scan / security (push) Successful in 23s
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 00:33:12 +01:00
Claude
b3b77a618a
feat(wallet): add scan command, balance placeholder, register in CLI
wallet scan scans chain via RPC for owned outputs using ECDH derivation
through CGo crypto. Slow (1 block/RPC call) but functionally complete.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 00:33:12 +01:00
Claude
caf13a1937
feat(blockchain): full testnet sync, RPC daemon, wallet CLI, alias extraction
- wire: add readExtraAliasEntry (tag 33) + readExtraAliasEntryOld (tag 20)
  Unblocks HF4+ Zarcanum transaction deserialization
- chain: alias extraction from transaction extra fields (14/14 on testnet)
- chain: alias storage and retrieval via go-store
- daemon: JSON-RPC server (getinfo, getheight, getblockheaderbyheight,
  getlastblockheader, get_all_alias_details, get_alias_details)
- cmd: `chain serve` — sync from seed + serve RPC simultaneously
- cmd: `wallet create` — generate keys, iTHN address, 24-word seed
- cmd: `wallet address` — show base58-encoded iTHN address
- cmd: `wallet seed` — show mnemonic seed phrase
- cmd: `wallet scan` — scan chain for owned outputs via ECDH derivation

Tested: 11,263 blocks synced in 3m11s from live testnet. All HF0-HF4
validated. 14 aliases extracted. RPC serves correct heights, difficulties,
block headers, and alias data. Wallet generates valid iTHN addresses.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 00:33:12 +01:00
Virgil
fb43a83167 chore(audit): record verification pass
Some checks failed
Security Scan / security (push) Successful in 10s
Test / Test (push) Failing after 20s
Co-Authored-By: Charon <charon@lethean.io>
2026-03-27 03:03:58 +00:00
Virgil
5789325690 fix(blockchain): complete AX v0.8.0 polish pass
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 16:58:23 +00:00
Virgil
61614224eb fix(crypto): support arm64 RandomX builds
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 14:48:43 +00:00
Virgil
96d60484b6 fix(blockchain): upgrade to core v0.8.0-alpha.1 + replace banned imports
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 14:10:18 +00:00
d004158022 Merge pull request '[agent/claude] Migrate module path to dappco.re/go/core/blockchain. Update ...' (#4) from agent/migrate-module-path-to-dappco-re-go-core into main
Some checks failed
Security Scan / security (push) Successful in 9s
Test / Test (push) Failing after 22s
2026-03-22 02:49:31 +00:00
Snider
34128d8e98 refactor: migrate module path to dappco.re/go/core/blockchain
Some checks failed
Security Scan / security (pull_request) Successful in 11s
Test / Test (pull_request) Failing after 19s
Update go.mod module line, all require/replace directives, and every
.go import path from forge.lthn.ai/core/go-blockchain to
dappco.re/go/core/blockchain. Add replace directives to bridge
dappco.re paths to existing forge.lthn.ai registry during migration.
Update CLAUDE.md, README, and docs to reflect the new module path.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 01:49:26 +00:00
Snider
6370d96c31 Merge remote-tracking branch 'github/dev'
Some checks failed
Security Scan / security (push) Successful in 10s
Test / Test (push) Failing after 23s
2026-03-22 00:58:07 +00:00
Snider
2b145d6ebf chore: sync dependencies for v0.1.5
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 17:54:14 +00:00
Snider
abb1e2b748 chore: sync dependencies for v0.1.4
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 17:50:27 +00:00
Claude
97c5510184
refactor: complete coreerr.E() conversion across all packages
Some checks failed
Security Scan / security (push) Successful in 12s
Test / Test (push) Failing after 25s
Convert all remaining fmt.Errorf and errors.New in production code
to coreerr.E(). Covers crypto/ (keygen, signature, clsag, keyimage,
pow), consensus/block, and chain/ring. Only sentinel error definitions
in errors.go and varint.go retain errors.New (correct usage).

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 23:42:51 +00:00
Claude
772cd1b0fd
refactor: convert remaining fmt.Errorf to coreerr.E()
Some checks failed
Security Scan / security (push) Successful in 8s
Test / Test (push) Failing after 22s
Converts the last 3 fmt.Errorf calls in production code (excluding
crypto/ CGo boundary) to coreerr.E() for conventions consistency.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 23:24:53 +00:00
Snider
f19054f7b1 chore: sync dependencies for v0.1.3
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 22:20:06 +00:00
Claude
70fab6f7d0
fix: restore HF5 asset tags, HTLC/multisig inputs, and tx version check after conventions sweep
Some checks failed
Test / Test (push) Failing after 16s
Security Scan / security (push) Failing after 13m58s
The conventions sweep (71f0a5c) overwrote HF5 code and removed HTLC/multisig
input handling. This commit restores:

- wire: HF5 asset wire tags (40/49/50/51) and reader functions for
  asset_descriptor_operation, asset_operation_proof,
  asset_operation_ownership_proof, and asset_operation_ownership_proof_eth
- wire: HTLC and multisig input encode/decode with string field helpers
- consensus: checkTxVersion enforcing version 3 after HF5 / rejecting before
- consensus: HF1-gated acceptance of HTLC and multisig input/output types
- consensus: HTLC key image deduplication in checkKeyImages
- consensus: HTLC ring signature counting in verifyV1Signatures
- chain: corrected error assertion in TestChain_GetBlockByHeight_NotFound

All 14 packages pass go test -race ./...

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 21:32:33 +00:00
Claude
89b0375e18
fix(wire): restore TxOutTarget type switches after conventions sweep
The coreerr.E() sweep reverted the HF1 type assertion changes in
encodeOutputsV1/V2 and decodeOutputsV1/V2. Restores full target
variant support (TxOutToKey, TxOutMultisig, TxOutHTLC) in all four
output functions.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 21:23:48 +00:00
Snider
71f0a5c1d5 refactor: replace fmt.Errorf/os.* with go-io/go-log conventions
Some checks failed
Security Scan / security (push) Successful in 11s
Test / Test (push) Failing after 23s
Replace all fmt.Errorf and errors.New in production code with
coreerr.E("Caller.Method", "message", err) from go-log. Replace
os.MkdirAll with coreio.Local.EnsureDir from go-io. Sentinel errors
(consensus/errors.go, wire/varint.go) intentionally kept as errors.New
for errors.Is compatibility.

270 error call sites converted across 38 files. Test files untouched.
crypto/ directory (CGO) untouched.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 21:17:49 +00:00
Claude
8d41b76db3
feat(consensus): add pre-hardfork transaction freeze for HF5
Some checks failed
Security Scan / security (push) Successful in 8s
Test / Test (push) Failing after 16s
Rejects non-coinbase transactions during the 60-block window before
HF5 activation. Coinbase transactions are exempt. Implements
IsPreHardforkFreeze and ValidateTransactionInBlock.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:59:19 +00:00
Claude
efbf050c1b
feat(consensus): enforce transaction version 3 after HF5
After HF5 activation, only version 3 transactions are accepted.
Before HF5, version 3 is rejected. Matches C++ check_tx_semantic
hardfork gating logic.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:57:54 +00:00
Claude
939ad198fe
test(wire): add v3 transaction round-trip tests with asset operations
Tests v3 transactions containing asset_descriptor_operation (tag 40)
in extra and asset_operation_proof (tag 49) in proofs. Validates
hardfork_id encoding and bit-identical round-tripping.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:56:36 +00:00
Claude
d8e12a1539
feat(wire): add asset proof tags 49, 50, 51 readers
Reads asset_operation_proof, asset_operation_ownership_proof, and
asset_operation_ownership_proof_eth structures. All use CHAIN_TRANSITION_VER
with version byte prefix. Stored as opaque bytes.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:55:33 +00:00
Claude
3e79f34a65
feat(wire): add asset_descriptor_operation tag 40 reader
Reads the CHAIN_TRANSITION_VER structure for asset deploy/emit/update/burn
operations. Stores as opaque bytes for bit-identical round-tripping.
Required for HF5 block deserialisation.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:53:39 +00:00
Claude
9631efa5a8
feat(config): add HardforkActivationHeight helper
Returns the raw activation height for a given hardfork version.
Needed by the pre-hardfork transaction freeze logic.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:51:54 +00:00
Claude
18ceb7fa26
fix(chain): gate difficulty target switch on HF6, not HF2
Some checks failed
Security Scan / security (push) Successful in 8s
Test / Test (push) Failing after 20s
The 240s PoW target was incorrectly gated on HF2 (block 10,080), matching
the Zano upstream where HF2 coincides with the difficulty target change.
Lethean mainnet uses 120s blocks between HF2 and HF6 (999,999,999), so
the gate is corrected to HF6.

Also adds NextPoSDifficulty with the same HF6 gate using the PoS target
constants (DifficultyPosTarget / DifficultyPosTargetHF6). Both public
methods delegate to a shared nextDifficultyWith helper to avoid
duplicating the LWMA window logic.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:47:56 +00:00
Claude
d7917234ed
feat(consensus): add ErrBlockVersion alias and comprehensive block version tests
Add ErrBlockVersion as an alias for ErrBlockMajorVersion for clarity.
Add table-driven tests for expectedBlockMajorVersion covering all
hardfork boundaries (HF0 through HF4+) on both mainnet and testnet
schedules. Add standalone checkBlockVersion tests with Good/Bad/Ugly
pattern including version 255 edge case and exact HF1 boundary checks.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:47:47 +00:00
Claude
6a1f516f5f
test(wire): add HF1 mixed transaction round-trip integration test
Some checks failed
Security Scan / security (push) Successful in 8s
Test / Test (push) Failing after 17s
Verifies that a transaction containing TxInputToKey, TxInputHTLC,
TxInputMultisig inputs with TxOutToKey, TxOutMultisig, TxOutHTLC
output targets survives bit-identical encode/decode round-trip.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:41:28 +00:00
Claude
b1a0e9637b
feat(consensus): validate block major version for HF1
Adds expectedBlockMajorVersion and checkBlockVersion, called from
ValidateBlock before timestamp validation. Block version must match
the fork era: HF0->0, HF1->1, HF3->2, HF4+->3.
Tests cover both mainnet and testnet fork schedules including
boundary heights.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:40:11 +00:00
Claude
f88d582c64
feat(consensus): verify NLSAG signatures for HTLC inputs
verifyV1Signatures now counts and verifies TxInputHTLC alongside
TxInputToKey. HTLC inputs use the same ring signature scheme.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:38:28 +00:00
Claude
192d681ecd
feat(consensus): include HTLC/multisig in fee calculation and key image checks
sumInputs now sums TxInputHTLC.Amount and TxInputMultisig.Amount.
checkKeyImages now checks TxInputHTLC.KeyImage for double-spend.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:37:06 +00:00
Claude
ba29b55644
feat(consensus): gate HTLC and multisig types on HF1
checkInputTypes and checkOutputs now accept hf1Active flag.
HTLC and multisig inputs/outputs are rejected before HF1
(block 10,080) and accepted after.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:36:58 +00:00
Claude
830aa6055e
feat(wire): encode/decode TxOutMultisig and TxOutHTLC targets
Some checks failed
Security Scan / security (push) Successful in 9s
Test / Test (push) Failing after 20s
Adds target variant serialisation in both V1 and V2 output
encoders/decoders. Supports multisig (tag 0x04) and HTLC
(tag 0x23) targets within TxOutputBare.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:31:29 +00:00
Claude
14a2da9396
feat(wire): encode/decode TxInputHTLC and TxInputMultisig
Adds wire serialisation for HF1 HTLC (tag 0x22) and multisig
(tag 0x02) input types.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:28:55 +00:00
Claude
1ca75f9e3f
feat(types): add TxInputHTLC and TxInputMultisig input types
Input types for HF1 HTLC and multisig transactions.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:27:49 +00:00
Claude
30d174eaac
feat(types): add TxOutMultisig and TxOutHTLC target types
Output target types for HF1 HTLC and multisig transactions.

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:27:01 +00:00
Claude
cc99c92c42
docs: HF5 confidential assets implementation plan
Some checks failed
Security Scan / security (push) Successful in 8s
Test / Test (push) Failing after 20s
Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:25:56 +00:00
Claude
0408d2f3fa
refactor(types): change TxOutputBare.Target to TxOutTarget interface
Some checks failed
Security Scan / security (push) Successful in 9s
Test / Test (push) Failing after 15s
Prepares for HF1 output target types (TxOutMultisig, TxOutHTLC).
All call sites updated to type-assert TxOutToKey where needed.

Modified files:
- types/transaction.go: TxOutputBare.Target is now TxOutTarget
- wire/transaction.go: encode/decode use type switch on target
- chain/ring.go: type-assert target to TxOutToKey for key extraction
- wallet/scanner.go: type-assert target before key comparison
- tui/explorer_model.go: type-assert target for display
- wire/transaction_test.go: type-assert in assertions
- wallet/builder_test.go: type-assert in assertions

Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:23:27 +00:00
Claude
6eabe2a64d
docs: HF6 block time halving implementation plan
Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:21:34 +00:00
Claude
023f4b813c
docs: HF3 block version implementation plan
Co-Authored-By: Charon <charon@lethean.io>
2026-03-16 20:20:56 +00:00