Skip to content

ANThonyRix/simple_blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

simple_blockchain

An example of a simple blockchain in Python. In this example, we are creating a Block class, which represents a single block in our blockchain. Each block contains an index, data, the hash of the previous block, and its own hash, which is calculated by combining the block's data and its hash of the previous block and hashing using the SHA-256 algorithm.

We then create a Blockchain class, which is a chain of blocks. First, we create a genesis block, which has an index of 0 and contains arbitrary data. Then we add several blocks with arbitrary data, each new block refers to the hash of the previous block. Finally, we check if our block chain is valid using the is_chain_valid() method, which checks that the hashes of each block match their content, and that links to previous blocks are also valid.

This example is only a basic example that can be extended and extended to suit your needs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published