Andrei Craciun
Andrei Craciun

Reputation: 21

How to write a simple blockchain in python

I need a simple blockchain in python to be used like bitcoin cryptocurrency but also to be mined with cryptography based algorithms.

I have searched on GitHub but want to make my own.

My simple blockchain app that runs in comand line.

Upvotes: 1

Views: 683

Answers (2)

saman.shahmohamadi
saman.shahmohamadi

Reputation: 485

Take a look at this tutorial.

Upvotes: 0

DDK
DDK

Reputation: 136

  1. You can create a list or json in python which contain hash of this block, data you want to store,time stamp,the hash of last block.
  2. Create first block with a random last block hash.Now you can create block one by one with data you want to store in block(coins? contract? ...), calculate the hash of this block, to become a chain.
  3. You can change your algorithm which create your hash,that will depend how to mine and you can setup some requirements of hash result to limit mining speed.Coins which send to miner can be written into data as public data.
  4. A P2P network should be setup to enable more people to join in.

Upvotes: 1

Related Questions