pwrpy


Namepwrpy JSON
Version 6.0.9 PyPI version JSON
download
home_pagehttps://github.com/pwrlabs/pwrpy
SummaryPWRPY is a Python library for interacting with the PWR network.
upload_time2025-07-10 09:45:24
maintainerNone
docs_urlNone
authorPWR Labs
requires_python>=3.8
licenseMIT
keywords pwr network python library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PWRPY

PWRPY is a Python library for interacting with the PWR network.
It provides an easy interface for wallet management and sending transactions on PWR.

<div align="center">
<!-- markdownlint-restore -->

[![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/pwrlabs/pwrpy/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![pypi](https://img.shields.io/pypi/v/pwrpy)](https://pypi.org/project/pwrpy/)
<a href="https://github.com/pwrlabs/pwrpy/blob/main/LICENSE/">
  <img src="https://img.shields.io/badge/license-MIT-black">
</a>
<!-- <a href="https://github.com/pwrlabs/pwrpy/stargazers">
  <img src='https://img.shields.io/github/stars/pwrlabs/pwrpy?color=yellow' />
</a> -->
<a href="https://pwrlabs.io/">
  <img src="https://img.shields.io/badge/powered_by-PWR Chain-navy">
</a>
<a href="https://www.youtube.com/@pwrlabs">
  <img src="https://img.shields.io/badge/Community%20calls-Youtube-red?logo=youtube"/>
</a>
<a href="https://twitter.com/pwrlabs">
  <img src="https://img.shields.io/twitter/follow/pwrlabs?style=social"/>
</a>

</div>

## Installation

```bash
# latest official release (main branch)
pip3 install pwrpy
```

## 🌐 Documentation

How to [Guides](https://docs.pwrlabs.io/pwrchain/overview) 🔜 & [API](https://docs.pwrlabs.io/developers/sdks/overview) 💻

Play with [Code Examples](https://github.com/keep-pwr-strong/pwr-examples/) 🎮

## 💫 Getting Started

**Import the library:**

```python
from pwrpy.pwrsdk import PWRPY
from pwrpy.pwrwallet import Wallet
```

**Set your RPC node:**

```python
pwr = PWRPY("https://pwrrpc.pwrlabs.io/")
```

**Generate a new random wallet:**

```python
wallet = Wallet.new_random(12)
```

**Import wallet by Seed Phrase:**

```python
seed_phrase = "your seed phrase here"
wallet = Wallet.new(seed_phrase)
```

**Get wallet address:**

```python
address = wallet.get_address()
```

**Get wallet seed phrase:**

```python
seed_phrase = wallet.get_seed_phrase()
```

**Get wallet balance:**

```python
balance = wallet.get_balance()
```

**Get private key:**

```python
pk = wallet.get_private_key()
```

**Transfer PWR tokens:**

```python
response = wallet.transfer_pwr("recipientAddress", "amount", "fee_per_byte")
```

Sending a transcation to the PWR Chain returns a Response object, which specified if the transaction was a success, and returns relevant data.
If the transaction was a success, you can retrieive the transaction hash, if it failed, you can fetch the error.

```python
from pwrpy.pwrwallet import Wallet
seed_phrase = "your seed phrase here"
wallet = Wallet.new(seed_phrase)
amount = 1000
fee_per_byte = wallet.get_rpc().get_fee_per_byte()

response = wallet.transfer_pwr("recipientAddress", amount, fee_per_byte)
if response.success:
    print("Transfer:", response.__dict__)
else:
    print("FAILED!")
```

**Send data to a VIDA:**

```python
from pwrpy.pwrwallet import Wallet
seed_phrase = "your seed phrase here"
wallet = Wallet.new(seed_phrase)

vida_id = 123
data = "Hello World!"
fee_per_byte = wallet.get_rpc().get_fee_per_byte()

response = wallet.send_vida_data(vida_id, data.encode(), fee_per_byte)
if response.success:
    print("SendVidaData:", response.__dict__)
else:
    print("FAILED!")
```

### Other Static Calls

**Get RPC Node Url:**

Returns currently set RPC node URL.

```python
url = pwr.get_rpc_node_url()
```

**Get Fee Per Byte: **

Gets the latest fee-per-byte rate.

```python
fee = pwr.get_fee_per_byte()
```

**Get Balance Of Address:**

Gets the balance of a specific address.

```python
balance = pwr.get_balance_of_address('0x...')
```

**Get Nonce Of Address:**

Gets the nonce/transaction count of a specific address.

```python
nonce = pwr.get_nonce_of_address('0x...')
```

**Get VIDA Data:**

```python
start_block = 843500
end_block = 843750
vida_id = 123

transactions = pwr.get_vida_data_transactions(start_block, end_block, vida_id)
for txs in transactions:
    print("Data:", txs.data)
```

## ✏️ Contributing

If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/pwrlabs/pwrpy/blob/main/CONTRIBUTING.md) first.

You can also join our dedicated channel for [pwrpy](https://discord.com/channels/1141787507189624992/1167387492153032735) on the [PWR Chain Discord](https://discord.com/invite/YASmBk9EME)

## 📜 License

Copyright (c) 2025 PWR Labs

Licensed under the [MIT license](https://github.com/pwrlabs/pwrpy/blob/main/LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pwrlabs/pwrpy",
    "name": "pwrpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "pwr, network, python, library",
    "author": "PWR Labs",
    "author_email": "devservices@pwrlabs.io",
    "download_url": "https://files.pythonhosted.org/packages/6c/b1/6e4ca757c16a95be2ddec01dfe811ca9e250581da34a116b84971946b285/pwrpy-6.0.9.tar.gz",
    "platform": null,
    "description": "# PWRPY\n\nPWRPY is a Python library for interacting with the PWR network.\nIt provides an easy interface for wallet management and sending transactions on PWR.\n\n<div align=\"center\">\n<!-- markdownlint-restore -->\n\n[![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/pwrlabs/pwrpy/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)\n[![pypi](https://img.shields.io/pypi/v/pwrpy)](https://pypi.org/project/pwrpy/)\n<a href=\"https://github.com/pwrlabs/pwrpy/blob/main/LICENSE/\">\n  <img src=\"https://img.shields.io/badge/license-MIT-black\">\n</a>\n<!-- <a href=\"https://github.com/pwrlabs/pwrpy/stargazers\">\n  <img src='https://img.shields.io/github/stars/pwrlabs/pwrpy?color=yellow' />\n</a> -->\n<a href=\"https://pwrlabs.io/\">\n  <img src=\"https://img.shields.io/badge/powered_by-PWR Chain-navy\">\n</a>\n<a href=\"https://www.youtube.com/@pwrlabs\">\n  <img src=\"https://img.shields.io/badge/Community%20calls-Youtube-red?logo=youtube\"/>\n</a>\n<a href=\"https://twitter.com/pwrlabs\">\n  <img src=\"https://img.shields.io/twitter/follow/pwrlabs?style=social\"/>\n</a>\n\n</div>\n\n## Installation\n\n```bash\n# latest official release (main branch)\npip3 install pwrpy\n```\n\n## \ud83c\udf10 Documentation\n\nHow to [Guides](https://docs.pwrlabs.io/pwrchain/overview) \ud83d\udd1c & [API](https://docs.pwrlabs.io/developers/sdks/overview) \ud83d\udcbb\n\nPlay with [Code Examples](https://github.com/keep-pwr-strong/pwr-examples/) \ud83c\udfae\n\n## \ud83d\udcab Getting Started\n\n**Import the library:**\n\n```python\nfrom pwrpy.pwrsdk import PWRPY\nfrom pwrpy.pwrwallet import Wallet\n```\n\n**Set your RPC node:**\n\n```python\npwr = PWRPY(\"https://pwrrpc.pwrlabs.io/\")\n```\n\n**Generate a new random wallet:**\n\n```python\nwallet = Wallet.new_random(12)\n```\n\n**Import wallet by Seed Phrase:**\n\n```python\nseed_phrase = \"your seed phrase here\"\nwallet = Wallet.new(seed_phrase)\n```\n\n**Get wallet address:**\n\n```python\naddress = wallet.get_address()\n```\n\n**Get wallet seed phrase:**\n\n```python\nseed_phrase = wallet.get_seed_phrase()\n```\n\n**Get wallet balance:**\n\n```python\nbalance = wallet.get_balance()\n```\n\n**Get private key:**\n\n```python\npk = wallet.get_private_key()\n```\n\n**Transfer PWR tokens:**\n\n```python\nresponse = wallet.transfer_pwr(\"recipientAddress\", \"amount\", \"fee_per_byte\")\n```\n\nSending a transcation to the PWR Chain returns a Response object, which specified if the transaction was a success, and returns relevant data.\nIf the transaction was a success, you can retrieive the transaction hash, if it failed, you can fetch the error.\n\n```python\nfrom pwrpy.pwrwallet import Wallet\nseed_phrase = \"your seed phrase here\"\nwallet = Wallet.new(seed_phrase)\namount = 1000\nfee_per_byte = wallet.get_rpc().get_fee_per_byte()\n\nresponse = wallet.transfer_pwr(\"recipientAddress\", amount, fee_per_byte)\nif response.success:\n    print(\"Transfer:\", response.__dict__)\nelse:\n    print(\"FAILED!\")\n```\n\n**Send data to a VIDA:**\n\n```python\nfrom pwrpy.pwrwallet import Wallet\nseed_phrase = \"your seed phrase here\"\nwallet = Wallet.new(seed_phrase)\n\nvida_id = 123\ndata = \"Hello World!\"\nfee_per_byte = wallet.get_rpc().get_fee_per_byte()\n\nresponse = wallet.send_vida_data(vida_id, data.encode(), fee_per_byte)\nif response.success:\n    print(\"SendVidaData:\", response.__dict__)\nelse:\n    print(\"FAILED!\")\n```\n\n### Other Static Calls\n\n**Get RPC Node Url:**\n\nReturns currently set RPC node URL.\n\n```python\nurl = pwr.get_rpc_node_url()\n```\n\n**Get Fee Per Byte: **\n\nGets the latest fee-per-byte rate.\n\n```python\nfee = pwr.get_fee_per_byte()\n```\n\n**Get Balance Of Address:**\n\nGets the balance of a specific address.\n\n```python\nbalance = pwr.get_balance_of_address('0x...')\n```\n\n**Get Nonce Of Address:**\n\nGets the nonce/transaction count of a specific address.\n\n```python\nnonce = pwr.get_nonce_of_address('0x...')\n```\n\n**Get VIDA Data:**\n\n```python\nstart_block = 843500\nend_block = 843750\nvida_id = 123\n\ntransactions = pwr.get_vida_data_transactions(start_block, end_block, vida_id)\nfor txs in transactions:\n    print(\"Data:\", txs.data)\n```\n\n## \u270f\ufe0f Contributing\n\nIf you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/pwrlabs/pwrpy/blob/main/CONTRIBUTING.md) first.\n\nYou can also join our dedicated channel for [pwrpy](https://discord.com/channels/1141787507189624992/1167387492153032735) on the [PWR Chain Discord](https://discord.com/invite/YASmBk9EME)\n\n## \ud83d\udcdc License\n\nCopyright (c) 2025 PWR Labs\n\nLicensed under the [MIT license](https://github.com/pwrlabs/pwrpy/blob/main/LICENSE).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PWRPY is a Python library for interacting with the PWR network.",
    "version": "6.0.9",
    "project_urls": {
        "Documentation": "https://docs.pwrlabs.io/",
        "Homepage": "https://github.com/pwrlabs/pwrpy",
        "Repository": "https://github.com/pwrlabs/pwrpy"
    },
    "split_keywords": [
        "pwr",
        " network",
        " python",
        " library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "faa3d553e65a8aee8adaf7adb3c63ed8e1a661aab698d4b9fa60dc87bc42822d",
                "md5": "1dc9892051e1aa65753d486e7f64747c",
                "sha256": "40b67ccd38ddfeabf18b7150069fbdebff35ba9e18be07d9e47552941b4c1c4f"
            },
            "downloads": -1,
            "filename": "pwrpy-6.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1dc9892051e1aa65753d486e7f64747c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 116289,
            "upload_time": "2025-07-10T09:45:22",
            "upload_time_iso_8601": "2025-07-10T09:45:22.765446Z",
            "url": "https://files.pythonhosted.org/packages/fa/a3/d553e65a8aee8adaf7adb3c63ed8e1a661aab698d4b9fa60dc87bc42822d/pwrpy-6.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6cb16e4ca757c16a95be2ddec01dfe811ca9e250581da34a116b84971946b285",
                "md5": "e7a9c7104a16f22fa025d5e5683fb370",
                "sha256": "c04ef1f0ae96793c4cca425e657376316d33a741b1124ef6202742b0196a3563"
            },
            "downloads": -1,
            "filename": "pwrpy-6.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "e7a9c7104a16f22fa025d5e5683fb370",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 114962,
            "upload_time": "2025-07-10T09:45:24",
            "upload_time_iso_8601": "2025-07-10T09:45:24.504887Z",
            "url": "https://files.pythonhosted.org/packages/6c/b1/6e4ca757c16a95be2ddec01dfe811ca9e250581da34a116b84971946b285/pwrpy-6.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-10 09:45:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pwrlabs",
    "github_project": "pwrpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pwrpy"
}
        
Elapsed time: 0.43382s