{ "info": { "author": "Renato Orgito", "author_email": "orgito@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Topic :: Education", "Topic :: Security :: Cryptography" ], "description": "UCLCoin\n========\n.. image:: https://img.shields.io/pypi/v/uclcoin.svg?style=flat-square\n :target: https://pypi.org/project/uclcoin\n\n.. image:: https://img.shields.io/pypi/pyversions/uclcoin.svg?style=flat-square\n :target: https://pypi.org/project/uclcoin\n\n.. image:: https://img.shields.io/pypi/l/uclcoin.svg?style=flat-square\n :target: https://pypi.org/project/uclcoin\n\n-----\n\nA naive blockchain/cryptocurrency implementation for educational purposes.\n\n\nInstallation\n------------\n\nUCLCoin is distributed on PyPI and is available on Linux/macOS and Windows and supports Python 3.6+.\n\n.. code-block:: bash\n\n $ pip install -U uclcoin\n\nExamples\n--------\n\nFor the following code examples it is assumed that the necessary dependecies were imported.\n\n.. code-block:: python\n\n >>> from uclcoin import KeyPair, Transaction, Block, BlockChain\n\nGenerating your key pair\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe private key is used to sign transactions and the public key is your UCLCoin address. It is used\nto receive coins from transactions and rewards from mining.\n\nUse the ``KeyPair`` class to generate your keys\n\n.. code-block:: python\n\n >>> wallet = KeyPair()\n >>> address = wallet.public_key\n >>> address\n '03d70f9a58c9bc6d8fdc47f96d6931f14a7abb0d72cd76886ee05047023fd49471'\n\nTo reuse your key pair instantiate the class using your private key ``wallet.private_key``\n\n.. code-block:: python\n\n >>> wallet = KeyPair('your-private-key')\n\nBlockChain\n^^^^^^^^^^\n\nCreate a new BlockChain for doing your tests:\n\n.. code-block:: python\n\n >>> blockchain = BlockChain()\n\nYour ``blockchain`` will contain only the Genesis block. It is ready to accept\ntransactions, but you can't send any coins if your balance is zero.\n\n.. code-block:: python\n\n >>> blockchain.get_balance(wallet.public_key)\n 0\n\nMining a block\n^^^^^^^^^^^^^^\n\nGet a new minable block from the blockchain:\n\n.. code-block:: python\n\n >>> new_block = blockchain.get_minable_block(wallet.public_key)\n\nThe blockchain returns a new block with the next valid index, any pending\ntransactions and a coinbase (reward) transaction to your public key (wallet.public_key)\n\nUCLCoin the proof of work consists on manipulating the ``nonce`` field and recalculating\nthe block hash until it starts with ``N`` zeros. The current difficulty can be obtained with the\n``calculate_hash_difficulty`` method.\n\n.. code-block:: python\n\n >>> N = blockchain.calculate_hash_difficulty()\n\nA simple mining method is to increment the nonce until you get a valid hash:\n\n.. code-block:: python\n\n >>> while new_block.current_hash[:N].count('0') < N:\n ... new_block.nonce +=1\n ... new_block.recalculate_hash()\n\nThe operation will block while the hash is calculated. After finishing just submit the\nnew block to the blockchain. If it is accepted your balance will be updated.\n\n.. code-block:: python\n\n >>> blockchain.add_block(new_block)\n True\n >>> blockchain.get_balance(wallet.public_key)\n 10\n\nSending a transaction\n^^^^^^^^^^^^^^^^^^^^^\n\nYou can now spent your new coins.\n\n.. code-block:: python\n\n >>> destination = 'public_key_of_the_receiver'\n >>> value = wallet.create_transaction(destination, 2)\n >>> blockchain.add_transaction(value)\n True\n\nYour transaction will be added to the pending transactions queue. It will only be confirmed after being\nincluded in a mined block.\n\n.. code-block:: python\n\n >>> blockchain.get_balance(wallet.public_key)\n 10\n\nYou can check your balance including the pending transactions\n\n.. code-block:: python\n\n >>> blockchain.get_balance_pending(wallet.public_key)\n 8\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/orgito/uclcoin", "keywords": "uclcoin blockchain cryptocurrency", "license": "MIT", "maintainer": "Renato Orgito", "maintainer_email": "orgito@gmail.com", "name": "uclcoin", "package_url": "https://pypi.org/project/uclcoin/", "platform": "", "project_url": "https://pypi.org/project/uclcoin/", "project_urls": { "Bug Reports": "https://github.com/orgito/uclcoin/issues", "Homepage": "https://github.com/orgito/uclcoin", "Source": "https://github.com/orgito/uclcoin" }, "release_url": "https://pypi.org/project/uclcoin/0.3.2/", "requires_dist": [ "coincurve", "pymongo" ], "requires_python": ">=3.6", "summary": "UCLCoin: A naive blockchain/cryptocurrency implementation", "version": "0.3.2" }, "last_serial": 3959483, "releases": { "0.2.2": [ { "comment_text": "", "digests": { "md5": "6f42d0adefadead48a1de6f91a6c093a", "sha256": "18945f4df1b4ddacc58f92bec1eb013b9cad8a81c4854ff762d2c840da79126a" }, "downloads": -1, "filename": "uclcoin-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6f42d0adefadead48a1de6f91a6c093a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10236, "upload_time": "2018-05-17T15:58:32", "url": "https://files.pythonhosted.org/packages/30/8a/e5d04e0e6169f9ebd2f194d813290f8791dd14f2c8a50d7bb1857502e621/uclcoin-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bbf5f52c22110bd31b688811820d75c2", "sha256": "062716efba7115ad2457396912fca97bcc9fec58313f69cecfd636459eb2b6f0" }, "downloads": -1, "filename": "uclcoin-0.2.2.tar.gz", "has_sig": false, "md5_digest": "bbf5f52c22110bd31b688811820d75c2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8310, "upload_time": "2018-05-17T15:58:33", "url": "https://files.pythonhosted.org/packages/b8/25/873333a387a2b5029b3089d8fd9079f485997df148853250ed275da30049/uclcoin-0.2.2.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "d2a90c50bfea0cabbcbb7721c1c1956c", "sha256": "718aa1d14bbdea42fce7e668b0548d65e436bbde432526df91cbe90dc9d123c6" }, "downloads": -1, "filename": "uclcoin-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d2a90c50bfea0cabbcbb7721c1c1956c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 8180, "upload_time": "2018-06-13T17:32:12", "url": "https://files.pythonhosted.org/packages/b9/d2/41896f28f01072044d229a39392f4c0dc4207d2d525b8a591c9afdbb2932/uclcoin-0.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "887b6ead49f9e602d48de858d8ece0eb", "sha256": "87ca5a2c8f5139d2b60f687e16e56d1a644c68a7f75cd7ab1c043855bcb5e315" }, "downloads": -1, "filename": "uclcoin-0.3.2.tar.gz", "has_sig": false, "md5_digest": "887b6ead49f9e602d48de858d8ece0eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7566, "upload_time": "2018-06-13T17:32:38", "url": "https://files.pythonhosted.org/packages/08/1d/3d2ed3186cd59632c76695ecc31595edada3e7d8ddb3d544b54f50c9d96d/uclcoin-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d2a90c50bfea0cabbcbb7721c1c1956c", "sha256": "718aa1d14bbdea42fce7e668b0548d65e436bbde432526df91cbe90dc9d123c6" }, "downloads": -1, "filename": "uclcoin-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d2a90c50bfea0cabbcbb7721c1c1956c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 8180, "upload_time": "2018-06-13T17:32:12", "url": "https://files.pythonhosted.org/packages/b9/d2/41896f28f01072044d229a39392f4c0dc4207d2d525b8a591c9afdbb2932/uclcoin-0.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "887b6ead49f9e602d48de858d8ece0eb", "sha256": "87ca5a2c8f5139d2b60f687e16e56d1a644c68a7f75cd7ab1c043855bcb5e315" }, "downloads": -1, "filename": "uclcoin-0.3.2.tar.gz", "has_sig": false, "md5_digest": "887b6ead49f9e602d48de858d8ece0eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7566, "upload_time": "2018-06-13T17:32:38", "url": "https://files.pythonhosted.org/packages/08/1d/3d2ed3186cd59632c76695ecc31595edada3e7d8ddb3d544b54f50c9d96d/uclcoin-0.3.2.tar.gz" } ] }