bictoin-message-tool


Namebictoin-message-tool JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryBitcoin message signing/verification tool
upload_time2023-01-29 17:44:53
maintainer
docs_urlNone
authorshadowy-pycoder
requires_python>=3.10,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Bitcoin Message Tool
======

Bitcoin message signing/verification tool

A lightweight CLI tool for signing and verification of bitcoin messages.
Bitcoin message is the most straightforward and natural way to prove ownership over
a given address without revealing any confidential information.

Installation
------------

To install with pip, run:

    pip install bitcoin_message_tool

Quickstart Guide
----------------

    Usage:

    python bmt.py -h
    usage: python3 bmt.py [-h] {sign,verify} ...

    Bitcoin message signing/verification tool

    positional arguments:
    {sign,verify}

    options:
    -h, --help     show this help message and exit

Message signing:

    python bmt.py sign -h
    usage: python3 bmt.py sign [-h] -p -a {p2pkh,p2wpkh-p2sh,p2wpkh} -m [MESSAGE ...] [-d] [-v]

    options:
    -h, --help            show this help message and exit

    Sign messsage:
    -p, --privkey         private key in wallet import format (WIF)
    -a {p2pkh,p2wpkh-p2sh,p2wpkh}, --addr_type {p2pkh,p2wpkh-p2sh,p2wpkh}
                            type of bitcoin address
    -m [MESSAGE ...], --message [MESSAGE ...]
                            Message to sign
    -d, --deterministic   sign deterministtically (RFC6979)
    -v, --verbose         print prettified message

Example 1:
Non-deterministic signature for compressed private key and p2pkh address

    $python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced

    PrivateKey(WIF): <insert private key here>

Output:

    Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
    Message: ECDSA is the most fun I have ever experienced
    Signature: IBuc5GXSJCr6m7KevsBAoCiX8ToOjW2CDZMr6PCEbiHwQJ237LZTj/REbDHI1/yelY6uBWEWXiOWoGnajlgvO/A=

Example 2:
Deterministic signature for compressed private key and p2pkh address

    $python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d

    PrivateKey(WIF): <insert private key here>

Output:

    Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
    Message: ECDSA is the most fun I have ever experienced
    Signature: HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=

Example 3:
Deterministic signature for compressed private key and p2pkh address (verbose mode)

    $python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d -v

    PrivateKey(WIF): <insert private key here>

Output:

    -----BEGIN BITCOIN SIGNED MESSAGE-----
    ECDSA is the most fun I have ever experienced
    -----BEGIN BITCOIN SIGNATURE-----
    175A5YsPUdM71mnNCC3i8faxxYJgBonjWL

    HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
    -----END BITCOIN SIGNATURE-----

Example 4:
Uncompressed private keys can't produce addresses other than 'p2pkh'

    python bmt.py sign -p -m ECDSA is the most fun I have ever experienced -a 'p2wpkh'  -d -v

    PrivateKey(WIF): <insert private key here>

Output:

    Traceback (most recent call last):
    ...
    PrivateKeyError: ('Need WIF-compressed private key for this address type:', 'p2wpkh')

Message verification:

    python bmt.py verify -h
    usage: python3 bmt.py verify [-h] -a ADDRESS -m [MESSAGE ...] -s SIGNATURE [-v] [-r]

    options:
    -h, --help            show this help message and exit

    Verify messsage:
    -a ADDRESS, --address ADDRESS
                            specify bitcoin address
    -m [MESSAGE ...], --message [MESSAGE ...]
                            Message to verify
    -s SIGNATURE, --signature SIGNATURE
                            bitcoin signature in base64 format
    -v, --verbose         print full message
    -r, --recpub          recover public key

Example 1:
Standard message verification

    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
    > -m ECDSA is the most fun I have ever experienced \
    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=

Output:

    True

Example 2:
Message verification in verbose mode

    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
    > -m ECDSA is the most fun I have ever experienced \
    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \
    > -v

Output:

    True
    Message verified to be from 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL

