Code Monkey home page Code Monkey logo

simplecoin's People

Contributors

aareon avatar adanielpincab avatar adilmah avatar ali-xoerex avatar catalinpit avatar cosme12 avatar deanchugall avatar elijose55 avatar hs2361 avatar ingenious452 avatar irapandey avatar jac08h avatar jyoo980 avatar larsjuvik avatar lidonghe avatar pehdfms avatar programerr01 avatar qiisziilbash avatar sharan-babu avatar sudz123 avatar timster avatar tsuzat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplecoin's Issues

Synchronise blockchain with other nodes

It would be really cool if the nodes, automatically detect other nodes, an with that, I mean dynamically, and of course they should validate the blockchains. In the miner.py script, there is an function, which should do this, but it just returns true to every blockchain it becomes. Please do this, because that a really important thing !

miner.py doesn't work...

I got http code 500 when I run miner.py :

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2018-02-24 17:17:18,787] ERROR in app: Exception on /txion [GET]
Traceback (most recent call last):
  File "/home/jason/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/jason/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1615, in full_dispatch_request
    return self.finalize_request(rv)
  File "/home/jason/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1630, in finalize_request
    response = self.make_response(rv)
  File "/home/jason/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1725, in make_response
    raise ValueError('View function did not return a response')
ValueError: View function did not return a response
127.0.0.1 - - [24/Feb/2018 17:17:18] "GET /txion?update=dgBVRxwlanhdodHYanSctJDj72G3f1Uen+4tpkjSfQdSSJwKLHjyu90VeEPrh7S9aMgScguyJlDwyJCv1RBo7g== HTTP/1.1" 500 -

multiple miners and external ip

I'm trying to run this on a local machine.
I've setup two copies of the miner and miner_config scripts with the correct information so they reference eachother and do not clash.
But there is an issue, one miner starts then it fails because the other miner is unreachable.
And when I try to bind to an external ip it immediately dies.

Logging

Is there any logging of miner activity?

Reason of different inter-process communication

when i was learning your code, a question is raised that:
when you deliver the chain from "miner" to "flask server", you use pipe.
but when you deliver the transaction pool from "flask server" to "miner", you use http get.

is there a special reason or consideration for this inconsistency? or it is because only one pipe can be send to flask? (im not sure about it); also i believe pipe is duplex.

besides, this args seems totally useless, because what your get_blocks() api used is the global variable b, the input args is no way to be referred.

Question : how many simplecoin we have?

I'm trying to making my own cryptocurrency with learning this project.
I have a question : how many simplecoin we have and how can I change to for example 120,000,000,000

Verify transactions

New transactions should be verified before being accepted. This will prevent several problems:

  • no funds transactions
  • duplicate sent
  • mined excessive reward
  • send transactions using other users wallet address

Imported modules

I think it would be better to download required modules and save them in the proyect.
This way the user wouldn't have to install all the modules required, more simple.

Feature Request: Frontend

Hello,

Would you like me to work on some Flask functionality that would add
some info to the loopback 127.0.0.1 address?

Thanks,
Dan

Move blockchain out of memory

As blockchain gets bigger, it will be necessary to be moved out of memory. Since this is a simplified version of a blockchain, saving it in a text file may be enough.

error miner.py

i have this error when i run miner.py:
rocess Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "miner.py", line 97, in mine
last_block = BLOCKCHAIN[len(BLOCKCHAIN) - 1]
TypeError: object of type 'bool' has no len()

  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    ^CTraceback (most recent call last):
    File "miner.py", line 269, in
    p2 = Process(target=node.run(), args=b)
    File "/usr/lib/python3.6/multiprocessing/process.py", line 80, in init
    self._args = tuple(args)
    TypeError: 'Connection' object is not iterable

Improve proof of work algorithm

The current proof of work algorithm is really simple to solve. This make it easy for an attacker to destroy the actual blockchain.

commenting in miner.py

hey, in line 71 it says we wait until the number is divisible by 9 to break the loop, but the mod is 7919. Not a big deal, but made me do a double take. Thanks for making this repo, btw :)

requirements.txt Installation command does not work

The readme suggests running the following command to install the project dependencies

pip install requirements.txt

But doing that only returns the following error:

$ pip install requirements.txt
Collecting requirements.txt
  Could not find a version that satisfies the requirement requirements.txt (from versions: )
No matching distribution found for requirements.txt

A solution I found for this was changing the command to the following

pip install `cat requirements.txt`

And then it worked fine, perhaps the readme should be updated?

wallet.py doesn't work on MacOS!

Hey, i tried executing wallet.py, basically i can not choose any available options, if i press 1 then enter, nothing happens :( does it only run on windows?

error when trying to see transitions in windows

I wanted to see my own transitions but when I try it will give me :

C:\Users\mehan\Desktop\SimpleCoin\simpleCoin>python wallet.py
       =========================================

        SIMPLE COIN v1.0.0 - BLOCKCHAIN SYSTEM

       =========================================


        You can find more help at: https://github.com/cosme12/SimpleCoin

        Make sure you are using the latest version or you may end in
        a parallel chain.



What do you want to do?
        1. Generate new wallet
        2. Send coins to another wallet
        3. Check transactions
3
Traceback (most recent call last):
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 96, in create_connection
    raise err
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 234, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1253, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1299, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1248, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1008, in _send_output
    self.send(msg)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 948, in send
    self.connect()
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 200, in connect
    conn = self._new_conn()
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001748EAAB610>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=5000): Max retries exceeded with url: /blocks (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001748EAAB610>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\mehan\Desktop\SimpleCoin\simpleCoin\wallet.py", line 135, in <module>
    wallet()
  File "C:\Users\mehan\Desktop\SimpleCoin\simpleCoin\wallet.py", line 52, in wallet
    check_transactions()
  File "C:\Users\mehan\Desktop\SimpleCoin\simpleCoin\wallet.py", line 88, in check_transactions
    res = requests.get('http://localhost:5000/blocks')
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\mehan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5000): Max retries exceeded with url: /blocks (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001748EAAB610>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

what I have to do ?

This program not work correctly on linux

Output error when execute python3 miner.py on terminal:

Traceback (most recent call last):
  File "/home/mateusfg7/Desktop/SimpleCoin/simpleCoin/miner.py", line 267, in <module>
    p2 = Process(target=node.run(), args=b)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 990, in run
    run_simple(host, port, self, **options)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 1052, in run_simple
    inner()
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 1005, in inner
    fd=fd,
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 848, in make_server
    host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 740, in __init__
    HTTPServer.__init__(self, server_address, handler)
  File "/usr/lib/python3.7/socketserver.py", line 452, in __init__
    self.server_bind()
  File "/usr/lib/python3.7/http/server.py", line 137, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mateusfg7/Desktop/SimpleCoin/simpleCoin/miner.py", line 112, in mine
    NODE_PENDING_TRANSACTIONS = json.loads(NODE_PENDING_TRANSACTIONS)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)

Save Blockchain

Blockchain doesn't save when miner mines blocks. This is a key feature that I think this project deserves.

Verify imported blockchains from peer nodes

Loaded node_peers blockchains should be validated. find_new_chains() should verify the new imported blockchain follows the requirements. This prevent attacks that attempt to completely change the blockchain history.

give me a branch.

give me a branch. i will create a simple cli wallet for simple soin.

JSON error in miner.py

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [07/Feb/2018 20:42:11] "GET /txion?update=q3nf394hjg-random-miner-address-34nf3i4nflkn3oi HTTP/1.1" 200 -
Process Process-1:
Traceback (most recent call last):
  File "C:\Users\spork\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 252, in _bootstrap
    self.run()
  File "C:\Users\spork\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\spork\Desktop\SimpleCoin\simpleCoin\miner.py", line 114, in mine
    NODE_PENDING_TRANSACTIONS = json.loads(NODE_PENDING_TRANSACTIONS)
  File "C:\Users\spork\AppData\Local\Programs\Python\Python35\lib\json\__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

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.