https://github.com/maxhumber/sausagelink
A Blockchain Parody
https://github.com/maxhumber/sausagelink
Last synced: 11 months ago
JSON representation
A Blockchain Parody
- Host: GitHub
- URL: https://github.com/maxhumber/sausagelink
- Owner: maxhumber
- License: mit
- Created: 2019-02-21T18:49:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T15:37:26.000Z (over 7 years ago)
- Last Synced: 2024-08-09T18:21:38.919Z (almost 2 years ago)
- Language: Python
- Homepage:
- Size: 556 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### About
sausagelink is like Blockchain, but tastier. The package allows you to maintain a `Link` (chain) of `Sausage` (blocks) such that the data contained within each `Sausage` and the order of the `Link` cannot be tampered with.
### Usage
```python
from sausagelink import Sausage, Link
link = Link()
link.append('Hello, World!')
link.append(2019)
link.append({'foo': 'bar'})
print(link)
# [⎨0⎬, ⎨1⎬, ⎨2⎬, ⎨3⎬]
print([sausage.data for sausage in link])
# [None, 'Hello, World!', 2019, {'foo': 'bar'}]
link.refrigerate('foo.sl')
del link
link = Link('foo.sl')
print([sausage.data for sausage in link])
# [None, 'Hello, World!', 2019, {'foo': 'bar'}]
```
### Audit
```python
print(link.rancid())
# []
sausage = link[2]
print(sausage.data)
# 2019
print(sausage.rancid())
# False
sausage.data = 2020
print(sausage.rancid())
# True
print(link.rancid())
# ['⎨2⎬']
```
### Install
`pip install sausagelink`