Skip to content

Prototype to demonstrate Proof of Work and Signature verification using ECDSA

License

Notifications You must be signed in to change notification settings

devssh/Prototype-Private-Chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: GPL v2

Prototype blockchain on Java, to demonstrate signature verification and Proof of Work

The purpose is to verify signatures signed by authorities and mined using Proof of Work at difficulty 3. We have 2 types of transactions:

  1. Create token
  2. Redeem token The blocks are created every 5 seconds on average if there is a pending transaction.

To run the demo on JDK8

./gradlew bootRun

or

docker-compose up

and visit localhost:8080

Workflow

  1. Visit localhost:8080 to check this list of instructions and verify health of the server.
  2. Visit localhost:8080/coupons-explorer to see the current state of the chain. The data related to this is stored on blocks.dat. To reset the project to its initial state, remove everything except the genesis block(line1 of blocks.dat)
  3. Visit localhost:8080/authorized to view the public keys of the authorities. Everyone in the blockchain can see the public keys of these trusted delegates.
  4. Visit localhost:8080/create?sign=MFkwEw&message=MESSAGE_HERE&owner=OWNER_HERE&aadhar=AADHAR_HERE as shown in the image below. This endpoint is a simulation provided to show how an authorized miner(in this case its the authority named "Dev") would sign transactions after verifying the integrity.
  5. Visit the coupons page to verify that the transactions have been updated. We usually wait for the new transactions to be at least 'x' blocks deep based on the cost of mining a block. Thus if a block costs $1 to mine we would wait 100 transactions to verify that it has been added.(Now it costs at least $100 to modify.) We don't have to spend $1 to mine it, we can spend/create virutal tokens for that amount and distribute it free to users to try out the service or to incentivise miners to copy the blockchain and dedicate computing resources.
  6. Verify the transaction in localhost:8080/verify-form with the information provided in the coupons page.(which uses a public algorithm so that anyone can verify the data without having to depend on this page. A helper has been added in the create page to display the data needed to fill this form. The signatures are available in the coupons page) Verification costs nothing compared to creating blocks.

Home screen

Initial chain

Authority Dev processes transaction

Updated state of chain

Authorities public keys

Any user can verify the chain's signatures using this interface or using the public algorithm