No description
Find a file
Claude a803fd1794
feat(consensus): V2 Zarcanum signature and proof verification
Add full V2 transaction verification pipeline: parse SignaturesRaw variant
vector into structured ZC signature data, verify CLSAG GGX ring signatures
per ZC input, verify BPP range proofs, and verify BGE asset surjection
proofs with correct ring construction (mul8 point arithmetic).

Fix three wire format bugs that caused V2 parsing failures:
- RefTypeGlobalIndex (tag 0x1A) uses 8-byte LE, not varint
- Raw uint64_t variant (tagUint64) uses 8-byte LE, not varint
- zarcanum_tx_data_v1 fee uses FIELD() → 8-byte LE, not VARINT_FIELD()

Add cn_point_sub to C++ bridge and Go wrapper for BGE ring construction.
Add GetZCRingOutputs to chain for fetching ZC ring member data.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-22 00:06:10 +00:00
chain feat(consensus): V2 Zarcanum signature and proof verification 2026-02-22 00:06:10 +00:00
config feat(config): add BlockTarget constant (120s) 2026-02-21 21:59:41 +00:00
consensus feat(consensus): V2 Zarcanum signature and proof verification 2026-02-22 00:06:10 +00:00
crypto feat(consensus): V2 Zarcanum signature and proof verification 2026-02-22 00:06:10 +00:00
difficulty fix(difficulty): correct LWMA algorithm and hardfork-aware target 2026-02-21 22:32:57 +00:00
docs docs: add difficulty computation design and plan 2026-02-21 21:58:04 +00:00
mining test(mining): integration test against C++ testnet daemon 2026-02-21 02:20:05 +00:00
p2p test(p2p): integration test for chain request and block fetch 2026-02-21 21:17:54 +00:00
rpc fix(difficulty): correct LWMA algorithm and hardfork-aware target 2026-02-21 22:32:57 +00:00
testdata feat(consensus): V2 Zarcanum signature and proof verification 2026-02-22 00:06:10 +00:00
types feat(wire): v2+ transaction serialisation with real testnet verification 2026-02-21 19:09:34 +00:00
wallet feat(chain): integrate consensus validation into sync 2026-02-21 01:11:33 +00:00
wire feat(consensus): V2 Zarcanum signature and proof verification 2026-02-22 00:06:10 +00:00
.gitignore feat(crypto): Phase 2a scaffold — vendored C++ and CMake build 2026-02-20 18:21:44 +00:00
CLAUDE.md docs: Phase 2 crypto bridge documentation 2026-02-20 18:49:21 +00:00
go.mod feat(consensus): scaffold package with error types 2026-02-21 00:39:41 +00:00
go.sum feat(consensus): scaffold package with error types 2026-02-21 00:39:41 +00:00
README.md docs: graduate Phase 0 into production documentation 2026-02-20 15:24:38 +00:00

go-blockchain

Pure Go implementation of the Lethean blockchain protocol. Provides chain configuration, core cryptographic data types, CryptoNote wire serialisation, and LWMA difficulty adjustment for the Lethean CryptoNote/Zano-fork chain. Follows ADR-001: protocol logic in Go, cryptographic primitives deferred to a C++ bridge in later phases. Lineage: CryptoNote to IntenseCoin (2017) to Lethean to Zano rebase.

Module: forge.lthn.ai/core/go-blockchain Licence: EUPL-1.2 Language: Go 1.25

Quick Start

import (
    "forge.lthn.ai/core/go-blockchain/config"
    "forge.lthn.ai/core/go-blockchain/types"
    "forge.lthn.ai/core/go-blockchain/wire"
    "forge.lthn.ai/core/go-blockchain/difficulty"
)

// Query the active hardfork version at a given block height
version := config.VersionAtHeight(config.MainnetForks, 10081) // returns HF2

// Check if a specific hardfork is active
active := config.IsHardForkActive(config.MainnetForks, config.HF4Zarcanum, 50000) // false

// Encode and decode a Lethean address
addr := &types.Address{SpendPublicKey: spendKey, ViewPublicKey: viewKey}
encoded := addr.Encode(config.AddressPrefix)
decoded, prefix, err := types.DecodeAddress(encoded)

// Varint encoding for the wire protocol
buf := wire.EncodeVarint(0x1eaf7)
val, n, err := wire.DecodeVarint(buf)

// Calculate next block difficulty
nextDiff := difficulty.NextDifficulty(timestamps, cumulativeDiffs, 120)

Documentation

Build & Test

go test ./...
go test -race ./...
go vet ./...
go build ./...

Licence

European Union Public Licence 1.2 -- see LICENCE for details.