kaspad-client


Namekaspad-client JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://kaspa.org/
SummaryThis is a simple gRPC client for a python application which communiactes with the Kaspa node called KASPAD. Note: This module is created for the RUST version and might be not compatible with the go written node.
upload_time2024-04-09 19:51:46
maintainerNone
docs_urlNone
authorlAmeR1
requires_python<4.0,>=3.12
licenseNone
keywords kaspa kaspad blockchain blockdag kas grpc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            This is a simple gRPC client for a python application which communiactes with the Kaspa node called KASPAD.

The module is based on asyncio, since the Kaspa BlockDAG is unbelievable fast and also needs the support of notifications.

# Usage: see playground.py

    import asyncio

    from kaspad_client.modules.KaspadClient import KaspadClient
    
    
    async def main():
        kaspad_client = KaspadClient("127.0.0.1", 16110)
    
        # print the info message
        print(await kaspad_client.get_info())
    
        # returns
        # {'getInfoResponse': {'p2pId': 'a9728d7e-c07b-4641-936c-6c7442b819f8', 'serverVersion': '0.13.4',
        # 'isUtxoIndexed': True, 'isSynced': True, 'hasNotifyCommand': True, 'hasMessageId': True,
        # 'mempoolSize': '0'}, 'id': '0'}
    
    
        # now let's set up some notifications
        # the decorator registers an async callback function and requests the notification automatically

        @kaspad_client.notify_virtual_daa_score_changed
        async def received_new_daa_score(c):
            print(f"The DAA score is: {c['virtualDaaScoreChangedNotification']['virtualDaaScore']}")
    
        @kaspad_client.notify_virtual_daa_score_changed
        async def received_new_daa_score2(c):
            print(f"The DAA2 score is: {c['virtualDaaScoreChangedNotification']['virtualDaaScore']}")
    
        @kaspad_client.notify_block_added
        async def received_new_daa_score(c):
            print(f"New Kaspa block: {c['blockAddedNotification']['block']['verboseData']['hash']}")
    
        # wait to see some notifcations :-)
        await asyncio.sleep(60)
    
    
    
    asyncio.run(main())
    
    


# Donation

We are doing this in our free time. Please consider a donation if this helps! Thank you!

[kaspa:qrlsm9tvmak6909pr9f35g6scapz5t689nhhls54sfxx5m46sn085ajhn9hn8](https://explorer.kaspa.org/addresses/kaspa:qrlsm9tvmak6909pr9f35g6scapz5t689nhhls54sfxx5m46sn085ajhn9hn8?page=1)


            

Raw data

            {
    "_id": null,
    "home_page": "https://kaspa.org/",
    "name": "kaspad-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": "kaspa, kaspad, blockchain, blockdag, kas, grpc",
    "author": "lAmeR1",
    "author_email": "lamer1@github.com",
    "download_url": "https://files.pythonhosted.org/packages/ce/bf/fbd36bba2fc9a399fd9a1d74dfbd3d9ba304233919d6b20ef99936abb427/kaspad_client-1.0.4.tar.gz",
    "platform": null,
    "description": "This is a simple gRPC client for a python application which communiactes with the Kaspa node called KASPAD.\n\nThe module is based on asyncio, since the Kaspa BlockDAG is unbelievable fast and also needs the support of notifications.\n\n# Usage: see playground.py\n\n    import asyncio\n\n    from kaspad_client.modules.KaspadClient import KaspadClient\n    \n    \n    async def main():\n        kaspad_client = KaspadClient(\"127.0.0.1\", 16110)\n    \n        # print the info message\n        print(await kaspad_client.get_info())\n    \n        # returns\n        # {'getInfoResponse': {'p2pId': 'a9728d7e-c07b-4641-936c-6c7442b819f8', 'serverVersion': '0.13.4',\n        # 'isUtxoIndexed': True, 'isSynced': True, 'hasNotifyCommand': True, 'hasMessageId': True,\n        # 'mempoolSize': '0'}, 'id': '0'}\n    \n    \n        # now let's set up some notifications\n        # the decorator registers an async callback function and requests the notification automatically\n\n        @kaspad_client.notify_virtual_daa_score_changed\n        async def received_new_daa_score(c):\n            print(f\"The DAA score is: {c['virtualDaaScoreChangedNotification']['virtualDaaScore']}\")\n    \n        @kaspad_client.notify_virtual_daa_score_changed\n        async def received_new_daa_score2(c):\n            print(f\"The DAA2 score is: {c['virtualDaaScoreChangedNotification']['virtualDaaScore']}\")\n    \n        @kaspad_client.notify_block_added\n        async def received_new_daa_score(c):\n            print(f\"New Kaspa block: {c['blockAddedNotification']['block']['verboseData']['hash']}\")\n    \n        # wait to see some notifcations :-)\n        await asyncio.sleep(60)\n    \n    \n    \n    asyncio.run(main())\n    \n    \n\n\n# Donation\n\nWe are doing this in our free time. Please consider a donation if this helps! Thank you!\n\n[kaspa:qrlsm9tvmak6909pr9f35g6scapz5t689nhhls54sfxx5m46sn085ajhn9hn8](https://explorer.kaspa.org/addresses/kaspa:qrlsm9tvmak6909pr9f35g6scapz5t689nhhls54sfxx5m46sn085ajhn9hn8?page=1)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "This is a simple gRPC client for a python application which communiactes with the Kaspa node called KASPAD. Note: This module is created for the RUST version and might be not compatible with the go written node.",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://kaspa.org/",
        "Repository": "https://github.com/lAmeR1/py-kaspad-client"
    },
    "split_keywords": [
        "kaspa",
        " kaspad",
        " blockchain",
        " blockdag",
        " kas",
        " grpc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6cdf31c2463ea081db9771427eb7fa6ef3b3ae13b4c3c2ad28a48d192d5fbc5d",
                "md5": "cd4dd44b24e1febec7681aaa5602f264",
                "sha256": "a7fa6c6c08007b39cd548717ac3e63a6251990040f906770a993601b1a82497b"
            },
            "downloads": -1,
            "filename": "kaspad_client-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd4dd44b24e1febec7681aaa5602f264",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 24958,
            "upload_time": "2024-04-09T19:51:44",
            "upload_time_iso_8601": "2024-04-09T19:51:44.445102Z",
            "url": "https://files.pythonhosted.org/packages/6c/df/31c2463ea081db9771427eb7fa6ef3b3ae13b4c3c2ad28a48d192d5fbc5d/kaspad_client-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cebffbd36bba2fc9a399fd9a1d74dfbd3d9ba304233919d6b20ef99936abb427",
                "md5": "336b21bd7fb2451ed764281c65c393e2",
                "sha256": "193cdfe0626294b67c7c5e230e6ca2a5c471fcb958bb348844be59f7a14063f5"
            },
            "downloads": -1,
            "filename": "kaspad_client-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "336b21bd7fb2451ed764281c65c393e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 21985,
            "upload_time": "2024-04-09T19:51:46",
            "upload_time_iso_8601": "2024-04-09T19:51:46.098470Z",
            "url": "https://files.pythonhosted.org/packages/ce/bf/fbd36bba2fc9a399fd9a1d74dfbd3d9ba304233919d6b20ef99936abb427/kaspad_client-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 19:51:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lAmeR1",
    "github_project": "py-kaspad-client",
    "github_not_found": true,
    "lcname": "kaspad-client"
}
        
Elapsed time: 0.21276s