Skip to content

RickyTickyTavi/blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

BlockChain

A blockchain project for my university.

Instructions on installation.

Python 3.6+ is needed for this. you can find the DL link here. https://www.python.org/downloads/

pip or pip3 is also required. Make sure that is included with your python download.

you can use the command "pip install Flask" and "pip install requests" to install both of those libraries that we need.

Either cURL or Postman is also needed for this. cURL you can get with your Linux distro you are running, and the Download link for Postman can be found here. https://www.postman.com/downloads/.

Usage

run the command "python CS463BChain.py". or "python3 CS463BChain.py", whatever your OS wants you to do. This will launch the API on your localhost port 5555. If you wish to change the port, you can add " -p [port number]" as an argument to the command.

Once the program is launched, you may either use cURL or Postman (dont exit the application) Instructions will follow.

Postman

Once you are finished downloading and installing the free version of postman, open it. Under the "Launchpad" tab in the top center, click "Create Request" Make sure you are making a GET request. In the enter url field you can enter in a few urls, and you will see the results. 127.0.0.1:[port number you chose]/mineblock This will mine a new block 127.0.0.1:[port number you chose]/wholechain This will show you the chain of all the blocks.

Keep in mid all of this data is in JSON format!

POST: If you switch to POST Method, you can enter this link. 127.0.0.1:[port number you chose]/new This will generate a new transaction of your choosing, and you must enter in the data in the JSON field below in this format.

{ "theSender": "[your choosing]", "theRecipient": "[your choosing]", "theAmount": [your choosing] }

make sure to keep the quotes, and select raw, and JSON from the dropdown menu right above the entry field.

cURL

my apologies but I'm not very familiar with cURL, I know it works, but I haven't troubleshot any commands. I believe something as simple as "curl 127.0.0.1:[port number you chose]/mineblock" will work for the get requests.

Conclusion

I hope you have fun with this! This is not a decentralized blockchain, but rather a centralized one that we can interact with over HTTP. All of the "blocks" contain data that a typical cryptocurrency block would. Timestamps, transactions, hashes, and proofs of work are all there. The new hashes are generated by encoding the entire JSON data of the previous block and hashing it via SHA-256.

About

blockchain project for my university.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages