blockchain-go

module
v0.0.0-...-c5c7705 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: MIT

README

blockchain-go - 用 golang 从零开始构建区块链系列

Actions Status License

注意:需使用 Golang 1.18.9

a simple blockchain demo for learning

the code for each article

  1. part1: Basic Prototype commit 1b242f4
  2. part2: Proof-of-Work commit fdf3149
  3. part3: Persistence and Cli commit 77b2ded
  4. part4: Transaction 1 commit 4699e80
  5. part5: Addresses commit 27c1a8a
  6. part6: Transaction 2 commit d99b1a1
  7. part7: Network commit 25a9151
  8. part8: Optimize code

命令

go run cmd/main.go create-wallet
go run cmd/main.go create-wallet
go run cmd/main.go print-addresses

# 13pGasXsfb6Wcejyxa7kAX5P47av1FM4AF
# 1CSv68gmr1mMFWjAvjfg5AWgPBhz66jqsF

go run cmd/main.go create-chain --address 13pGasXsfb6Wcejyxa7kAX5P47av1FM4AF
go run cmd/main.go print-chain

go run cmd/main.go transfer --from 13pGasXsfb6Wcejyxa7kAX5P47av1FM4AF --to 1CSv68gmr1mMFWjAvjfg5AWgPBhz66jqsF --amount 5 --mine
go run cmd/main.go get-balance --address 13pGasXsfb6Wcejyxa7kAX5P47av1FM4AF
go run cmd/main.go get-balance --address 1CSv68gmr1mMFWjAvjfg5AWgPBhz66jqsF

参考资料

Directories

Path Synopsis
cmd
app
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL