Code Monkey home page Code Monkey logo

crankycoin's Introduction

Cranky Coin

Build Status

Cranky Coin is a simple blockchain, cryptocurrency, wallet implementation

Getting Started

# apt install python3-pip
# pip3 install virtualenv
# virtualenv -p python3 venv
# . venv/bin/activate
# pip install -r requirements.txt
# pip install -r requirements-dev.txt

Generating a wallet

# python run.py client
Cranky Coin (CRNK) wallet > publickey

copy your public key

Cranky Coin (CRNK) wallet > privatekey

copy your private key

Running a full node

Cranky Coin (CRNK) wallet > quit
# python ./tools/encrypt.py

enter a secure passphrase

Choose a passphrase:
Re-enter your passphrase:

enter your private key

Secret:
Encrypted private key:

copy your encrypted private key

edit config/config.yaml and populate the fields in the user section

# python run.py full
Cranky Coin (CRNK) full node > help

Running a mining node

Cranky Coin (CRNK) full node > mine start
Cranky Coin (CRNK) full node > mine stop

crankycoin's People

Contributors

aareon avatar cranklin 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

crankycoin's Issues

AttributeError: 'bytes' object has no attribute 'encode'

Traceback (most recent call last):
  File ".\run.py", line 218, in <module>
    main(sys.argv[1:])
  File ".\run.py", line 210, in main
    client()
  File ".\run.py", line 75, in client
    print(wallet.get_public_key())
  File "C:\Users\Aareon\crankycoin\crankycoin\wallet.py", line 26, in get_public_key
    return self.__public_key__.format(compressed=True).encode('hex')
AttributeError: 'bytes' object has no attribute 'encode'

Opening a PR to rectify this

Update to Python 3

This project is a nice reference implementation of a simple cryptocurrency, as such it would be nice to have it with Python 3 support, because it enables more people to test it out. I think a run of 2to3 will suffice, but I will test that out soon.

Cannot run full node

(venv) PS C:\Users\User\crankycoin> py .\run.py full


full node starting...


DEBUG:crankycoin:queue process starting...
DEBUG:crankycoin:worker process(es) starting...
Traceback (most recent call last):
  File ".\run.py", line 218, in <module>
    main(sys.argv[1:])
  File ".\run.py", line 212, in main
    full()
  File ".\run.py", line 119, in full
    full_node.start()
  File "C:\Users\User\crankycoin\crankycoin\node.py", line 79, in start
    wp.start()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'ConfigDict.__init__.<locals>.<lambda>'
[INFO/MainProcess] process shutting down
[DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0
[INFO/MainProcess] calling join() for process Process-1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
[INFO/Process-1] child process calling self.run()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
[INFO/Process-2] process shutting down
[DEBUG/Process-2] running all "atexit" finalizers with priority >= 0
[DEBUG/Process-2] running the remaining "atexit" finalizers
[INFO/Process-1] process shutting down
[DEBUG/Process-1] running all "atexit" finalizers with priority >= 0
[DEBUG/Process-1] running the remaining "atexit" finalizers
Process Process-1:
Traceback (most recent call last):
  File "C:\Users\User\crankycoin\crankycoin\services\queue.py", line 18, in start_queue
    frontend.bind(cls.QUEUE_BIND_IN)
  File "zmq\backend\cython\socket.pyx", line 547, in zmq.backend.cython.socket.Socket.bind
  File "zmq\backend\cython\checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Protocol not supported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\User\crankycoin\crankycoin\services\queue.py", line 26, in start_queue
    logger.error("could not start queue: %s", e.message)
AttributeError: 'ZMQError' object has no attribute 'message'
[INFO/Process-1] process exiting with exitcode 1
[DEBUG/MainProcess] running the remaining "atexit" finalizers

Difficulty adjustment

Hi!
Thank you for this great project!
I had a confusion with the calculate_hash_difficulty() function in blockchain.py. Shouldn't we divide the calculated timestamp_data by DIFFICULTY_ADJUSTMENT_SPAN, as we want to adjust the difficulty for just one block?

Add more tests, add Travis CI

Among those two suggestions, perhaps we could consider migrating to sockets rather than HTTP requests? Major performance improvements are possible by doing so, as sockets are far more efficient than HTTP.

command publickey does not work for me

Hi,

I tried to run the command publickey but I got the below error. Any idea hoe to fix this?
Cranky Coin (CRNK) wallet > publickey
Traceback (most recent call last):
File "run.py", line 218, in
main(sys.argv[1:])
File "run.py", line 210, in main
client()
File "run.py", line 75, in client
print(wallet.get_public_key())
File "/home/jani/crankycoin-master/crankycoin/wallet.py", line 27, in get_public_key
return self.public_key.to_hex()
AttributeError: 'PublicKey' object has no attribute 'to_hex'

This is the first time I'm running this and there is no publickey but I think it should be created now.

[Ubuntu/Python 3.6] Can't mine with full node

File "/home/user/Desktop/crankycoin/crankycoin/repository/blockchain.py", line 236, in get_reward
    for i in range(1, ((height, / self.HALVING_FREQUENCY) + 1)):
TypeError: 'float' object cannot be interpreted as an integer

TypeError: can't pickle thread.lock objects

File "C:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python27\lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\Python27\lib\pickle.py", line 687, in _batch_setitems
save(v)
File "C:\Python27\lib\pickle.py", line 306, in save
rv = reduce(self.proto)
TypeError: can't pickle thread.lock objects

C:\Users******\Desktop\crankycoin-master (1)\crankycoin-master>Trace
cent call last):
File "", line 1, in
File "C:\Python27\lib\multiprocessing\forking.py", line 381, in m
self = load(from_parent)
File "C:\Python27\lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 864, in load
dispatchkey
File "C:\Python27\lib\pickle.py", line 886, in load_eof
raise EOFError
EOFError

Node operation mode not specified

Hello, i try to run crankycoin, i do python run.py but i receive this message "Node operation mode not specified", what i need to do?

Publish to Coinmarketcap

Hi, found your code searching for example to create my own coin. Interesting code, did you try to publish your coin at index pages like coinmarketcap.com, its still not listed, why?

TypeError: Unicode-objects must be encoded before hashing

Choose a passphrase:
Re-enter passphrase:
Secret: ****
Traceback (most recent call last):
  File ".\tools\encrypt.py", line 22, in <module>
    hashedpass = hashlib.sha256(passphrase).digest()
TypeError: Unicode-objects must be encoded before hashing

Opening a PR to fix this

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.