Operating system | Linux Arch | rolling release |
Programming language | Go | v1.23.2 |
Linux shell | Fish | v3.7.1 |
ProtoBuf compiler | protobuf | v28.2 |
ProtoBuf Go plugin | google.golang.org/protobuf | v1.35.1 |
ProtoBuf gRPC Go plugin | google.golang.org/grpc | v1.68.0 |
Keccak256 hash, Argon2 KDF | golang.org/x/crypto | v0.29.0 |
Secp256k1 elliptic curve | github.com/dustinxie/ecc | latest |
CLI library | github.com/spf13/cobra | v1.8.1 |
- Install the Go programming language and the Fish Linux shell
- Install the ProtoBuf compiler, the ProtoBuf Go plugin, and the ProtoBuf gRPC
Go plugin
yay -S protobuf
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- Clone the Go blockchain repository, generate the gRPC client and server stubs,
and build the blockchain executable
bcn
git clone https://github.com/volodymyrprokopyuk/go-blockchain.git
cd go-blockchain
go get ./...
./grpc.fish
go build -o bcn
- Set up the Fish completions for the blockchain executable
bcn
cp bcn $GOPATH
./bcn completion fish > ~/.config/fish/completions/bcn.fish
- Run the whole test suite storing the test coverage to a file
go test -v -cover -coverprofile=coverage.cov ./... -run .
- Show the HTML test coverage report in a browser
go tool cover -html=coverage.cov
chain/
defines the core blockchain types
account.go
defines the address and the account types
block.go
defines the block and the signed block types
event.go
defines the event type
genesis.go
defines the genesis and the signed genesis types
merkle.go
defines the Merkle hash, the Merkle prove, and the Merkle verify
algorithms
state.go
defines the state type
tx.go
defines the hash, the transaction, and the signed transaction types
cli/
defines the CLI of the blockchain for clients
account.go
defines the account create and the account balance commands
block.go
defines the block search command
chain.go
defines the main bcn
command
node.go
defines the node start and the node subscribe commands
tx.go
defines the transaction sign, the transaction send, and the
transaction search commands
doc/
defines the documentation of this blockchain
node/
defines the key components of the blockchain node
blockproposer.go
defines the block proposer type
eventstream.go
defines the event stream type
msgrelay.go
defines the message relay generic type
node.go
defines the node type
peerdiscovery.go
defines the peer discovery type
statesync.go
defines the state sync type
rpc/
defines and implements the gRPC services and methods
account.proto
defines the gRPC account service and methods
accountsrv.go
implements the gRPC account service
block.proto
defines the gRPC block service and methods
blocksrv.go
implements the gRPC block service
node.proto
defines the gRPC node service and methods
nodesrv.go
implements the gRPC node service
tx.proto
defines the gRPC transaction service and methods
txsrv.go
implements the gRPC transaction service
client.fish
defines the txSignAndSend
helper function for clients
grpc.fish
compiles the definitions of the gRPC services and methods
main.go
defines the main entry point to the bcn
blockchain executable