robinmonjo / coincoin

Blockchain based cryptocurrency proof-of-concept built with Elixir. Feedback welcome
402 stars 54 forks source link

Real mining #6

Closed robinmonjo closed 7 years ago

robinmonjo commented 7 years ago

In the process of implementing a PoC of a crypto currency over this blockchain, I have to implement a "less naive" way for mining.

Adding a block is currently easy:

  1. block creation
  2. Proof of Work
  3. add block in the chain
  4. new block is broadcasted

So there is no "mining". New way is:

  1. broadcast a mining_request to the network with the data to be added in the block
  2. peers listen for mining requests and perform Proof of Work
  3. when a peer find the nounce, it adds the block
  4. new block get propagated, others stop working on the PoW and start working on the next PoW