{"id":15556704,"url":"https://github.com/ryandsilva/blockchain-simulation","last_synced_at":"2026-04-03T23:37:45.526Z","repository":{"id":97193376,"uuid":"148617901","full_name":"RyanDsilva/blockchain-simulation","owner":"RyanDsilva","description":"Simulation of A BlockChain in the Python Programming Language :sparkles:","archived":false,"fork":false,"pushed_at":"2019-03-03T17:01:32.000Z","size":115,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T13:24:58.489Z","etag":null,"topics":["blockchain","cryptocurrency","css","flask","html","javascript","mining","proof-of-work","python","sha256","simulation","vuejs","web-application"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyanDsilva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-09-13T09:51:53.000Z","updated_at":"2023-09-21T12:55:06.000Z","dependencies_parsed_at":"2023-03-15T06:15:10.793Z","dependency_job_id":null,"html_url":"https://github.com/RyanDsilva/blockchain-simulation","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"c69eaa75e8188ca33f8e2a81c0dc809fa89c1c79"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanDsilva%2Fblockchain-simulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanDsilva%2Fblockchain-simulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanDsilva%2Fblockchain-simulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanDsilva%2Fblockchain-simulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyanDsilva","download_url":"https://codeload.github.com/RyanDsilva/blockchain-simulation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246134092,"owners_count":20728841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","cryptocurrency","css","flask","html","javascript","mining","proof-of-work","python","sha256","simulation","vuejs","web-application"],"created_at":"2024-10-02T15:14:37.931Z","updated_at":"2025-12-30T20:16:16.239Z","avatar_url":"https://github.com/RyanDsilva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blockchain Simulation (CryptoCurrency)\n\n### Simulation of A BlockChain in the Python Programming Language\n\n## Features:\n\n[1. SHA-256 Hashing](#sha-256)\n\n[2. Proof Of Work](#proof-of-work)\n\n[3. Mining Rewards](#mining-rewards)\n\n---\n\n## Implemenation:\n\n### SHA-256\n\n- Using Python's in-built `hashlib` library to hash the blocks with SHA-256 \u003cbr\u003e\n\n```python\n# Creating the String\n  hashString = str(nonce) + str(transaction) + ..\n# Converting to Bytes\n  hashString = hashString.encode()\n# Hashing\n  currentHash = hashlib.sha256(hashString)\n```\n\n### Proof Of Work\n\n- Proof Of Work is a concept that allows the blockchain not to be spammed by thousands of pending blocks every second.\n- It sets a requirement that the hash generated has to be in a specific format\n- For example, hash should start with 0000\n- In this example you can set the `PROOF_OF_WORK` value\n\n```python\n#Checking whether the first characters of hash are equal to the proof of work\nwhile currentHash[:len(PROOF_OF_WORK)] != PROOF_OF_WORK:\n    #Update Nonce\n    nonce += 1\n    #Re-calculate Hash\n    currentHash = calculateHash()\n```\n\n- Since the hash cannot be changed without changing any value in the block, a `nonce` value is added that can be modified to calculate hash according to requirements.\n\n### Mining Rewards\n\n- Because of this proof of work concept, it takes resources to `mine` blocks and hence miners need to be rewarded for this in order to add blocks at a constant rate and help maintain the blockchain.\n- The mining reward is pre-defined value for that specific block.\n\n```python\n# After the block is mined, pending transactions is set to have just the reward transaction\ndef minePendingTransactions(address):\n    ......\n    block.mineBlock(PROOF_OF_WORK)\n    # Adding to chain\n    blocks.append(block)\n    # Reward Transaction\n    pendingTransactions = [Transaction(address, None, miningReward)]\n```\n\n---\n\n## References:\n\n[Savjee Coin](https://github.com/SavjeeTutorials/SavjeeCoin)\n\n\u003e \u0026copy; 2018 Ryan Dsilva\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryandsilva%2Fblockchain-simulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryandsilva%2Fblockchain-simulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryandsilva%2Fblockchain-simulation/lists"}