Skip to content

agaosto/Crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypto - CoolCoin

Project made by Radosław Strublewski & Agata Ostolska

4th sprint

During the final sprint the network has been decentralized. Each node (user) has their own copy of the blockchain and a list of pending transactions. Each transaction is transmitted to all of the other nodes with 90% probability.

Proof of work is running in parallel. The first miner that finds the hash with specified number of zeros, proposes the new block to others. If all nodes reach a consensus, the block is added to the blockchain and the miner gets a coin in reward.

Bob, Ann and Sam have their coins:

image

When Sam pays 1 coin to Ann, and Ann pays 1 coin to Bob, and all the nodes reach consensus, we can see that Sam got a reward coin.

image

When validation fails, there is a message:

image

3rd sprint

Users (and the Chain Manager) are now represented by their digital identity (public and private key). 512-bit keys are generated with Python-RSA package. Creating coins in genesis block is signed by the Chain Manager. Coins can be validated:

image

A new field in JSON transaction has been added. Transaction data now consists of:

  • sender (public key)
  • coins
  • signature

image

Signature in JSON is encoded in Base64.

Use cases from the 2nd sprint were used in main.py.

2nd sprint

The project has been improved. main.py cointains use cases that show all the new features. Users, User and Chain Manager classes have been added. Users are created and coins are distributed between them initially. Coin distribution data is stored in the initial block.

image

Transactions are stored in JSON format. Use cases 1 and 2 show transactions with single and multiple coins.

image

Cases 3 and 4 show double-spending protection. If a user tries to spend a coin that they don't have, an error is displayed and the transaction is not validated.

image

Users can validate the blockchain. If the attacker calls the method that adds a new block to the blockchain, all the users will know that the blockchain is not valid.

image

The whole blockchain is displayed at the end.

image

1st sprint

The project allows the user to create a simple blockchain. After starting the program, the user interface can be seen in the terminal. The user can add another block / transaction (at this stage it is assumed that one block contains only one transaction) or display all blocks in the blockchain. Press [0] to exit.

image

After selecting option [1], the user must provide the names of sender and recipient.

image

Then it is checked whether the hash in the new block is the same as the hash based on the data from the previous block. Information about both hashes and the validation process is displayed in the terminal.

image

After selecting number [2], the entire blockchain is displayed. Block 0 is the initial block.

image

Number [3] displays the whole blockchain including the final block (that consists of previous block hash) and exits the program.

image

About

Cryptocurrency project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages