This repository is dedicated to the concepts of blockchain using python. Since python is one of the most abundant language for programming right now. Hereby I am creating a repo and initializing it with basic concepts for now.
Fixed the mine_block function : Error was due to the usage of different spelling for the key "recipient". Due to that the already created chain was not being verified hence no adding of new block.
Added the string formatter:: Added it to calculate the balance check upto 10th place of currency. Since it's the most logical thing to do as the value of cryptos are taken seriously in decimals unlike conventional currencies.
Added the lambda function:: Added the lambda function to reduce the looping through big chains of transactions.
Added the reduce function:: Added reduce function to further reduce the calculation time.
SHA-256: A hash function is any function that can be used to map data of arbitrary size to data of fixed size¹. Added SHA-256 for the encryption technique previously we were using the basic hashing of our own.
Proof of Work: Added the proof of work system, heavy computation(theoritically) to check the authenticity of the blocks.
Minor Tweaks:
Removed the usage of dictionary
Added the orderedDict such that their is not even a single chance of altering of arguments passed. Sometimes to optimize run time, python tweaks the things a little bit and their is slight possiblity that the dict pair gets altered while passing since their are not ordered in any way.
Small entitites: Seprated the hash as hash.py. Objective is to effectively break the complete file into small entitites.
Fixed Problems with the hashing: The hashing was being shown invalid due to faulty parsing.
Fixed Genesis Block Dependency: Fixed the loading problem with the genesis block and the sidwise open_transactions. Function load_data lead to error as initially there was no record to maintain.
Change the digest to
hexdigest
in hashlib: Looping over hexdigest was taking infinite time(I waited for atleast 19 minutes) so changing it to hexdigest was a better option since the first two digits were compared.
'Fixed the
genesis block problem
:
Replaced the procedural with object oriented programming: Now all the properties of the block are windup under a
Class Block
.
Fixed the JSON serialization problem: Some specific objects are json serializable, hence the Class
Block
is not serialized by default.
JSON works with the inbuilt datatypes so by using the dict we can convert to the dictionary type from the default class type
The reason to use the copy function is that if we directly apply changes to the blocks of blockchain. Hashing of the previous block stored for the previous transactions can change in serialization. Since to save it from changing another copy is made.
Added the verification class: Seprated the verification functions under other class. Improved code readablity and reusage.
Added the node class: Added the node class which wil act as user interface. Other classes such as blockchain, verification, printable and transaction are added on the basis of functionality.
Implemented more secure channel between classes and assigned random id function i.e. uuid4 to the sender:
Removed the problem with the last transaction. It was open to manipulation. The last block was pushed when another block was created after it. So to prevent the exploitation following things were used:
Imported python package called pycryto
Using RSA public key private key pair
RSA public-key cryptography algorithm (signature and encryption).
RSA is the most widespread and used public key algorithm. Its security is based on the difficulty of factoring large integers. The algorithm has withstood attacks for 30 years, and it is therefore considered reasonably secure for new designs.
Updated the Verification Logics Added the logic to check the open_transaction for credit limit.
Added the create and load wallet feature Added the feature which on use loads the existing key value pair.
Linux