Example 3:
Display a recovered public key

    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
    > -m ECDSA is the most fun I have ever experienced \
    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \
    > --recpub

Output:

    True
    024aeaf55040fa16de37303d13ca1dde85f4ca9baa36e2963a27a1c0c1165fe2b1

Example 4:
Error message

    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
    > -m ECDSA is the most fun I have ever experienced \
    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLaffa43Jj= -v -r \

Output:

    Traceback (most recent call last):
    ...
    SignatureError: ('Signature must be 65 bytes long:', 57)

Contribute
----------

If you'd like to contribute to bitcoin_message_signer, check out https://github.com/shadowy_pycoder/bitcoin_message_tool

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "bictoin-message-tool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "shadowy-pycoder",
    "author_email": "shadowy-pycoder@example.com",
    "download_url": "https://files.pythonhosted.org/packages/f2/30/fa38920ac5cb16bc0327cf8b08a144acc5d0d24a5be43b23a72c0ea6d948/bictoin_message_tool-0.1.0.tar.gz",
    "platform": null,
    "description": "Bitcoin Message Tool\n======\n\nBitcoin message signing/verification tool\n\nA lightweight CLI tool for signing and verification of bitcoin messages.\nBitcoin message is the most straightforward and natural way to prove ownership over\na given address without revealing any confidential information.\n\nInstallation\n------------\n\nTo install with pip, run:\n\n    pip install bitcoin_message_tool\n\nQuickstart Guide\n----------------\n\n    Usage:\n\n    python bmt.py -h\n    usage: python3 bmt.py [-h] {sign,verify} ...\n\n    Bitcoin message signing/verification tool\n\n    positional arguments:\n    {sign,verify}\n\n    options:\n    -h, --help     show this help message and exit\n\nMessage signing:\n\n    python bmt.py sign -h\n    usage: python3 bmt.py sign [-h] -p -a {p2pkh,p2wpkh-p2sh,p2wpkh} -m [MESSAGE ...] [-d] [-v]\n\n    options:\n    -h, --help            show this help message and exit\n\n    Sign messsage:\n    -p, --privkey         private key in wallet import format (WIF)\n    -a {p2pkh,p2wpkh-p2sh,p2wpkh}, --addr_type {p2pkh,p2wpkh-p2sh,p2wpkh}\n                            type of bitcoin address\n    -m [MESSAGE ...], --message [MESSAGE ...]\n                            Message to sign\n    -d, --deterministic   sign deterministtically (RFC6979)\n    -v, --verbose         print prettified message\n\nExample 1:\nNon-deterministic signature for compressed private key and p2pkh address\n\n    $python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced\n\n    PrivateKey(WIF): <insert private key here>\n\nOutput:\n\n    Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL\n    Message: ECDSA is the most fun I have ever experienced\n    Signature: IBuc5GXSJCr6m7KevsBAoCiX8ToOjW2CDZMr6PCEbiHwQJ237LZTj/REbDHI1/yelY6uBWEWXiOWoGnajlgvO/A=\n\nExample 2:\nDeterministic signature for compressed private key and p2pkh address\n\n    $python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d\n\n    PrivateKey(WIF): <insert private key here>\n\nOutput:\n\n    Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL\n    Message: ECDSA is the most fun I have ever experienced\n    Signature: HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=\n\nExample 3:\nDeterministic signature for compressed private key and p2pkh address (verbose mode)\n\n    $python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d -v\n\n    PrivateKey(WIF): <insert private key here>\n\nOutput:\n\n    -----BEGIN BITCOIN SIGNED MESSAGE-----\n    ECDSA is the most fun I have ever experienced\n    -----BEGIN BITCOIN SIGNATURE-----\n    175A5YsPUdM71mnNCC3i8faxxYJgBonjWL\n\n    HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=\n    -----END BITCOIN SIGNATURE-----\n\nExample 4:\nUncompressed private keys can't produce addresses other than 'p2pkh'\n\n    python bmt.py sign -p -m ECDSA is the most fun I have ever experienced -a 'p2wpkh'  -d -v\n\n    PrivateKey(WIF): <insert private key here>\n\nOutput:\n\n    Traceback (most recent call last):\n    ...\n    PrivateKeyError: ('Need WIF-compressed private key for this address type:', 'p2wpkh')\n\nMessage verification:\n\n    python bmt.py verify -h\n    usage: python3 bmt.py verify [-h] -a ADDRESS -m [MESSAGE ...] -s SIGNATURE [-v] [-r]\n\n    options:\n    -h, --help            show this help message and exit\n\n    Verify messsage:\n    -a ADDRESS, --address ADDRESS\n                            specify bitcoin address\n    -m [MESSAGE ...], --message [MESSAGE ...]\n                            Message to verify\n    -s SIGNATURE, --signature SIGNATURE\n                            bitcoin signature in base64 format\n    -v, --verbose         print full message\n    -r, --recpub          recover public key\n\nExample 1:\nStandard message verification\n\n    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \\\n    > -m ECDSA is the most fun I have ever experienced \\\n    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=\n\nOutput:\n\n    True\n\nExample 2:\nMessage verification in verbose mode\n\n    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \\\n    > -m ECDSA is the most fun I have ever experienced \\\n    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \\\n    > -v\n\nOutput:\n\n    True\n    Message verified to be from 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL\n\nExample 3:\nDisplay a recovered public key\n\n    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \\\n    > -m ECDSA is the most fun I have ever experienced \\\n    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \\\n    > --recpub\n\nOutput:\n\n    True\n    024aeaf55040fa16de37303d13ca1dde85f4ca9baa36e2963a27a1c0c1165fe2b1\n\nExample 4:\nError message\n\n    python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \\\n    > -m ECDSA is the most fun I have ever experienced \\\n    > -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLaffa43Jj= -v -r \\\n\nOutput:\n\n    Traceback (most recent call last):\n    ...\n    SignatureError: ('Signature must be 65 bytes long:', 57)\n\nContribute\n----------\n\nIf you'd like to contribute to bitcoin_message_signer, check out https://github.com/shadowy_pycoder/bitcoin_message_tool\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Bitcoin message signing/verification tool",
    "version": "0.1.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f270a68ad61b236f2db6b8d7398cc7c5464bd2c7d99c68f8e59baf4c9ab2b922",
                "md5": "aeb9eedfc9eb51a994a34a2cec5ec19f",
                "sha256": "62fb0c058402d50a7954b3368cb31fa46ae0b20b27ad2ec187882d7c530abf8e"
            },
            "downloads": -1,
            "filename": "bictoin_message_tool-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aeb9eedfc9eb51a994a34a2cec5ec19f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 361719,
            "upload_time": "2023-01-29T17:44:42",
            "upload_time_iso_8601": "2023-01-29T17:44:42.927509Z",
            "url": "https://files.pythonhosted.org/packages/f2/70/a68ad61b236f2db6b8d7398cc7c5464bd2c7d99c68f8e59baf4c9ab2b922/bictoin_message_tool-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f230fa38920ac5cb16bc0327cf8b08a144acc5d0d24a5be43b23a72c0ea6d948",
                "md5": "1c5631556e1bae38a2f2d54bd761edfb",
                "sha256": "d40329f518db05a3c5cc296bef37d79dbeaf320caa81de920005cfa8e3abaf9e"
            },
            "downloads": -1,
            "filename": "bictoin_message_tool-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1c5631556e1bae38a2f2d54bd761edfb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 286457,
            "upload_time": "2023-01-29T17:44:53",
            "upload_time_iso_8601": "2023-01-29T17:44:53.654495Z",
            "url": "https://files.pythonhosted.org/packages/f2/30/fa38920ac5cb16bc0327cf8b08a144acc5d0d24a5be43b23a72c0ea6d948/bictoin_message_tool-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-29 17:44:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "bictoin-message-tool"
}
        
Elapsed time: 0.05346s