From 55e841d95fd743dce951cd7de7657be71b65ddc3 Mon Sep 17 00:00:00 2001 From: Evgeniy Fedorov Date: Wed, 19 Jul 2023 09:43:19 +0300 Subject: [PATCH] hw13 - use your package. --- hw13/go.mod | 5 +++++ hw13/go.sum | 2 ++ hw13/main.go | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 hw13/go.mod create mode 100644 hw13/go.sum create mode 100644 hw13/main.go diff --git a/hw13/go.mod b/hw13/go.mod new file mode 100644 index 0000000..56f0e03 --- /dev/null +++ b/hw13/go.mod @@ -0,0 +1,5 @@ +module hw13 + +go 1.20 + +require github.com/ltdangle/blockchain v1.0.4 diff --git a/hw13/go.sum b/hw13/go.sum new file mode 100644 index 0000000..e7d2a6b --- /dev/null +++ b/hw13/go.sum @@ -0,0 +1,2 @@ +github.com/ltdangle/blockchain v1.0.4 h1:BbrLZ4gyrJxvtvgcM2BVaaLlLJcQKVZqlX4ZPboQLw4= +github.com/ltdangle/blockchain v1.0.4/go.mod h1:JXe6JHNhBq82XtnOPheM9u2mrCIjQwSRTjJ88dZKzQQ= diff --git a/hw13/main.go b/hw13/main.go new file mode 100644 index 0000000..7112965 --- /dev/null +++ b/hw13/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/ltdangle/blockchain" +) +func main() { + // create a new b instance with a mining difficulty of 2 + b := blockchain.CreateBlockchain(2) + + // record transactions on the blockchain for Alice, Bob, and John + b.AddBlock("Alice", "Bob", 5) + b.AddBlock("John", "Bob", 2) + + // check if the blockchain is valid; expecting true + fmt.Println(b.IsValid()) +}