No description
- CLAUDE.md: update error handling guidance from fmt.Errorf to coreerr.E() and document go-io convention for file I/O - wire/transaction.go: fix TxOutTarget interface compilation — add encodeTarget/decodeTarget helpers with support for TxOutToKey, TxOutMultisig, and TxOutHTLC target types - wire/transaction.go: add HTLC and multisig input encode/decode (TxInputHTLC, TxInputMultisig) with string encoding helpers - wire/transaction.go: add asset operation tag constants (40, 49-51) and reader functions for HF5 confidential asset operations - consensus/block.go: replace fmt.Errorf with coreerr.E() for checkBlockVersion and ValidateTransactionInBlock - chain/ring.go: replace fmt.Errorf with coreerr.E() in GetRingOutputs - consensus/v2sig_test.go: replace os.ReadFile with coreio.Read - crypto/*.go: replace all fmt.Errorf and errors.New with coreerr.E() across keygen, pow, keyimage, signature, and clsag packages - types/types_test.go: add tests for HashFromHex, PublicKeyFromHex, IsZero, and String methods (types coverage 74.5% -> 89.1%) Co-Authored-By: Virgil <virgil@lethean.io> |
||
|---|---|---|
| .core | ||
| .forgejo/workflows | ||
| chain | ||
| cmd/core-chain | ||
| config | ||
| consensus | ||
| crypto | ||
| difficulty | ||
| docs | ||
| mining | ||
| p2p | ||
| rpc | ||
| testdata | ||
| tui | ||
| types | ||
| wallet | ||
| wire | ||
| .gitignore | ||
| CLAUDE.md | ||
| cmd_explorer.go | ||
| cmd_sync.go | ||
| commands.go | ||
| commands_test.go | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
| sync_service.go | ||
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
- Architecture -- package structure, key types, design decisions, ADR-001
- Development Guide -- prerequisites, test patterns, coding standards
- Project History -- completed phases with commit hashes, known limitations
Build & Test
go test ./...
go test -race ./...
go vet ./...
go build ./...
Licence
European Union Public Licence 1.2 -- see LICENCE for details.