API and blockchain generator developed with Python and Flask. After generated each block can be writen to a json file that looks like this. After creating some blockchains the API can be hosted locally to query the generated data.
the following commands will install any dependencies needed to run the application.
pip install -r requirements.txt
First of all user.py needs to be executed to create 50 random users, these users will be needed afterwards to create transactions. Users are stored in a directory named users, each user is composed of a private key used to sign each transaction and a public key needed to validate the signature, each user is identified by a hash of the public key (address).
python user.py
To generate a blockchain the file main.py should be executed, by default a blockchain with 10 blocks is generated, to persist the generated blockchain the flag -o must be used and a name for the generated blockchain must be given as show bellow.
python main.py -o blockchain_example
To run the API the following command line need to be issued.
python main.py --app