Skip to main content

Python implementation of NANO currency related functions

Project description

nanopy

nanopy includes C extensions for work generation and signing, and therefore needs a compiler to install.

sudo apt install gcc python3-dev
pip install nanopy

When needed, use the environment variables CC, LDSHARED, CFLAGS, and LDFLAGS to tweak build options. See setuptools documentation for further info.

GPU support can be enabled with USE_OCL=1 and appropriate OpenCL dependencies.

sudo apt install gcc python3-dev ocl-icd-opencl-dev intel/mesa/nvidia/pocl/rocm-opencl-icd
USE_OCL=1 pip install nanopy
  • Install mnemonic to generate mnemonic wallets.
  • Install requests or websocket-client to use http or websocket RPC, respectively.

Usage

from nanopy import Account, deterministic_key
from nanopy.rpc import HTTP

# create an account (defaults to NANO network) and set secret key
acc = Account(sk=deterministic_key(seed="0000000...."))

# if it is not a new account, set the current state of the account (frontier, raw bal, rep)
acc.state = ("1234....", 1200000000000000, Account(addr="nano_repaddress..."))

# create a receive block and optionally, change rep along with it
rb = acc.receive(hash_="5678....", raw_amt=acc.network.to_raw("10"), rep=Account(addr="nano_newrepaddress..."))

# create a send block
sb = acc.send(Account(addr="nano_sendaddress..."), acc.network.to_raw("1"))

# broadcast
r = HTTP(url="http://localhost:7076")
r.process(rb.json)
r.process(sb.json)

Wallet

A cli wallet is included with the library

  • Configuration is in ~/.config/nanopy.ini
[nano]
nano_1111111111111111111111111111111111111111111111111111hifc8npp
nano_16aj46aj46aj46aj46aj46aj46aj46aj46aj46aj46aj46aj46ajbtsyew7c
rpc = http://localhost:7076
  • -n, --network. Choose the network to interact with - nano, banano, or beta. The default network is nano.
  • Checks state of accounts in ~/.config/nanopy.ini by default.
  • Open a wallet, nanopy-wallet open FILE KEY. KEY is a seed in a KDBX FILE. See nanopy-wallet open -h for options.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanopy-28.0.1.post16.tar.gz (123.9 kB view details)

Uploaded Source

File details

Details for the file nanopy-28.0.1.post16.tar.gz.

File metadata

  • Download URL: nanopy-28.0.1.post16.tar.gz
  • Upload date:
  • Size: 123.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanopy-28.0.1.post16.tar.gz
Algorithm Hash digest
SHA256 2ab1ce41e2704b0056547f59e14d70fe12f54fec9441bf532e163401395321da
MD5 7a3b6642b32289fe2c718a89bb62fe57
BLAKE2b-256 15dc47e486417419fc4497e4f4d9fcc59f24d507110fbff271dd5f42dd5898ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanopy-28.0.1.post16.tar.gz:

Publisher: nanopy.yml on nkr0/nanopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page