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_GPU=1 and appropriate OpenCL ICD headers.

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

Usage

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

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

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

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

# broadcast
rpc.process(rb.json)
rpc.process(sb.json)

Wallet

Although not part of the package, the light wallet included in the repository can be a reference to understand how the library works.

  • Configuration is in ~/.config/nanopy.ini
  • -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 KEY, and use seeds from system keyring. KEY is an entry previously generated by this wallet. 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.post10.tar.gz (117.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for nanopy-28.0.1.post10.tar.gz
Algorithm Hash digest
SHA256 a3b408959e377659ff7faa54f87e0eae3a17f21f3e3a976ae3079eaea3e7c6b3
MD5 0654895cbc8f00ab16b794233ef85c07
BLAKE2b-256 88c743eb74ebfe675d57f5218adc07fd4dfaab4c1cbca0996ce8bd050396215b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanopy-28.0.1.post10.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