Coder Social home page Coder Social logo

pilgrim2go / simplecoin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cosme12/simplecoin

0.0 3.0 0.0 62 KB

Just a really simple, insecure and incomplete implementation of a blockchain for a cryptocurrency made in Python as educational material. In other words, a simple Bitcoin clone.

Home Page: http://copitosystem.com

License: MIT License

Python 100.00%

simplecoin's Introduction

SimpleCoin

Just a really simple, insecure and incomplete implementation of a blockchain for a cryptocurrency made in Python. The goal of this project is to make a working blockchain currency, keeping it as simple as possible and to be used as educational material.

This project is just being made for fun. If you want to make your own cryptocurrency you should probably take a look at the Bitcoin Repository.

What is a blockchain?

Taking a look at the Bitcoin organization wiki website we can find this definition:

A block chain is a transaction database shared by all nodes participating in a system based on the Bitcoin protocol. A full copy of a currency's block chain contains every transaction ever executed in the currency. With this information, one can find out how much value belonged to each address at any point in history.

You can find more information in the original Bitcoin Paper.

How to run it

First, install requirements.txt.

pip install -r requirements.txt

Then you have 2 options:

  • Run miner.py to become a node and start mining
  • Run wallet.py to become a user and send transactions (to send transactions you must run a node, in other words, you must run miner.py too)

Important: DO NOT run it in the python IDLE, run it in your console. The miner.py uses parallel processing that doesn't work in the python IDLE.

How this code work?

There are 2 main scripts:

  • miner.py
  • wallet.py

Miner.py

This file is probably the most important. Running it will create a node (like a server). From here you can connect to the blockchain and process transactions (that other users send) by mining. As a reward for this work, you recieve some coins. The more nodes exist, the more secure the blockchain gets.

miner.py has 2 processes running in parallel:

  1. The first process takes care of mining, updating new blockchains and finding the proof of work.

  2. The second process runs the flask server where peer nodes and users can connect to ask for the entire blockchain or sumbmit new transactions.

Parallel processes don't run in python IDLE, so make sure you are running it from the console.

miner

Wallet.py

This file is for those who don't want to be nodes but simple users. Running this file allows you to generate a new address, send coins and check your transaction history (keep in mind that if you are running this in a local server, you will need a "miner" to process your transaction). When creating a wallet address, a new file will be generated with all your security credentials. You are supposed to keep it safe.

wallet

Contribution

Anybody is welcome to collaborate in this project. Feel free to push any pull request (even if you are new to coding). See CONTRIBUTING.md to learn how to contribute.

Note: the idea of this project is to build a really simple blockchain system, so make sure all your code is easy to read (avoid too much code in 1 line) and don't introduce complex updates if they are not critical. In other words, keep it simple.

Disclaimer

By no means this project should be used for real purposes, it lacks security and may contain several bugs.

simplecoin's People

Contributors

cosme12 avatar pehdfms avatar adanielpincab avatar aareon avatar adilmah avatar jac08h avatar jyoo980 avatar sudz123 avatar timster avatar lidonghe avatar

Watchers

James Cloos avatar iapilgrim avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.