Skip to content

Instantly share code, notes, and snippets.

@ITExpert0228
Created May 3, 2022 18:52
Show Gist options
  • Save ITExpert0228/56c7495df6b38ae8a28f02bc9779e5e5 to your computer and use it in GitHub Desktop.
Save ITExpert0228/56c7495df6b38ae8a28f02bc9779e5e5 to your computer and use it in GitHub Desktop.
package main //Import the main package
// Create the Block data structure
// A block contains this info:
type Block struct {
Timestamp int64 // the time when the block was created
PreviousBlockHash []byte // the hash of the previous block
MyBlockHash []byte // the hash of the current block
AllData []byte // the data or transactions (body info)
}
// Prepare the Blockchain data structure :
type Blockchain struct {
Blocks []*Block // remember a blockchain is a series of blocks
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment