Minimal blockchain implementation in Go, inspired by naivechain. Provides an HTTP node plus a CLI client to list the ledger, mine new blocks, and test longest-chain replacement.
internal/blockchain: core chain logic (genesis, hashing, validation, replacement).server: HTTP node exposing/blocks,/mine,/replace.client: CLI for interacting with a running node.
- Start the node:
cd server
go run .- In another terminal, interact with the client:
cd client
go run . -action list
go run . -action mine -data "hello chain"Use -host to point at a remote node (default http://localhost:8080).
From the repo root:
GOCACHE=$(pwd)/.gocache go test ./...- Longest-chain replacement logic is covered by table-driven tests, including branch/merge scenarios.