A simple program to add purchase of the customers in the blockchain.
This repository contains my code inspired from "Udemy's Blockchain A-Z™: Learn How To Build Your First Blockchain, by Kirill Eremenko and Hadelin de Ponteves".
- Connect Nodes
- Nodes are running on different port numbers
- Record transactions in blockchain
- Each node will add user data : name, uid, address, and purchase
- Mining blocks
- Perform proof of work and add transactions to the block
- Update and validate the copy of the blockchain
- Check the longest copy of the blockchain
- connect_node : to connect to other nodes (Post request)
{
"nodes": ["http://127.0.0.1:5001",`
"http://127.0.0.1:5002",`
"http://127.0.0.1:5003"]`
}- get_chain : to get the blockchain copy (Get Request)
- add_transaction : add user information (Post Request)
{
"name": "",
"uid": "",
"address": "",
"purchase": ""
}- mine_block : perform proof of work, if successful mine the block (Get Request)
- replace_chain : to find the longest chain in the entire blockchain network (Get Request)
- is_valid : validate whether the blockchain is valid or not (Get Request)
- verify all the hash values
- create_block : once proof of work is found block will be created
- get_previous_block : get the index of the previous block
- proof_of_work : compute the desired hash challenge
- hash : returns the hash value
- add_node : for connecting the nodes
