Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hw13/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module hw13

go 1.20

require github.com/ltdangle/blockchain v1.0.4
2 changes: 2 additions & 0 deletions hw13/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/ltdangle/blockchain v1.0.4 h1:BbrLZ4gyrJxvtvgcM2BVaaLlLJcQKVZqlX4ZPboQLw4=
github.com/ltdangle/blockchain v1.0.4/go.mod h1:JXe6JHNhBq82XtnOPheM9u2mrCIjQwSRTjJ88dZKzQQ=
18 changes: 18 additions & 0 deletions hw13/main.go
Original file line number Diff line number Diff line change
@@ -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())
}