# 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 -->
[](https://github.com/pwrlabs/pwrpy/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[](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/c3/f6/6b901441493f951efb07b2c8c825a5213308a0e4c9781b319c133bf18387/pwrpy-6.1.0.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[](https://github.com/pwrlabs/pwrpy/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)\n[](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.1.0",
"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": "d71e3e8f118e4b7dec7423db76a45591ea24722657f6b6213841bbcd8aef90ef",
"md5": "cb83dacdfe196778606c2108429dfaa0",
"sha256": "db4da49426a12e918ec4a5e1bb187f7b6312244accb8c934e2679f1a9475604b"
},
"downloads": -1,
"filename": "pwrpy-6.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cb83dacdfe196778606c2108429dfaa0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 117117,
"upload_time": "2025-07-16T15:32:14",
"upload_time_iso_8601": "2025-07-16T15:32:14.319107Z",
"url": "https://files.pythonhosted.org/packages/d7/1e/3e8f118e4b7dec7423db76a45591ea24722657f6b6213841bbcd8aef90ef/pwrpy-6.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c3f66b901441493f951efb07b2c8c825a5213308a0e4c9781b319c133bf18387",
"md5": "2e54d1a681cdc7a52bb51360a60534cf",
"sha256": "2c280bfdfb5ea9ee9850ab636a4dd40d3e7e2453e50d62777689ee2c34f2c585"
},
"downloads": -1,
"filename": "pwrpy-6.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2e54d1a681cdc7a52bb51360a60534cf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 115850,
"upload_time": "2025-07-16T15:32:16",
"upload_time_iso_8601": "2025-07-16T15:32:16.899535Z",
"url": "https://files.pythonhosted.org/packages/c3/f6/6b901441493f951efb07b2c8c825a5213308a0e4c9781b319c133bf18387/pwrpy-6.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 15:32:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pwrlabs",
"github_project": "pwrpy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pwrpy"
}