Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astares/pharo-blockchain
A minimalistic blockchain written in Pharo
https://github.com/astares/pharo-blockchain
Last synced: 22 days ago
JSON representation
A minimalistic blockchain written in Pharo
- Host: GitHub
- URL: https://github.com/astares/pharo-blockchain
- Owner: astares
- Created: 2024-07-25T22:40:58.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-17T23:23:05.000Z (23 days ago)
- Last Synced: 2024-12-17T23:26:24.291Z (23 days ago)
- Language: Smalltalk
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Pharo 7](https://img.shields.io/badge/Pharo-7.0-%23aac9ff.svg)](https://pharo.org/download)
[![Pharo 8](https://img.shields.io/badge/Pharo-8.0-%23aac9ff.svg)](https://pharo.org/download)
[![Pharo 9](https://img.shields.io/badge/Pharo-9.0-%23aac9ff.svg)](https://pharo.org/download)
[![Pharo 10](https://img.shields.io/badge/Pharo-10-%23aac9ff.svg)](https://pharo.org/download)
[![Pharo 11](https://img.shields.io/badge/Pharo-11-%23aac9ff.svg)](https://pharo.org/download)
[![Pharo 12](https://img.shields.io/badge/Pharo-12-%23aac9ff.svg)](https://pharo.org/download)# Pharo-Blockchain
A minimalistic blockchain written in [Pharo](https://www.pharo.org)## Quick Start
### InstallYou can install **Blockchain** by executing the following load scripts:
```Smalltalk
Metacello new
repository: 'github://astares/Pharo-Blockchain:main/src';
baseline: 'Blockchain';
load
```### Use the blockchain
```Smalltalk
| 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 hashThe **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