Metadata-Version: 2.4
Name: nanopy
Version: 28.0.1.post10
Summary: Python implementation of NANO currency related functions
Project-URL: Repository, https://github.com/nkr0/nanopy
Project-URL: Documentation, https://nkr0.github.io/nanopy
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: cibasic
Requires-Dist: mnemonic; extra == "cibasic"
Requires-Dist: pytest; extra == "cibasic"
Provides-Extra: cifull
Requires-Dist: black; extra == "cifull"
Requires-Dist: coverage; extra == "cifull"
Requires-Dist: keyring; extra == "cifull"
Requires-Dist: mnemonic; extra == "cifull"
Requires-Dist: mypy; extra == "cifull"
Requires-Dist: pylint[spelling]; extra == "cifull"
Requires-Dist: pytest; extra == "cifull"
Requires-Dist: requests; extra == "cifull"
Requires-Dist: sphinx-autodoc-typehints; extra == "cifull"
Requires-Dist: types-requests; extra == "cifull"
Requires-Dist: websocket-client; extra == "cifull"
Dynamic: license-file

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

```sh
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](https://setuptools.pypa.io/) for further info.

GPU support can be enabled with ``USE_GPU=1`` and appropriate *OpenCL ICD* headers.

```sh
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
```py
# 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.
