No description
Find a file
Snider f27825cfc9
Some checks failed
Security Scan / security (pull_request) Successful in 9s
Test / Test (pull_request) Failing after 23s
fix(dx): audit and fix error handling, file I/O, wire compilation
- 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>
2026-03-17 08:34:04 +00:00
.core chore: add .core/build.yaml for core-chain binary 2026-03-09 16:24:05 +00:00
.forgejo/workflows ci: add Forgejo Actions test and security scan workflows 2026-02-23 03:28:02 +00:00
chain fix(dx): audit and fix error handling, file I/O, wire compilation 2026-03-17 08:34:04 +00:00
cmd/core-chain fix: remove accidentally re-added cmd/chain/main.go 2026-03-09 16:27:35 +00:00
config feat(config): add HardforkActivationHeight helper 2026-03-16 20:51:54 +00:00
consensus fix(dx): audit and fix error handling, file I/O, wire compilation 2026-03-17 08:34:04 +00:00
crypto fix(dx): audit and fix error handling, file I/O, wire compilation 2026-03-17 08:34:04 +00:00
difficulty fix(difficulty): correct LWMA algorithm and hardfork-aware target 2026-02-21 22:32:57 +00:00
docs docs: HF5 confidential assets implementation plan 2026-03-16 20:25:56 +00:00
mining refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
p2p refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
rpc refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
testdata feat(consensus): V2 Zarcanum signature and proof verification 2026-02-22 00:06:10 +00:00
tui refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
types fix(dx): audit and fix error handling, file I/O, wire compilation 2026-03-17 08:34:04 +00:00
wallet refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
wire fix(dx): audit and fix error handling, file I/O, wire compilation 2026-03-17 08:34:04 +00:00
.gitignore chore: add .core/ and .idea/ to .gitignore 2026-03-15 10:17:49 +00:00
CLAUDE.md fix(dx): audit and fix error handling, file I/O, wire compilation 2026-03-17 08:34:04 +00:00
cmd_explorer.go refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
cmd_sync.go refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
commands.go refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +00:00
commands_test.go feat: modernise CLI — AddChainCommands, explorer/sync subcommands, core-chain binary 2026-03-09 16:21:42 +00:00
go.mod chore: sync dependencies for v0.1.3 2026-03-16 22:20:06 +00:00
go.sum chore: sync dependencies for v0.1.3 2026-03-16 22:20:06 +00:00
README.md docs: graduate Phase 0 into production documentation 2026-02-20 15:24:38 +00:00
sync_service.go refactor: replace fmt.Errorf/os.* with go-io/go-log conventions 2026-03-16 21:17:49 +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.