Skip to main content

No project description provided

Project description

Library Cubed

WARNING: LIBRARY CUBED IS STILL IN ALPHA

MANY IMPERATIVE SECURITY FEATURES SUCH AS NOT HASHING PASSWORDS HAVE NOT YET BEEN IMPLEMENTED

AT THE MOMENT, ONLY USE LIBRARY CUBED IN A PRIVATE SETTING FOR TESTING

DON'T ACTUALLY USE LIBRARY CUBED IN YOUR APPLICATION

(YOU HAVE BEEN WARNED...)

An updated, more secure version will be published later (Expected by end of August 20238)

Please email any bugs, suggestions, problems, etc to erlindsay2@gmail.com


Library Cubed is a python package, optimized for libraries to better manage and keep track of their books, run by blockchain.


Run the following to install Library Cubed:

pip install librarycubed

Then in your python file, add:

import librarycubed

Features:

  • Customizable blockchain and creation system
  • Backed by Proof of Authority (PoA) and hashing encryption
  • Simple and easy-to-use
  • Reminder system
  • No crypto or digital wallet needed

Documentation

Initialization

For LC to work properly, a seperate database file must be created.

import librarycubed as lc

lc.init_list()

This only needs to be run once, you can delete this line of code after. You should see bcList.sqlite3 appear in your directory.

Do not delete the bcList.sqlite3 file or any other .sqlite3 files.

Use Blockchain.delete(filename) to delete a blockchain, do not manually delete them

Create Your First Blockchain

import librarycubed as lc

lc.Blockchain.new(filename, name)

Notes:

  • Filenames must end with .sqlite3
  • Filename cannot be "bcList.sqlite3"
  • The name does not need to be the same as the filename (e.g. if the filename is "hello.sqlite3", the name does not also have to be "hello")
  • The same filename or name cannot be used twice

Admins

LC has two types of admins: Master Admin and Admin

The Master Admin has more power over other admins. This would be the boss, supervisor, CEO, etc of your company.

Admins can only verify blocks and view the blockchain.

Note that this system is likely to change in future updates

To initialize the Master Admin:

import librarycubed as lc
lc.init_list()

lc.Blockchain.new('bc.sqlite3','bc')

lc.Admin.Master.new('bc.sqlite3') # use the same filename to add the admin to the specific file

You should be prompted to enter the username and password in the terminal.

To create a new admin:

import librarycubed as lc
#lc.init_list()

#lc.Blockchain.new('bc.sqlite3','bc')

lc.Admin.new('bc.sqlite3') # use the same filename to add the admin to the specific file

You should be prompted to enter the username and password for the new admin in the terminal

Then you should be prompted to confirm by entering the Master Admin username and password

Add data

To create a new block, use Blockchain.insert_into(filename, format(borrower, book, type, dueDate))

import librarycubed as lc
lc.init_list()

lc.Blockchain.new('bc.sqlite3','bc')

lc.insert_into('bc.sqlite3', format("Bob","The Adventure Of Alex","borrow","07/06/2023"))

Notes:

  • Due date must be in MM/DD/YYYY format; bugs and errors may occur
  • The format function must be used.
  • Blocks created with insert_into() will be found in "pending".

Verify blocks

To create verify pending blocks, use PoA(filename)

import librarycubed as lc
lc.init_list()

lc.Blockchain.new('bc.sqlite3','bc')

lc.insert_into('bc.sqlite3', format("Bob","The Adventure Of Alex","borrow","07/06/2023"))

lc.PoA('bc.sqlite3')

You should then be prompted to look at the block and check that it is valid. Then you must enter the username of an admin to confirm.

View data

To create verify pending blocks, use:

  • GetData.chain(filename, database type) to view the entire chain, or
  • GetData.block(filename, database type, block index) to view a specific block in a chain, or
  • GetData.chains() to view a list of all the chains
import librarycubed as lc
lc.init_list()

lc.Blockchain.new('bc.sqlite3','bc')

lc.insert_into('bc.sqlite3', format("Bob","The Adventure Of Alex","borrow","07/06/2023"))

lc.GetData.chain('bc.sqlite3','pending')

Use 'pending' as database type when you want to look at unverified blocks Use 'blockchain' when you want to look at verified blocks in the blockchain Use 'admin' to view a list of admins

Note that the first block is block 1, not block 0.

Verify blocks

To create verify pending blocks, use PoA(filename)

import librarycubed as lc
lc.init_list()

lc.Blockchain.new('bc.sqlite3','bc')

lc.insert_into('bc.sqlite3', format("Bob","The Adventure Of Alex","borrow","07/06/2023"))

lc.PoA('bc.sqlite3')

The Check Functions

To create verify the hashes of your blockchain, use Check.hashes(filename) To get a list of overdue borrows, use Check.returns(filename)

import librarycubed as lc
lc.init_list()

lc.Blockchain.new('bc.sqlite3','bc')

lc.insert_into('bc.sqlite3', format("Bob","The Adventure Of Alex","borrow","07/06/2023"))

lc.PoA('bc.sqlite3')

lc.Check.hashes('bc.sqlite3')
lc.Check.returns('bc.sqlite3')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

librarycubed-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

librarycubed-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file librarycubed-0.1.0.tar.gz.

File metadata

  • Download URL: librarycubed-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Windows/10

File hashes

Hashes for librarycubed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c5ccb50c75513565fae6a7f225885d94e8146ded5ec565b1a9c91e62ddd2188b
MD5 405a4b175204715a6d3fcda1f2144587
BLAKE2b-256 3a204c1c4fffd99be5d6340dcd70ff57d993371ff1bec00f64fca3ae859e9368

See more details on using hashes here.

File details

Details for the file librarycubed-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: librarycubed-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Windows/10

File hashes

Hashes for librarycubed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81f454e5eea107b3dd29f0e2f33cd49f181ca77656af4cd66bebe8572cab4104
MD5 27dda5e13a78863eb241169cb6ce862e
BLAKE2b-256 4e2efb811e614598a1ce9a9be607a4186cb2a0fe8823999f715502b3ed75101b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page