Skip to content

astares/Pharo-Blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Pharo 7 Pharo 8 Pharo 9 Pharo 10 Pharo 11 Pharo 12

Pharo-Blockchain

A minimalistic blockchain written in Pharo

Quick Start

Install

You can install Blockchain by executing the following load scripts:

Metacello new 
	repository: 'github://astares/Pharo-Blockchain:main/src';
	baseline: 'Blockchain';
	load 	

Use the blockchain

| blockchain |
blockchain := Blockchain new.
"Add some data"
blockchain addNewBlockWithData: 'First Block'.
blockchain addNewBlockWithData: 'Second Block'.
self assert: blockchain isValid.

"Manipulate the data"
blockchain chain second data: 'Manipulated'.	
self deny: blockchain isValid

Implementation

The Blockchain class represents individual blocks in the chain. Each block has:

  • an index
  • a timestamp
  • data (which can be any object)
  • the hash of the previous block
  • its own hash

The Blockchain class manages the chain of blocks. It includes methods to:

  • initialize the chain with a genesis block
  • add new blocks
  • validate the integrity of the chain

About

A minimalistic blockchain written in Pharo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published