Core functionality of kaze-python
Project description
.. image:: https://kaze.solutions/content/static/img/general/logo.svg
:alt: kaze logo
Library for working with KAZE related data in Python, without database dependencies.
----------
.. image:: https://travis-ci.org/KAZEBLOCKCHAIN/kaze-python-core.svg?branch=master
:target: https://travis-ci.org/KAZEBLOCKCHAIN/kaze-python-core
.. image:: https://coveralls.io/repos/github/KAZEBLOCKCHAIN/kaze-python-core/badge.svg
:target: https://coveralls.io/github/KAZEBLOCKCHAIN/kaze-python-core
.. image:: https://readthedocs.org/projects/kaze-python-core/badge/?version=latest
:target: https://kaze-python-core.readthedocs.io/
:alt: ReadTheDocs
.. image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://github.com/KAZEBLOCKCHAIN/kaze-python-core/blob/master/LICENSE.md
:alt: MIT
* Datatypes like ``UInt160``, ``KeyPair``, ``BigInteger`` and basic string to address and address to ``UInt160`` methods
* Includes a useful cli-tool ``np-utils`` (see help with ``np-utils -h``)
* Compatible with Python 3.5+
* Used by `kaze-python <https://github.com/KAZEBLOCKCHAIN/kaze-python>`_
* https://pypi.python.org/pypi/kazecore
``np-utils`` examples:
.. code-block:: console
$ np-utils -h
usage: np-utils [-h] [--version] [--address-to-scripthash address]
[--scripthash-to-address scripthash] [--create-wallet]
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--address-to-scripthash address
Convert an address to scripthash
--scripthash-to-address scripthash
Convert scripthash to address
--create-wallet Create a wallet
$ np-utils --create-wallet
{
"private_key": "KwJqCbjsmGUCqbkp83Nxi9MJ9mA7F8EN4tebJVWjYZBEoWCNxCaF",
"address": "KHVvg26CNz1vxteJfeHy4R8P4VN8SydCM6"
}
$ np-utils --address-to-scripthash AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y
Scripthash big endian: 0xe9eed8dc39332032dc22e5d6e86332c50327ba23
Scripthash little endian: 23ba2703c53263e8d6e522dc32203339dcd8eee9
Scripthash kaze-python format: b'#\xba\'\x03\xc52c\xe8\xd6\xe5"\xdc2 39\xdc\xd8\xee\xe9'
$ np-utils --scripthash-to-address 0xe9eed8dc39332032dc22e5d6e86332c50327ba23
KHVvg26CNz1vxteJfeHy4R8P4VN8SydCM6
$ np-utils --scripthash-to-address 23ba2703c53263e8d6e522dc32203339dcd8eee9
Detected little endian scripthash. Converting to big endian for internal use.
Big endian scripthash: 0xe9eed8dc39332032dc22e5d6e86332c50327ba23
KHVvg26CNz1vxteJfeHy4R8P4VN8SydCM6
Getting started
---------------
You need Python 3.5 or higher!
You can install `kazecore` from PyPI with ``easy_install`` or ``pip``:
.. code-block:: console
$ pip install -U kazecore
Alternatively, if you want to work on the code, clone this repository and setup your venv:
* Clone the repo: ``git clone https://github.com/KAZEBLOCKCHAIN/kaze-python-core.git``
* Create a Python 3 virtual environment and activate it:
.. code-block:: console
$ python3 -m venv venv
$ source venv/bin/activate
* Then install the requirements:
.. code-block:: console
$ pip install -e .
$ pip install -r requirements_dev.txt
Useful commands
^^^^^^^^^^^^^^^
.. code-block:: console
$ make lint
$ make test
$ make coverage
Release checklist
^^^^^^^^^^^^^^^^^
(Only for admins)
Releasing a new version on GitHub automatically uploads this release to PyPI.
This is a checklist for releasing a new version:
.. code-block:: console
# Only in case you want to increase the version number again (eg. scope changed from patch to minor):
bumpversion --no-tag minor|major
# Update ``HISTORY.rst`` with the new version number and the changes and commit this
vi HISTORY.rst
git commit -m "Updated HISTORY.rst" HISTORY.rst
# Set the release version number and create the tag
bumpversion release
# Increase patch number and add `-dev`
bumpversion --no-tag patch
# Push to GitHub, which also updates the PyPI package
git push && git push --tags
=======
History
=======
0.5.4-dev in progress
---------------------
* ...
0.5.3 2019-10-02
----------------
* Updated the dependencies
0.5.2 (2018-08-28)
------------------
* `Fixed8.TryParse` fix for zero
* Updated dependencies
0.5.1 (2018-08-23)
------------------
* Change BigInteger divisor operation to use floordiv rather than truediv
0.5.0 (2018-08-21)
------------------
* `np-utils --address-to-scripthash` outputs now little-endian and big-endian scripthashes
* `np-utils --scripthash-to-address` detects input endianness and converts accordingly
* Updated dependencies
0.4.11 (2018-07-05)
-------------------
* Added ``Size()`` method to `ECPoint` and `Fixed8` class.
0.4.10 (2018-06-25)
-------------------
* Updated requirements: pycryptome
0.4.9 (2018-06-08)
------------------
* Updated dependencies, especially base58
0.4.8 (2018-05-31)
----------------------------
* Create wallets with ``np-utils --create-wallet``
0.4.7 (2018-05-30)
------------------
* ``BigInteger(0)`` now is ``b'\x00'`` (`PR #50 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/50>`_)
0.4.6 (2018-04-30)
------------------
* make unhexlify in Crypto.VerifySignature optional (`PR #48 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/48>`_)
0.4.2 (2018-04-26)
------------------
* ``np-utils`` now supports ``--scripthash-to-address`` (thx @belane)
0.4.1 (2018-04-26)
-----------------------------
* ``np-utils`` cli tool (see ``cli.py``, `PR #40 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/40>`_)
* alter initialization of Crypto signature curve
0.3.10 (2018-03-21)
----------------------------
* Fix formatting of ``ToKazeJsonString()`` which was cutting off trailing zeroes from integers.
0.3.8 (2018-03-14)
------------------
* Fix travis deploy to be compatible with recent kaze-python changes
* Update scrypt and logzero dependency versions
0.3.6 (2018-02-26)
------------------
* Enabled Python >= 3.4 in setup.py
0.3.5 (2018-02-15)
------------------
* Bugfix: Dont unhex when writing var bytes (`PR #36 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/36>`_)
0.3.4 (2018-01-25)
------------------
* Added ``ParseString`` method to UInt160/UInt256 (`PR #35 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/35>`_)
0.3.3 (2018-01-25)
------------------
* Added ``Fixed8.ToJsonString()`` (`PR #33 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/33>`_)
0.3.2 (2018-01-23)
------------------
* Added UInt ``To0xString`` method
0.3.1 (2018-01-09)
------------------
* Documentation update
* Moved the ``cryptography`` dependency to ``requirements_dev.txt``
0.3.0 (2018-01-09)
------------------
* Added ``kaze.Cryptography`` and ``KeyPair``
* Changed signature of ``kazecore.Cryptography.Crypto.Sign()`` to remove unused ``public_key`` argument
* Removed redundant ``kazecore.Cryptography.Helper.hash_to_wallet_address()`` function, use ``kazecore.Cryptography.Helper.scripthash_to_address()`` instead.
* Removed unused ``kazecore.Cryptography.Helper`` functions: ``random_string``, ``bytes_to_hex_string``, ``bin_sha256``, ``sha256``, ``random_key``.
0.2.4 + 0.2.5 (2018-01-03)
--------------------------
* Bugfix for deploying from Travis to PyPI/kazecore
0.2.3 (2018-01-03)
------------------
* Bugfix for BinaryWriter (`PR #13 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/13>`_)
0.2.1 (2018-01-02)
------------------
* Added UInt*, Fixed8 and kaze.IO.Binary* (`PR #9 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/9>`_)
0.1.1 - 0.1.2 (2017-12-30)
--------------------------
* Testing of releases on PyPI with Travis CI.
0.1.0 (2017-12-28)
------------------
* First release on PyPI.
:alt: kaze logo
Library for working with KAZE related data in Python, without database dependencies.
----------
.. image:: https://travis-ci.org/KAZEBLOCKCHAIN/kaze-python-core.svg?branch=master
:target: https://travis-ci.org/KAZEBLOCKCHAIN/kaze-python-core
.. image:: https://coveralls.io/repos/github/KAZEBLOCKCHAIN/kaze-python-core/badge.svg
:target: https://coveralls.io/github/KAZEBLOCKCHAIN/kaze-python-core
.. image:: https://readthedocs.org/projects/kaze-python-core/badge/?version=latest
:target: https://kaze-python-core.readthedocs.io/
:alt: ReadTheDocs
.. image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://github.com/KAZEBLOCKCHAIN/kaze-python-core/blob/master/LICENSE.md
:alt: MIT
* Datatypes like ``UInt160``, ``KeyPair``, ``BigInteger`` and basic string to address and address to ``UInt160`` methods
* Includes a useful cli-tool ``np-utils`` (see help with ``np-utils -h``)
* Compatible with Python 3.5+
* Used by `kaze-python <https://github.com/KAZEBLOCKCHAIN/kaze-python>`_
* https://pypi.python.org/pypi/kazecore
``np-utils`` examples:
.. code-block:: console
$ np-utils -h
usage: np-utils [-h] [--version] [--address-to-scripthash address]
[--scripthash-to-address scripthash] [--create-wallet]
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--address-to-scripthash address
Convert an address to scripthash
--scripthash-to-address scripthash
Convert scripthash to address
--create-wallet Create a wallet
$ np-utils --create-wallet
{
"private_key": "KwJqCbjsmGUCqbkp83Nxi9MJ9mA7F8EN4tebJVWjYZBEoWCNxCaF",
"address": "KHVvg26CNz1vxteJfeHy4R8P4VN8SydCM6"
}
$ np-utils --address-to-scripthash AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y
Scripthash big endian: 0xe9eed8dc39332032dc22e5d6e86332c50327ba23
Scripthash little endian: 23ba2703c53263e8d6e522dc32203339dcd8eee9
Scripthash kaze-python format: b'#\xba\'\x03\xc52c\xe8\xd6\xe5"\xdc2 39\xdc\xd8\xee\xe9'
$ np-utils --scripthash-to-address 0xe9eed8dc39332032dc22e5d6e86332c50327ba23
KHVvg26CNz1vxteJfeHy4R8P4VN8SydCM6
$ np-utils --scripthash-to-address 23ba2703c53263e8d6e522dc32203339dcd8eee9
Detected little endian scripthash. Converting to big endian for internal use.
Big endian scripthash: 0xe9eed8dc39332032dc22e5d6e86332c50327ba23
KHVvg26CNz1vxteJfeHy4R8P4VN8SydCM6
Getting started
---------------
You need Python 3.5 or higher!
You can install `kazecore` from PyPI with ``easy_install`` or ``pip``:
.. code-block:: console
$ pip install -U kazecore
Alternatively, if you want to work on the code, clone this repository and setup your venv:
* Clone the repo: ``git clone https://github.com/KAZEBLOCKCHAIN/kaze-python-core.git``
* Create a Python 3 virtual environment and activate it:
.. code-block:: console
$ python3 -m venv venv
$ source venv/bin/activate
* Then install the requirements:
.. code-block:: console
$ pip install -e .
$ pip install -r requirements_dev.txt
Useful commands
^^^^^^^^^^^^^^^
.. code-block:: console
$ make lint
$ make test
$ make coverage
Release checklist
^^^^^^^^^^^^^^^^^
(Only for admins)
Releasing a new version on GitHub automatically uploads this release to PyPI.
This is a checklist for releasing a new version:
.. code-block:: console
# Only in case you want to increase the version number again (eg. scope changed from patch to minor):
bumpversion --no-tag minor|major
# Update ``HISTORY.rst`` with the new version number and the changes and commit this
vi HISTORY.rst
git commit -m "Updated HISTORY.rst" HISTORY.rst
# Set the release version number and create the tag
bumpversion release
# Increase patch number and add `-dev`
bumpversion --no-tag patch
# Push to GitHub, which also updates the PyPI package
git push && git push --tags
=======
History
=======
0.5.4-dev in progress
---------------------
* ...
0.5.3 2019-10-02
----------------
* Updated the dependencies
0.5.2 (2018-08-28)
------------------
* `Fixed8.TryParse` fix for zero
* Updated dependencies
0.5.1 (2018-08-23)
------------------
* Change BigInteger divisor operation to use floordiv rather than truediv
0.5.0 (2018-08-21)
------------------
* `np-utils --address-to-scripthash` outputs now little-endian and big-endian scripthashes
* `np-utils --scripthash-to-address` detects input endianness and converts accordingly
* Updated dependencies
0.4.11 (2018-07-05)
-------------------
* Added ``Size()`` method to `ECPoint` and `Fixed8` class.
0.4.10 (2018-06-25)
-------------------
* Updated requirements: pycryptome
0.4.9 (2018-06-08)
------------------
* Updated dependencies, especially base58
0.4.8 (2018-05-31)
----------------------------
* Create wallets with ``np-utils --create-wallet``
0.4.7 (2018-05-30)
------------------
* ``BigInteger(0)`` now is ``b'\x00'`` (`PR #50 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/50>`_)
0.4.6 (2018-04-30)
------------------
* make unhexlify in Crypto.VerifySignature optional (`PR #48 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/48>`_)
0.4.2 (2018-04-26)
------------------
* ``np-utils`` now supports ``--scripthash-to-address`` (thx @belane)
0.4.1 (2018-04-26)
-----------------------------
* ``np-utils`` cli tool (see ``cli.py``, `PR #40 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/40>`_)
* alter initialization of Crypto signature curve
0.3.10 (2018-03-21)
----------------------------
* Fix formatting of ``ToKazeJsonString()`` which was cutting off trailing zeroes from integers.
0.3.8 (2018-03-14)
------------------
* Fix travis deploy to be compatible with recent kaze-python changes
* Update scrypt and logzero dependency versions
0.3.6 (2018-02-26)
------------------
* Enabled Python >= 3.4 in setup.py
0.3.5 (2018-02-15)
------------------
* Bugfix: Dont unhex when writing var bytes (`PR #36 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/36>`_)
0.3.4 (2018-01-25)
------------------
* Added ``ParseString`` method to UInt160/UInt256 (`PR #35 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/35>`_)
0.3.3 (2018-01-25)
------------------
* Added ``Fixed8.ToJsonString()`` (`PR #33 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/33>`_)
0.3.2 (2018-01-23)
------------------
* Added UInt ``To0xString`` method
0.3.1 (2018-01-09)
------------------
* Documentation update
* Moved the ``cryptography`` dependency to ``requirements_dev.txt``
0.3.0 (2018-01-09)
------------------
* Added ``kaze.Cryptography`` and ``KeyPair``
* Changed signature of ``kazecore.Cryptography.Crypto.Sign()`` to remove unused ``public_key`` argument
* Removed redundant ``kazecore.Cryptography.Helper.hash_to_wallet_address()`` function, use ``kazecore.Cryptography.Helper.scripthash_to_address()`` instead.
* Removed unused ``kazecore.Cryptography.Helper`` functions: ``random_string``, ``bytes_to_hex_string``, ``bin_sha256``, ``sha256``, ``random_key``.
0.2.4 + 0.2.5 (2018-01-03)
--------------------------
* Bugfix for deploying from Travis to PyPI/kazecore
0.2.3 (2018-01-03)
------------------
* Bugfix for BinaryWriter (`PR #13 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/13>`_)
0.2.1 (2018-01-02)
------------------
* Added UInt*, Fixed8 and kaze.IO.Binary* (`PR #9 <https://github.com/KAZEBLOCKCHAIN/kaze-python-core/pull/9>`_)
0.1.1 - 0.1.2 (2017-12-30)
--------------------------
* Testing of releases on PyPI with Travis CI.
0.1.0 (2017-12-28)
------------------
* First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kazecore-0.6.8.tar.gz
(34.5 kB
view details)
Built Distribution
File details
Details for the file kazecore-0.6.8.tar.gz
.
File metadata
- Download URL: kazecore-0.6.8.tar.gz
- Upload date:
- Size: 34.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fb2707253ff3591aad220c9de01c295462b921caef732de430b54863c1c6b48 |
|
MD5 | 8b83049240c2384400d7e3f1076841af |
|
BLAKE2b-256 | 5e18c5bc004a6468c58616cd9b53e3ecdff4ff24caa16f7a2ada81a52c90d485 |
File details
Details for the file kazecore-0.6.8-py2.py3-none-any.whl
.
File metadata
- Download URL: kazecore-0.6.8-py2.py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be045eb9009f11188bb514c4fd1b2e07da2f0667217501a2a13698af8547b165 |
|
MD5 | 07637806716e4f4140efb2c3791c2f9f |
|
BLAKE2b-256 | a242c6b43217e3f20abe1908f4a0d481fc13b65953b850a38d0205c56c54298e |