Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gr0vity-dev/nanotopy
The easiest way to prototype nano apps
https://github.com/gr0vity-dev/nanotopy
Last synced: 6 days ago
JSON representation
The easiest way to prototype nano apps
- Host: GitHub
- URL: https://github.com/gr0vity-dev/nanotopy
- Owner: gr0vity-dev
- Created: 2024-01-23T11:17:38.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-23T12:46:17.000Z (about 1 year ago)
- Last Synced: 2025-01-08T05:06:56.321Z (about 1 month ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### nanoto_py : Python gateway to rpc.nano.to
The goal is to create the easiest way to prototype nano apps.Get your free API_KEY from https://rpc.nano.to and hack around!
### How to install :
```
pip install nanotopy
```
or from source :
```
git clone https://github.com/gr0vity-dev/nanotopy.git
cd nanotopy
pip install .
```### Example code :
```python
import asyncio
from nanotopy.client import NanoToasync def run():
# This can only be done once ! Write down the key!
AUTH_KEY = await NanoTo.get_auth_key("[email protected]")
print(AUTH_KEY)
nano_to = NanoTo(AUTH_KEY["key"])# Create a new nano account
# Seed generation is done locally! No secrets are ever shared
seed = NanoTo.generate_seed()
seed_index = 0
# Same seed and seed_index will ALWAYS result in the same private_key
private_key = NanoTo.get_private_key_from_seed(seed, seed_index)
account = NanoTo.get_account_from_key(private_key)
print(account)# Get account info
account_info = await nano_to.account_info(account)
print(account_info)# Receive all blocks
received_hashes = await nano_to.receive_blocks_many(private_key)
print(received_hashes)if __name__ == "__main__":
asyncio.run(run())
```