Nano Wallet Library (nanowallet)
A modern, asynchronous Python library for interacting with the Nano cryptocurrency network. nanowallet supports read-only monitoring and authenticated operations via private key or seed+index, providing full transaction capabilities including sending, receiving, and sweeping funds.
Designed with type safety and robust error handling in mind.
Key Features
- Asynchronous: Built with
asynciofor efficient network communication. - Typed: Fully type-hinted for better developer experience and static analysis.
- Wallet Types:
NanoWalletReadOnly: Monitor accounts without exposing keys.NanoWalletAuthenticated: Operate a wallet using a private key (viacreate_wallet_from_private_key) or seed+index (viacreate_wallet_from_seed).
- Comprehensive Operations: Send, receive (specific blocks or all pending), sweep funds, check history, get account info.
- Safe Error Handling: Uses a
NanoResult[T]wrapper to prevent unexpected crashes, promoting explicit error checks. - Automatic State Management: Handles Nano's sequential block requirements automatically after operations.
- Configurable: Set default representatives, control work generation sources.
- Automatic Retry: Includes methods like
send_with_retryfor handling transient network/RPC issues.
Installation
pip install nanowallet
Requires Python 3.8+
Quick Start
import asyncio
from nanowallet import create_wallet_from_seed, NanoWalletRpc, WalletConfig
from nanowallet.utils import sum_received_amount
async def main():
# Connect to a Nano node
rpc = NanoWalletRpc(url="http://localhost:7076")
wallet_config = WalletConfig(use_work_peers=False) # Optional configuration
# Create wallet from seed and index
# ------------------------------------------------------------
wallet = create_wallet_from_seed(
rpc=rpc,
seed="0000000000000000000000000000000000000000000000000000000000000000",
index=0,
config=wallet_config,
)
# Check balance
# ------------------------------------------------------------
response = await wallet.balance_info()
balance_info = response.unwrap() # Option 1 - .unwrap() to handle the response
print(f"Balance: {balance_info.balance} NANO")
print(f"Receivable Balance: {balance_info.receivable} NANO")
# Receive all pending transactions
# ------------------------------------------------------------
result = await wallet.receive_all()
if result.success: # Option 2 - check success
received_amount = sum_received_amount(result.value)
print(f"Received {len(result.value)} blocks!")
print(f"Received amount: {received_amount.amount} NANO")
else:
print(f"Error receiving blocks: {result.error}")
# Send entire balance to another account
# ------------------------------------------------------------
destination = "nano_3msc38fyn67pgio16dj586pdrceahtn75qgnx7fy19wscixrc8dbb3abhbw6"
send_result = await wallet.sweep(
destination, sweep_pending=True
) # Sweeps pending/receivable balance + confirmed balance
try:
send_hash = send_result.unwrap()
print(f"Sent! Block hash: {send_hash}")
except Exception as e:
print(f"Error sending: {e}")
asyncio.run(main())
That's it! The library handles all the complexity of work generation, block signing, and state management for you.
Documentation
For full details on wallet types, methods, error handling, and configuration, see the Full Documentation.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for nanowallet 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nanowallet-0.1.8.tar.gz | 57.1 kB | Without provenance | Details for nanowallet-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nanowallet-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for nanowallet-0.1.8-py3-none-any.whl |
Total release size: 97.8 kB
Release files / nanowallet-0.1.8.tar.gz
| Download URL | nanowallet-0.1.8.tar.gz |
|---|---|
| Size | 57.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3156afdb10b4dfd9495371b19974e34f6c6f42a9bf5b56dcde8e167d1879baa1
|
|
BLAKE2b-256 checksum How to use checksums |
16bbc12f4c79564207642061cd270a01268625baa170d64a6ad16209f8c15356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / nanowallet-0.1.8-py3-none-any.whl
| Download URL | nanowallet-0.1.8-py3-none-any.whl |
|---|---|
| Size | 40.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3ce3a71f3891ba36d004c8bb423a2c4dc0ffe3f9ebabb8dda9fee333f18691e
|
|
BLAKE2b-256 checksum How to use checksums |
3dae93eb84fa306b871d31bfc992c3c4a1cfdb7a7879b12975304b84ac299a1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Security for nanowallet 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.